-
Notifications
You must be signed in to change notification settings - Fork 96
/
checktopology
executable file
·35 lines (28 loc) · 1 KB
/
checktopology
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/env bash
# Check consistency of /etc/slurm/topology.conf with nodelist in /etc/slurm/slurm.conf
# See "man topology.conf".
# Homepage: https://github.com/OleHolmNielsen/Slurm_tools/
SLURMCONF=/etc/slurm/slurm.conf
TOPOLOGYCONF=/etc/slurm/topology.conf
if test ! -s $SLURMCONF
then
echo Slurm file $SLURMCONF not found
exit 1
fi
if test ! -s $TOPOLOGYCONF
then
echo Slurm file $TOPOLOGYCONF not found
exit 1
fi
export TOPOLOGY_LIST=/tmp/topology.conf_list.$$
export NODELIST=/tmp/slurm.conf_list.$$
echo Extract nodelist from $TOPOLOGYCONF
export TOPOLOGY_ALLNODES=`grep -i Nodes= $TOPOLOGYCONF | grep -v '^\s*#' | awk -F= '{printf("%s,", $3)}'`
scontrol show hostnames $TOPOLOGY_ALLNODES | sort -V > $TOPOLOGY_LIST
# Get current Slurm node list
# (Nodes in multiple partitions will be printed multiple times)
sinfo -h -N -o %N | sort -V | uniq > $NODELIST
echo Differences between nodelists in $SLURMCONF and $TOPOLOGYCONF:
diff -is -c $NODELIST $TOPOLOGY_LIST
# Cleanup
rm -f $TOPOLOGY_LIST $NODELIST