Commit 8028d68b authored by Sofiane Bendoukha's avatar Sofiane Bendoukha
Browse files

Add gpu support (--nv).

parent 2a1a1653
...@@ -101,6 +101,11 @@ SJ_FRONTEND_HOST="mistralpp.dkrz.de" ...@@ -101,6 +101,11 @@ SJ_FRONTEND_HOST="mistralpp.dkrz.de"
# image name. # image name.
SJ_IMAGE="" SJ_IMAGE=""
# Slurm Options
# additional slurm options that users
# can pass to the sbatch script
SJ_SLURM_OPTIONS=""
function clean_up () { function clean_up () {
trap - ERR EXIT trap - ERR EXIT
set +e set +e
...@@ -140,6 +145,7 @@ Available values for OPTION include: ...@@ -140,6 +145,7 @@ Available values for OPTION include:
-d check for presence of jupyter -d check for presence of jupyter
-f system mistral, vader -f system mistral, vader
-i file source file prior to running jupyter -i file source file prior to running jupyter
-o options slurm options
-n ntasks request ntasks tasks for job -n ntasks request ntasks tasks for job
-p partition run job on partition -p partition run job on partition
-s image singularity image -s image singularity image
...@@ -152,7 +158,7 @@ EOF ...@@ -152,7 +158,7 @@ EOF
function parse_options () { function parse_options () {
local option local option
while getopts 'A:c:di:f:n:p:t:u:s:' option; do while getopts 'A:c:di:o:f:n:p:t:u:s:' option; do
case ${option} in case ${option} in
A) SJ_ACCTCODE="$OPTARG" A) SJ_ACCTCODE="$OPTARG"
;; ;;
...@@ -164,6 +170,8 @@ function parse_options () { ...@@ -164,6 +170,8 @@ function parse_options () {
;; ;;
i) SJ_INCFILE="$OPTARG" i) SJ_INCFILE="$OPTARG"
;; ;;
o) SJ_SLURM_OPTIONS="$OPTARG"
;;
n) SJ_NTASKS="$OPTARG" n) SJ_NTASKS="$OPTARG"
;; ;;
p) SJ_PARTITION="$OPTARG" p) SJ_PARTITION="$OPTARG"
...@@ -189,6 +197,7 @@ function parse_options () { ...@@ -189,6 +197,7 @@ function parse_options () {
readonly SJ_USERNAME readonly SJ_USERNAME
readonly SJ_IMAGE readonly SJ_IMAGE
readonly SJ_FRONTEND_HOST readonly SJ_FRONTEND_HOST
readonly SJ_SLURM_OPTIONS
} }
function ssh_frontend () { function ssh_frontend () {
...@@ -233,7 +242,7 @@ function assemble_commandline () { ...@@ -233,7 +242,7 @@ function assemble_commandline () {
commandline="nohup ${commandline} > /dev/null & echo \$!" commandline="nohup ${commandline} > /dev/null & echo \$!"
fi fi
if [[ -n ${SJ_IMAGE} ]]; then if [[ -n ${SJ_IMAGE} ]]; then
commandline="singularity exec ${SJ_IMAGE} ${commandline}" commandline="singularity exec --nv ${SJ_IMAGE} ${commandline}"
fi fi
commandline="$(source_incfile "${commandline}")" commandline="$(source_incfile "${commandline}")"
echo "${commandline}" echo "${commandline}"
...@@ -252,6 +261,7 @@ function submit_jupyter_job () { ...@@ -252,6 +261,7 @@ function submit_jupyter_job () {
#SBATCH --account=${SJ_ACCTCODE} #SBATCH --account=${SJ_ACCTCODE}
#SBATCH --output=/dev/null #SBATCH --output=/dev/null
#SBATCH --parsable #SBATCH --parsable
#SBATCH ${SJ_SLURM_OPTIONS}
##SBATCH --dkrzepilog=0 ##SBATCH --dkrzepilog=0
cd \${HOME} cd \${HOME}
echo "NODE:\${SLURM_JOB_NODELIST}" > ${logfile} echo "NODE:\${SLURM_JOB_NODELIST}" > ${logfile}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment