Skip to content

Instantly share code, notes, and snippets.

View huide9's full-sized avatar

Huide Yin huide9

View GitHub Profile
#!/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