Skip to content

Instantly share code, notes, and snippets.

@kaczmarj
Created August 25, 2021 21:09
Show Gist options
  • Save kaczmarj/5ceb0e8f81a7dcb3c3b1326a16f5dbaf to your computer and use it in GitHub Desktop.
Save kaczmarj/5ceb0e8f81a7dcb3c3b1326a16f5dbaf to your computer and use it in GitHub Desktop.
Script to find available GPUs in nodes gpu001 through gpu010.
#!/usr/bin/env bash
set -u
echo "Searching for nodes with available GPUs..."
for suffix in {001..010}; do
remote="gpu${suffix}"
ssh "$remote" nvidia-smi | grep -q "No running processes found"
if [ $? -eq 0 ]; then
echo $remote
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment