From 8543138c7aad53f61162d30724caccd6e2326788 Mon Sep 17 00:00:00 2001 From: zhyncs Date: Sat, 7 Dec 2024 21:29:54 +0800 Subject: [PATCH 1/5] fix: update killall script --- scripts/killall_sglang.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/killall_sglang.sh b/scripts/killall_sglang.sh index fcad493c59c..90ffcc77579 100755 --- a/scripts/killall_sglang.sh +++ b/scripts/killall_sglang.sh @@ -3,3 +3,4 @@ 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}') +kill -9 $(nvidia-smi | sed -n '/Processes:/,$p' | grep " [0-9]" | awk '{print $5}') From a0279fec2d9dedb6cbcc842f3564ab564ff38738 Mon Sep 17 00:00:00 2001 From: zhyncs Date: Sat, 7 Dec 2024 21:30:50 +0800 Subject: [PATCH 2/5] upd --- python/sglang/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/sglang/utils.py b/python/sglang/utils.py index c1bf62ef983..5689b097d23 100644 --- a/python/sglang/utils.py +++ b/python/sglang/utils.py @@ -1,4 +1,4 @@ -"""Common utilities.""" +"""Common utilities""" import base64 import gc From 77919029ac815fb175b0917555c369ee3c099eb5 Mon Sep 17 00:00:00 2001 From: zhyncs Date: Sat, 7 Dec 2024 21:35:00 +0800 Subject: [PATCH 3/5] upd --- scripts/killall_sglang.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/killall_sglang.sh b/scripts/killall_sglang.sh index 90ffcc77579..eef6a016cf9 100755 --- a/scripts/killall_sglang.sh +++ b/scripts/killall_sglang.sh @@ -1,5 +1,6 @@ # Kill all SGLang processes and free the GPU memory. +nvidia-smi 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}') From fcb786b7d8d6b3153cb9e94d20ff3457a964e3c2 Mon Sep 17 00:00:00 2001 From: zhyncs Date: Sun, 8 Dec 2024 04:09:05 +0800 Subject: [PATCH 4/5] upd --- scripts/killall_sglang.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/killall_sglang.sh b/scripts/killall_sglang.sh index eef6a016cf9..a36660ee758 100755 --- a/scripts/killall_sglang.sh +++ b/scripts/killall_sglang.sh @@ -4,4 +4,6 @@ nvidia-smi 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}') -kill -9 $(nvidia-smi | sed -n '/Processes:/,$p' | grep " [0-9]" | awk '{print $5}') + +# Kill all processes occupying GPU memory, and enable it when needed. +# kill -9 $(nvidia-smi | sed -n '/Processes:/,$p' | grep " [0-9]" | awk '{print $5}') From f7a1cb020cee366c66104b4979bc81501b67117f Mon Sep 17 00:00:00 2001 From: zhyncs Date: Sun, 8 Dec 2024 04:17:59 +0800 Subject: [PATCH 5/5] upd --- scripts/killall_sglang.sh | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/scripts/killall_sglang.sh b/scripts/killall_sglang.sh index a36660ee758..cb187f46a0f 100755 --- a/scripts/killall_sglang.sh +++ b/scripts/killall_sglang.sh @@ -1,9 +1,14 @@ -# Kill all SGLang processes and free the GPU memory. +#!/bin/bash +# Show current GPU status nvidia-smi -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}') -# Kill all processes occupying GPU memory, and enable it when needed. -# kill -9 $(nvidia-smi | sed -n '/Processes:/,$p' | grep " [0-9]" | awk '{print $5}') +# 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