Skip to content

Commit

Permalink
minor: update killall script (#2391)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhyncs authored Dec 7, 2024
1 parent 95f93f4 commit 75ae968
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion python/sglang/utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Common utilities."""
"""Common utilities"""

import base64
import gc
Expand Down
17 changes: 13 additions & 4 deletions scripts/killall_sglang.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Kill all SGLang processes and free the GPU memory.
#!/bin/bash

kill -9 $(ps aux | grep 'multiprocessing.spawn' | grep -v 'grep' | awk '{print $2}')
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}')
# Show current GPU status
nvidia-smi

# Clean SGLang processes
kill -9 $(ps aux | grep 'multiprocessing.spawn' | grep -v 'grep' | awk '{print $2}') 2>/dev/null
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

0 comments on commit 75ae968

Please sign in to comment.