From ce495974e973f92beefc75ab5f931fdcbbfbd35a Mon Sep 17 00:00:00 2001 From: Mathis Rosenhauer <rosenhauer@dkrz.de> Date: Wed, 27 Sep 2017 16:01:26 +0200 Subject: [PATCH] Allow multinode jobs --- startvnc | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/startvnc b/startvnc index 2a9ade0..972226b 100755 --- a/startvnc +++ b/startvnc @@ -81,6 +81,11 @@ SVNC_GEOMETRY="1920x1200" # Session run time in minutes SVNC_RUNTIME=240 +# Number of GPU nodes reserved. Default is the special value "half" +# which allocates 24 cores of a node. To allocate one or more nodes, +# set to the integer number of nodes. +SVNC_NODES="half" + # Quality of service SVNC_QOS="normal" @@ -138,8 +143,9 @@ clean_up () { usage () { printf "Usage: %s [OPTIONS]\n" $(basename $0) >&2 - printf -- "-u username\n-A acctcode\n-g geometry\n-q qos\n-t time\n" >&2 - printf -- "-v path_to_vncviewer\n-x vncviewer_options\n" >&2 + printf -- "-u username\n-A acctcode\n-g geometry\n-n nodes\n" >&2 + printf -- "-q qos\n-t time\n-v path_to_vncviewer\n" >&2 + printf -- "-x vncviewer_options\n" >&2 } ssh_frontend () { @@ -152,12 +158,14 @@ ssh_frontend () { parse_options () { local option - while getopts 'A:g:q:t:u:v:x:' option; do + while getopts 'A:g:n:q:t:u:v:x:' option; do case ${option} in A) SVNC_ACCTCODE="$OPTARG" ;; g) SVNC_GEOMETRY="$OPTARG" ;; + n) SVNC_NODES="$OPTARG" + ;; q) SVNC_QOS="$OPTARG" ;; t) SVNC_RUNTIME="$OPTARG" @@ -200,10 +208,15 @@ prepare_vncserver () { } submit_vnc_job () { + if [[ ${SVNC_NODES} = "half" ]]; then + local sbatch_resources="#SBATCH --ntasks=24" + else + local sbatch_resources="#SBATCH --nodes=${SVNC_NODES}" + fi ssh_frontend "cd .startvnc && sbatch" <<EOF #!/bin/bash -l #SBATCH --partition=gpu -#SBATCH --ntasks=24 +${sbatch_resources} #SBATCH --qos=${SVNC_QOS} #SBATCH --time=${SVNC_RUNTIME} #SBATCH --account=${SVNC_ACCTCODE} @@ -211,6 +224,8 @@ submit_vnc_job () { #SBATCH --parsable #SBATCH --dkrzepilog=0 cd \${HOME} +scontrol show hostname \${SLURM_JOB_NODELIST} > \ + .startvnc/nodelist_\${SLURM_JOB_ID}.txt /opt/TurboVNC/bin/vncserver -fg -geometry "${SVNC_GEOMETRY}" -localhost EOF } -- GitLab