Skip to content

Instantly share code, notes, and snippets.

@jerinphilip
Created September 1, 2018 05:35
Show Gist options
  • Save jerinphilip/6252bbd7125b704e1dff69679f781efb to your computer and use it in GitHub Desktop.
Save jerinphilip/6252bbd7125b704e1dff69679f781efb to your computer and use it in GitHub Desktop.
SLURM related Bash functions and aliases
function summarize-user {
check_time=$(date +%Y-%m-%d -d "7 days ago")
sacct -S $check_time -u $1 --format=User,Account,Jobname,elapsed,ncpus,AllocTRES
}
function modquota {
echo sacctmgr -i modify account $1 set GrpTRES=gres/gpu=$2 GrpTRESMin=gres/gpu=$3;
sacctmgr -i modify account $1 set GrpTRES=gres/gpu=$2 GrpTRESMin=gres/gpu=$3;
}
function getquota {
sacctmgr show assoc | grep $1;
}
function my-jobs {
squeue -u $USER;
}
function my-quota {
scontrol show assoc_mgr Account=$USER flags=assoc |grep -m 1 'GrpTRESMins';
}
function view-job {
$EDITOR $HOME/slurm/outputs/*-${1}.out;
}
function get-modules {
MODULES=(cuda/8.0 cuda/9.0 cudnn/5.1-cuda-8.0 cudnn/6-cuda-8.0 cudnn/7-cuda-9.0)
for MODULE in ${MODULES[@]}
do
module load $MODULE
done
}
function get-research {
srun -p long -n 1 -A research --mem 64G --gres=gpu:2 --time 4-00:00:00 --pty /bin/bash
}
function jupyter-launch {
ssh -N -f -R 0.0.0.0:1617:localhost:1618 [email protected]
ssh -N -f -R 0.0.0.0:6006:localhost:6006 [email protected]
jupyter-notebook --no-browser --ip localhost --port 1618 &> /tmp/error.log &
mkdir /tmp/$USER;
tensorboard --logdir /tmp/jerin/logs &> /tmp/error-tb.log &
}
function group-quota {
sudo repquota -gs /share1 | sort -hk 3 | column -t
}
function user-quota {
sudo repquota -us /share1 | sort -hk 3 | column -t
}
function convert-to-sub {
JOBID=$1
scontrol update jobid=$JOBID account=sub qos=sub TimeLimit=6:00:00
}
function convert-to-research {
JOBID=$1
scontrol update jobid=$JOBID account=research qos=medium TimeLimit=4-00:00:00
}
function convert-to-cvit {
JOBID=$1
scontrol update jobid=$JOBID account=jerin qos=normal TimeLimit=4-00:00:00
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment