From 7f9e9270a88d47b16880f1d67e7f8980a1f49fd7 Mon Sep 17 00:00:00 2001 From: Ata Fatahi Date: Wed, 11 Dec 2024 15:51:21 -0800 Subject: [PATCH] Clean up GPU memory after killing sglang processes Signed-off-by: Ata Fatahi --- scripts/killall_sglang.sh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/scripts/killall_sglang.sh b/scripts/killall_sglang.sh index 3696a1c35f4..d9899c95b6a 100755 --- a/scripts/killall_sglang.sh +++ b/scripts/killall_sglang.sh @@ -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