Created
November 9, 2022 23:46
-
-
Save huide9/37fd0c24a737b3aea4c1dfa7f1ceb753 to your computer and use it in GitHub Desktop.
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 | |
exist_gpu_process=$(nvidia-smi | grep "No running processes found") | |
if [[ $exist_gpu_process ]]; then | |
echo "Nothing to be cleared! No running processes found..."; | |
else | |
pids=$(nvidia-smi | grep -A 20 'PID' | awk '{print $5}' | tail -n +4) | |
for pid in $pids | |
do | |
kill $pid | |
done | |
fi | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment