wan22-service/start_multi.sh

21 lines
596 B
Bash
Executable File

#!/bin/bash
cd ~/wan22-service
# 先停止所有现有实例
pkill -f 'python ah.py' 2>/dev/null
sleep 2
# 启动 4 个实例,分别用 GPU 1,2,3,4
for GPU_ID in 1 2 3 4; do
export WAN22_GPU_ID=$GPU_ID
export CUDA_VISIBLE_DEVICES=$GPU_ID
export PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True
export PYTHONPATH=/data/ymq/wan22-service/repo:~/Win2.2
nohup py3/bin/python ah.py > nohup_gpu${GPU_ID}.out 2>&1 &
echo "Started wan22-service instance on GPU $GPU_ID, PID: $!"
sleep 1
done
echo "All instances started. Check status with: ps aux | grep 'python ah.py'"