Added memory and cpu defaults to slurm

This commit is contained in:
ville rantanen
2013-08-08 14:12:36 +03:00
parent 4c0306b557
commit c142b7f55f

18
slurp
View File

@@ -5,6 +5,8 @@ Sends the command to a queue with srun
Version (c) Ville.Rantanen@helsinki.fi Version (c) Ville.Rantanen@helsinki.fi
Options: Options:
--possess Possess the whole node for the run --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 -h This help
Use the -- switch to separate switches assigned to slurp vs anything after.. Use the -- switch to separate switches assigned to slurp vs anything after..
@@ -14,6 +16,8 @@ then echo -e "$USAGE"
exit 1 exit 1
fi fi
SHARE=-s SHARE=-s
CPU=4
MEM=20
declare -a argv=("$@") declare -a argv=("$@")
for (( i=1; i<=${#} ;i++ )) for (( i=1; i<=${#} ;i++ ))
do [[ ${!i} == "--possess" ]] && { do [[ ${!i} == "--possess" ]] && {
@@ -21,6 +25,16 @@ do [[ ${!i} == "--possess" ]] && {
SHARE="" SHARE=""
unset argv[$(( $i - 1 ))] 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" ]] && { [[ ${!i} == "-h" ]] && {
echo -e "$USAGE" echo -e "$USAGE"
exit 1 exit 1
@@ -30,5 +44,5 @@ do [[ ${!i} == "--possess" ]] && {
} }
done done
echo Running command: "${argv[@]}" echo Running command: srun $SHARE -c $CPU --mem $MEM "${argv[@]}"
srun -v $SHARE "${argv[@]}" srun -v $SHARE -c $CPU --mem $MEM "${argv[@]}"