-
Notifications
You must be signed in to change notification settings - Fork 0
/
submit.yml.erb
79 lines (76 loc) · 2.71 KB
/
submit.yml.erb
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
<%
# your image location will differa
image="/apps/ondemand/containers/mate_v11a.sif"
%>
---
script:
native: [
"-n", "<%= ha_tasks.blank? ? 1 : ha_tasks.to_i %>",
"--ntasks-per-node=<%= [ha_tasks.blank? ? 1 : ha_tasks.to_i, 40 ].min %>",
<%- if not ha_gpus.blank? -%>
"--gres=gpu:<%= ha_gpus.to_i %>",
<%- end -%>
<%- if not ha_cpus.blank? -%>
"--cpus-per-task=<%= ha_cpus.to_i %>",
<%- end -%>
<%- if not ha_mem.blank? -%>
"--mem=<%= ha_mem.to_i %>G"
<%- end -%>
]
reservation_id: <%= ha_reservation.blank? ? "" : ha_reservation.strip %>
<% unless email.blank? %>
email: <%= email %>
<% end %>
batch_connect:
template: "vnc"
before_script: |
# Export the module function if it exists
[[ $(type -t module) == "function" ]] && export -f module
#export my_sport=$(find_port ${host})
#ssh -f -N -D${my_sport} cl1
# Running these here to be included inside the container.
#echo "DEBUG: SOCKS port is ${my_sport}"
#DISPLAY=:${display} gsettings set org.gnome.system.proxy mode manual
#DISPLAY=:${display} gsettings set org.gnome.system.proxy.socks host localhost
#DISPLAY=:${display} gsettings set org.gnome.system.proxy.socks port ${my_sport}
#export https_proxy=socks5h://localhost:${my_sport}
#export http_proxy=socks5h://localhost:${my_sport}
websockify_cmd: '/usr/bin/websockify'
script_wrapper: |
cat << "CTRSCRIPT" > container.sh
export PATH="$PATH:/opt/TurboVNC/bin"
[ -e /usr/local/cuda-11.2 ] && export CUDA_HOME=/usr/local/cuda-11.2
%s
CTRSCRIPT
random_number () {
shuf -i ${1}-${2} -n 1
}
find_port () {
local host="${1:-localhost}"
local port=$(random_number "${2:-2000}" "${3:-65535}")
while port_used "${host}:${port}"; do
port=$(random_number "${2:-2000}" "${3:-65535}")
done
echo "${port}"
}
export mumax_port=$(find_port ${host})
module load mumax3/3.10
<%- if not mumax_wdpath.blank? -%>
MUMAX_WDPATH=<%= mumax_wdpath %>
[ -d $MUMAX_WDPATH ] && cd $MUMAX_WDPATH
[ ! -d $MUMAX_WDPATH ] && echo "ERROR: $MUMAX_WDPATH not found."
<%- end -%>
mumax3-server -l 127.0.0.1:$mumax_port -scan 127.0.0.1 -ports $mumax_port &
<%- if not mumax_wdpath.blank? -%>
cd -
<%- end -%>
# your bindpath will differ
mkdir -p /tmp/$USER
export SINGULARITY_BINDPATH="/etc/ssh,/home,/nfshome,/scratch,/var,/run,/tmp/$USER:/run/user,/usr/share/glvnd"
if [ -e /usr/local/cuda ]
then
export SINGULARITY_BINDPATH="$SINGULARITY_BINDPATH,/usr/local/cuda"
fi
module load singularity
echo "INFO: About to run singularity"
singularity exec --nv <%= image %> /bin/bash container.sh