-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrecipe.def
83 lines (73 loc) · 3.06 KB
/
recipe.def
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
BootStrap: docker
From: fedora:38
%files
SubPrecisionContactDetection.jl.zip /opt/SubPrecisionContactDetection.jl.zip
%post
## Get the tools we'll need
#dnf install -y wget unzip python3 R python3-pip g++ openssh-clients curl
dnf install -y wget unzip python3 g++ python3-pip which
dnf groupinstall -y 'Development Tools'
pip install kneed
pip install scikit-image
pip install scipy
pip install pandas
pip install argparse
pip install scikit-learn
export PYTHON=`which python3`
echo $PYTHON
## Setup Julia
export JLMJV=1.10
export JLV=$JLMJV.5
export JULIA_TGZ=julia-$JLV-linux-x86_64.tar.gz
mkdir -p /opt/julia && cd /opt/julia
wget https://julialang-s3.julialang.org/bin/linux/x64/$JLMJV/$JULIA_TGZ && tar -xf $JULIA_TGZ && rm $JULIA_TGZ
export PATH=/opt/julia/julia-$JLV/bin:$PATH
export JULIA_DEPOT_PATH=/opt/juliadepot
mkdir -p $JULIA_DEPOT_PATH
## Setup local package
export PKGNAME="SubPrecisionContactDetection"
cd /opt && unzip $PKGNAME.jl.zip
export LOCALPKG=/opt/$PKGNAME.jl
cd $LOCALPKG
julia --project=$LOCALPKG -e 'using Pkg; Pkg.update(); ENV["PYTHON"]="/usr/bin/python3"; Pkg.build(); Pkg.instantiate()'
julia --project=$LOCALPKG -e 'using SubPrecisionContactDetection'
echo "Setting up precompile"
julia --project=$LOCALPKG --trace-compile=dc_precompile.jl scripts/precompile.jl
echo "Creating test data"
julia --project=$LOCALPKG scripts/setupdata.jl
echo "Profiling API"
julia --project=$LOCALPKG --trace-compile=dc_precompile2.jl scripts/ercontacts.jl --inpath /tmp/testdata -r "*[1,2].tif" -w 2 --sigmas 2.5-2.5-1.5 --outpath /tmp --nooutput --alpha 0.01 --beta 0.01 -c 1 -v 2000 --dimension 3 --mode=decon
cat dc_precompile2.jl >> dc_precompile.jl
#echo "Building precompiled image"
julia --project=$LOCALPKG scripts/setupimage.jl
rm -rf /opt/juliadepot/logs
ln -s /dev/shm/ /opt/juliadepot/logs
ln -s /dev/shm/ /opt/juliadepot/scratchspaces/
chmod +x /opt/SubPrecisionContactDetection.jl/runjulia.sh
chmod -R 777 /opt/SubPrecisionContactDetection.jl
chmod -R 777 /opt/juliadepot
chmod -R 777 /opt/julia
## Cleanup
dnf remove -y wget unzip
%environment
export LC_ALL=C
export LOCALPKG=/opt/SubPrecisionContactDetection.jl
export JLMJV=1.10
export JLV=$JLMJV.5
export PATH=/opt/julia/julia-$JLV/bin:$PATH
export JULIA_DEPOT_PATH=/opt/juliadepot
export PYTHON="/usr/bin/python3"
%runscript
echo "Executing runjulia.sh with args $@"
/opt/SubPrecisionContactDetection.jl/runjulia.sh "$@"
%labels
Author Ben Cardoen, bcardoen@sfu.ca
Version v0.0.3
%help
Usage (interactively):
singularity shell image.sif
Singularity> julia --project=/opt/SubPrecisionContactDetection.jl
or
singularity exec image.sif julia --project=/opt/SubPrecisionContactDetection.jl <yourcode>
or for fastest execution
singularity exec image.sif julia --project=/opt/SubPrecisionContactDetection.jl --sysimage=/opt/SubPrecisionContactDetection.jl/sys_img.so <yourcode.jl>