From c142b7f55fc674d044c4e4a5c3f91fddd7b442c3 Mon Sep 17 00:00:00 2001 From: ville rantanen Date: Thu, 8 Aug 2013 14:12:36 +0300 Subject: [PATCH] Added memory and cpu defaults to slurm --- slurp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/slurp b/slurp index 77b6834..5bb7dc5 100755 --- a/slurp +++ b/slurp @@ -5,6 +5,8 @@ Sends the command to a queue with srun Version (c) Ville.Rantanen@helsinki.fi Options: --possess Possess the whole node for the run + -c N Request number of CPUs [Def 4] + --mem M Request M Gb of memory [Def 20] -h This help Use the -- switch to separate switches assigned to slurp vs anything after.. @@ -14,6 +16,8 @@ then echo -e "$USAGE" exit 1 fi SHARE=-s +CPU=4 +MEM=20 declare -a argv=("$@") for (( i=1; i<=${#} ;i++ )) do [[ ${!i} == "--possess" ]] && { @@ -21,6 +25,16 @@ do [[ ${!i} == "--possess" ]] && { SHARE="" unset argv[$(( $i - 1 ))] } + [[ ${!i} == "-c" ]] && { + CPU=${argv[$i]} + unset argv[$(( $i - 1 ))] + unset argv[$(( $i ))] + } + [[ ${!i} == "--mem" ]] && { + MEM=${argv[$i]} + unset argv[$(( $i - 1 ))] + unset argv[$(( $i ))] + } [[ ${!i} == "-h" ]] && { echo -e "$USAGE" exit 1 @@ -30,5 +44,5 @@ do [[ ${!i} == "--possess" ]] && { } done -echo Running command: "${argv[@]}" -srun -v $SHARE "${argv[@]}" +echo Running command: srun $SHARE -c $CPU --mem $MEM "${argv[@]}" +srun -v $SHARE -c $CPU --mem $MEM "${argv[@]}"