-
Notifications
You must be signed in to change notification settings - Fork 1
/
chicken-and-egg-in-singularity.sh
executable file
·61 lines (38 loc) · 1.62 KB
/
chicken-and-egg-in-singularity.sh
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
#!/bin/bash
## CUSTOMIZE !!!
WORKDIR=
PDBIN=
[ -d "$WORKDIR" -a -f "$WORKDIR/$PDBIN" ] || { echo WORKDIR must be set, $PDBIN must exist >&2; exit 1; }
cd $SCRATCHDIR || { exit 1; }
mkdir tmp local work
SINGULARITY_TMPDIR=$SCRATCHDIR/tmp
SINGULARITY_CACHEDIR=$SCRATCHDIR
SINGULARITY_DOCKER_USERNAME=chicken-and-egg
# FILL IN
SINGULARITY_DOCKER_PASSWORD=
DOCKER_IMAGE=registry.gitlab.ics.muni.cz:443/3086/chicken-and-egg:latest
export SINGULARITY_TMPDIR SINGULARITY_CACHEDIR SINGULARITY_DOCKER_USERNAME SINGULARITY_DOCKER_PASSWORD
[ -z "$DONTPULL" ] && singularity pull docker://$DOCKER_IMAGE
NTMPI=1 # good for small molecules
cat - >work/config.py <<EOF
pdbfile = "$PDBIN"
mdsteps = 25000000 # 50 ns is enough
ntmpi = $NTMPI
ntomp = $(($PBS_NUM_PPN / $NTMPI)) # XXX: should be divisible
EOF
cp $WORKDIR/$PDBIN work
SINGULARITYENV_OMP_NUM_THREADS=$PBS_NUM_PPN
export SINGULARITYENV_OMP_NUM_THREADS
# https://github.com/ContinuumIO/anaconda-issues/issues/11294
SINGULARITYENV_KMP_INIT_AT_FORK=FALSE
export SINGULARITYENV_KMP_INIT_AT_FORK
for var in $(env | grep '^PBS_' | sed 's/=.*$//'); do
unset $var
done
singularity exec --nv \
-B $SCRATCHDIR/work:/work \
-B $SCRATCHDIR/local:/home/jupyter/.local \
chicken-and-egg-latest.simg \
bash -c 'source /opt/intelpython3/bin/activate && cd /work && cp /home/jupyter/* . && jupyter nbconvert --ExecutePreprocessor.timeout=None --to notebook --execute chicken-and-egg.ipynb'
# bash -c 'source /opt/intelpython3/bin/activate && cd /work && cp /home/jupyter/* . && jupyter notebook --ip 0.0.0.0 --port 9000'
cd work && tar cf - *ipynb $(basename $PDBIN .pdb) | (cd $WORKDIR && tar xf -)