1
0
Fork 0
mirror of https://github.com/hcartiaux/dotfiles.git synced 2024-10-18 17:25:23 +02:00

[bash] Slurm iris commands (c) UL HPC Team

This commit is contained in:
Hyacinthe Cartiaux 2020-01-07 17:26:50 +01:00
parent 6eac4945ca
commit 08cab05738

View file

@ -39,11 +39,45 @@ sjoin() {
srun --jobid "$JOBID" "$NODE" --pty bash -i
fi
}
irisstat() {
printf "%34s\n" "alloc/idle/other/total"
printf "%11s %s\n" "IRIS" "$(sinfo -h --format=%C | paste -sd " ")"
for p in batch interactive long; do
usagedata=$(sinfo -h -p $p --format=%C | paste -sd " ")
printf "%11s %s\n" $p "$usagedata"
done
irisstat(){
# -c to show compute only, -s to show storage only, (-a is default == all)
OPT=${1:-"-a"}
if [[ "$OPT" == "-c" || "$OPT" == "-a" ]]; then
sinfo -h --format=%C | awk -F '/' '{printf "Utilization: %.2f%%\n", $1/$4*100}'
printf "%0.s-" {1..50} ; printf "\n"
printf "%34s\n" "alloc/idle/other/total"
printf "%11s %s\n" "IRIS" "$(sinfo -h --format=%C | paste -sd " ")"
for p in batch bigmem gpu interactive long; do
if [[ "$p" == "gpu" ]]; then
#NGPUS=$(sinfo -h -N -p gpu -o %G | cut -d : -f3 | paste -sd + | bc)
NGPUS=72
NGPUSUSED=$(squeue -h -t R -p gpu -o "%b*%D" | grep gpu | cut -d : -f 2 | sed 's/gpu/1/g' | paste -sd + |bc)
gpudata=" GPU: $NGPUSUSED/$NGPUS"
else
gpudata=""
fi
usagedata=$(sinfo -h -p $p --format=%C | paste -sd " ")
printf "%11s %s%s\n" $p "$usagedata" "$gpudata"
done
printf "%0.s-" {1..50} ; printf "\n"
echo "Drained nodes: $(sinfo -h -t drain -o '%D')"
printf "%0.s-" {1..50} ; printf "\n"
fi
[[ "$OPT" == "-s" || "$OPT" == "-a" ]] && (df -Th | egrep 'Filesystem|nfs|gpfs|lustre' | awk '{printf("%20s %5s %5s %5s %5s\n", $7,$3,$4,$5,$6)}');
printf "%0.s-" {1..50} ; printf "\n"
printf "Jobs status: \n"
squeue -h -o "%t,%r" | sort | uniq -c | sort -r
}
irisqosusage(){
printf "%20s %8s %9s %9s\n" "QOS" "CPU Max" "CPU Used" "CPU Free"
for qosdetails in $(sacctmgr -n -P list qos format=name,grptres | grep ^qos- | sed '/|$/d;s/cpu=//g' | sort); do
qos=$(echo $qosdetails | cut -d '|' -f 1)
qoscpumax=$(echo $qosdetails | cut -d '|' -f 2)
qoscpuused=$(squeue -h --qos $qos -t R -o %C | paste -sd + | bc)
qoscpuused=${qoscpuused:=0}
qoscpufree=$(echo "$qoscpumax-$qoscpuused" | bc)
printf "%20s %8s %9s %9s\n" "$qos" "$qoscpumax" "$qoscpuused" "$qoscpufree"
done
}