Skip to content

Instantly share code, notes, and snippets.

@Stfort52
Created July 6, 2022 03:35
Show Gist options
  • Save Stfort52/4addce2c5402383f18c23596af9df196 to your computer and use it in GitHub Desktop.
Save Stfort52/4addce2c5402383f18c23596af9df196 to your computer and use it in GitHub Desktop.
More on slurm
#!/bin/bash
# Print the biggest computing chunk
smax ()
{
max_node="N/A";
max_cores=0;
for node in `sinfo --Node $*| awk 'BEGIN {FS=" "} {if(NR > 1) print $1}' | uniq`;
do
idle=`sinfo -o%C --nodes $node | awk 'BEGIN {FS="/"} {if(NR == 2) print $2}'`;
if [ $idle -gt $max_cores ]; then
max_cores=$idle;
max_node=$node;
fi;
done;
echo "$max_cores@$max_node"
}
# Print the core statuses of nodes
snodes ()
{
for node in `sinfo --Node $*| awk 'BEGIN {FS=" "} {if(NR > 1) print $1}' | uniq`;
do
echo -en "$node : ";
sinfo -o%C --nodes $node;
done
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment