forked from PFCCLab/PaddleAPITest
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun-example.sh
More file actions
executable file
·75 lines (63 loc) · 1.87 KB
/
run-example.sh
File metadata and controls
executable file
·75 lines (63 loc) · 1.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/bin/bash
# Script to run engineV2.py
# Usage: ./run.sh
# 配置参数
# NUM_GPUS!=0 时,engineV2 不受外部 "CUDA_VISIBLE_DEVICES" 影响
FILE_INPUT="tester/api_config/5_accuracy/accuracy_1.txt"
# FILE_PATTERN="tester/api_config/5_accuracy/accuracy_*.txt"
LOG_DIR="tester/api_config/test_log"
NUM_GPUS=-1
NUM_WORKERS_PER_GPU=-1
GPU_IDS="4,5,6,7"
# REQUIRED_MEMORY=10
TEST_MODE_ARGS=(
--accuracy=True
# --paddle_only=True
# --paddle_cinn=True
# --paddle_gpu_performance=True
# --torch_gpu_performance=True
# --paddle_torch_gpu_performance=True
# --accuracy_stable=True
# --test_amp=True
# --test_cpu=True
# --use_cached_numpy=True
# --atol=1e-2
# --rtol=1e-2
# --test_tol=True
)
IN_OUT_ARGS=(
--api_config_file="$FILE_INPUT"
# --api_config_file_pattern="$FILE_PATTERN"
--log_dir="$LOG_DIR"
)
PARALLEL_ARGS=(
--num_gpus="$NUM_GPUS"
--num_workers_per_gpu="$NUM_WORKERS_PER_GPU"
--gpu_ids="$GPU_IDS"
# --required_memory="$REQUIRED_MEMORY"
)
mkdir -p "$LOG_DIR" || {
echo "错误:无法创建日志目录 '$LOG_DIR'"
exit 1
}
# 执行程序
LOG_FILE="$LOG_DIR/log_$(date +%Y%m%d_%H%M%S).log"
nohup python engineV2.py \
"${TEST_MODE_ARGS[@]}" \
"${IN_OUT_ARGS[@]}" \
"${PARALLEL_ARGS[@]}" \
>> "$LOG_FILE" 2>&1 &
PYTHON_PID=$!
sleep 1
if ! ps -p "$PYTHON_PID" > /dev/null; then
echo "错误:engineV2 启动失败,请检查 $LOG_FILE"
exit 1
fi
echo -e "\n\033[32m执行中... 另开终端运行监控:\033[0m"
echo -e "1. GPU使用: watch -n 1 nvidia-smi"
echo -e "2. 日志目录: ls -lh $LOG_DIR"
echo -e "3. 详细日志: tail -f $LOG_FILE"
echo -e "4. 终止任务: kill $PYTHON_PID"
echo -e "\n进程已在后台运行,关闭终端不会影响进程执行"
exit 0
# watch -n 1 nvidia-smi --query-compute-apps=pid,process_name,used_memory,gpu_uuid --format=csv