Skip to content

Commit

Permalink
Clean up GPU memory after killing sglang processes
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 7791fd9 commit a2a73de
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions scripts/killall_sglang.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ kill -9 $(ps aux | grep 'sglang::' | grep -v 'grep' | awk '{print $2}') 2>/dev/n
kill -9 $(ps aux | grep 'sglang.launch_server' | grep -v 'grep' | awk '{print $2}') 2>/dev/null
kill -9 $(ps aux | grep 'sglang.bench' | grep -v 'grep' | awk '{print $2}') 2>/dev/null

# Clean all GPU processes if any argument is provided
if [ $# -gt 0 ]; then
kill -9 $(nvidia-smi | sed -n '/Processes:/,$p' | grep " [0-9]" | awk '{print $5}') 2>/dev/null
fi
# 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

0 comments on commit a2a73de

Please sign in to comment.