File size: 908 Bytes
df64241
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/bin/bash
# One-line health report of THIS node (run inside a short Slurm job on that node).
gpus=$(nvidia-smi --query-gpu=memory.used --format=csv,noheader,nounits 2>/dev/null | wc -l)
gused=$(nvidia-smi --query-gpu=memory.used --format=csv,noheader,nounits 2>/dev/null | awk '{s+=$1} END {print s+0}')
ram=$(free -g | awk '/Mem:/ {print $7}')
swap=$(free -g | awk '/Swap:/ {print $3}')
load=$(cut -d' ' -f1 /proc/loadavg)
# real people (uid >= 1000) other than us with processes on this node
others=$(ps -eo uid=,user= | awk '$1 >= 1000 && $1 != 65534 {print $2}' | sort -u | grep -vx ajay-stu | wc -l)
# read 512 MB from /fsx at a random spot
mbs=$(dd if=/fsx/ajay-stu/ar-data/bin/finemath.bin of=/dev/null bs=1M count=512 skip=$((RANDOM % 30000)) 2>&1 \
      | awk '/copied/ {v=$(NF-1); if ($NF=="GB/s") v*=1000; print int(v)}')
echo "$(hostname) $gpus $gused $ram ${swap:-0} $load $others ${mbs:-0}"