Diffusers
Safetensors
File size: 381 Bytes
f0fc238
394918c
f0fc238
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
# 定义你要清理的卡号
target_gpus="6,7"

# 通过 nvidia-smi 查询,-i 指定卡号,--query 过滤进程 PID
pids=$(nvidia-smi --query-compute-apps=pid --format=csv,noheader -i $target_gpus | sort -u)

if [ -n "$pids" ]; then
    echo "正在终止占用 GPU $target_gpus 的进程: $pids"
    kill -9 $pids
else
    echo "未发现占用 GPU $target_gpus 的进程"
fi