Skip to content

Commit 803abcc

Browse files
authored
force kill vllm instance to free gpu resources
1 parent 012be47 commit 803abcc

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/fmbench/scripts/inference_containers/vllm_gpu.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,16 @@ def create_script(region, image_uri, model_id, model_name, env_str, privileged_s
1515
script = f"""#!/bin/sh
1616
1717
{STOP_AND_RM_CONTAINER}
18-
19-
18+
# kill any existing vllm instance to free up gpu resources
19+
process_name="vllm"
20+
pid=$(pgrep -f "$process_name")
21+
if [ -n "$pid" ]; then
22+
echo "Killing process $process_name with PID $pid"
23+
kill -9 "$pid"
24+
else
25+
echo "No process named $process_name is running"
26+
fi
27+
sleep 10
2028
vllm serve {model_id}
2129
2230
echo "started docker run in daemon mode"

0 commit comments

Comments
 (0)