Created
August 25, 2021 21:09
-
-
Save kaczmarj/5ceb0e8f81a7dcb3c3b1326a16f5dbaf to your computer and use it in GitHub Desktop.
Script to find available GPUs in nodes gpu001 through gpu010.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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