Skip to content

Commit

Permalink
make cuda process killer conditional
Browse files Browse the repository at this point in the history
Signed-off-by: Ata Fatahi <[email protected]>
  • Loading branch information
MrAta committed Dec 12, 2024
1 parent 2ade51e commit 9c57905
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions scripts/killall_sglang.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@ kill -9 $(ps aux | grep 'sglang.launch_server' | grep -v 'grep' | awk '{print $2
kill -9 $(ps aux | grep 'sglang.bench' | grep -v 'grep' | awk '{print $2}') 2>/dev/null

# Clean all GPU processes
kill -9 $(nvidia-smi | sed -n '/Processes:/,$p' | grep " [0-9]" | awk '{print $5}') 2>/dev/null
lsof /dev/nvidia* | awk '{print $2}' | xargs kill -9 2>/dev/null
if [ $# -gt 0 ]; then
kill -9 $(nvidia-smi | sed -n '/Processes:/,$p' | grep " [0-9]" | awk '{print $5}') 2>/dev/null
lsof /dev/nvidia* | awk '{print $2}' | xargs kill -9 2>/dev/null
fi


# Show GPU status after clean up
nvidia-smi

0 comments on commit 9c57905

Please sign in to comment.