Skip to content

Commit d5d23d0

Browse files
committed
Added environment precheck
1 parent fa9e482 commit d5d23d0

File tree

3 files changed

+124
-1
lines changed

3 files changed

+124
-1
lines changed

test/common/envPreCheck/__init__.py

Whitespace-only changes.

test/common/uc_eval/utils/metric.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def match(
7272
self,
7373
expected_output: Union[str, List[str], tuple[str]],
7474
real_output: str,
75-
**kwargs
75+
**kwargs,
7676
):
7777
pass
7878

test/doc/EnvPreCheck.md

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
# 环境预检(Environment PreCheck)自动化测试套件
2+
3+
基于 pytest 的环境预检自动化测试,用于在大规模训练或推理任务执行前,对集群环境的关键能力进行全面验证。该预检流程覆盖 SSH 连通性、设备健康状态、节点间通信、TLS 配置、模型权重完整性以及存储带宽等关键组件,确保集群处于可用且一致的运行状态。
4+
5+
# 测试框架具备以下特性:
6+
7+
1、针对 NPU(Ascend)/ GPU 自动识别执行相应测试
8+
9+
2、所有测试项均动态输出,便于快速识别检测
10+
11+
3、全面覆盖环境依赖的核心组件
12+
13+
14+
# 功能概述
15+
16+
本测试套件在模型部署或训练前自动执行以下预检内容:
17+
18+
✔ SSH 登录能力检查:确保 Master/Worker 的免密登录配置正确。
19+
20+
✔ 设备状态检查(NPU / GPU):检测各节点的设备是否在线、驱动是否正常。
21+
22+
✔ 节点间 Ping 连通性检查:验证 HCCN(NPU)或 NVIDIA(GPU)网络链路是否可达、是否存在丢包或故障链路。
23+
24+
✔ TLS 配置检查:检查 Ascend 集群中设备间 TLS 加密链路开关状态。
25+
26+
✔ 模型权重完整性检查:包括权重文件列表扫描、哈希值校验和权重有效性验证
27+
28+
✔ 存储点带宽检查:检查 embedding / fetch 操作带宽,并与配置文件中的限制进行比较。
29+
30+
31+
# 🚀 ###########如何运行测试(test/下执行)#############
32+
# 目录结构说明
33+
├── tests/
34+
├── common/
35+
│ └── envPreCheck/
36+
│ ├── run_env_preCheck.py # 所有检查逻辑
37+
│ └── ...
38+
├── suites
39+
│ └── E2E/
40+
│ ├── test_environment_precheck.py # 执行逻辑
41+
│ └── ...
42+
├── config.yaml # 预检的阈值配置
43+
44+
# 运行完整的阶段预检
45+
pytest --stage=2
46+
47+
# 按平台运行预检(公共检测项默认NPU平台)
48+
# NPU环境
49+
pytest --platform=npu
50+
# GPU环境
51+
pytest --platform=gpu
52+
53+
# 按特性类别运行
54+
pytest --feature=test_ssh_login
55+
56+
# 按文件运行
57+
pytest suites/E2E/test_environment_precheck.py
58+
59+
60+
# 🛠️ #########以下为各测试的示例说明##########
61+
# ● SSH 登录检查:
62+
test_ssh_login()
63+
校验 master/worker SSH 免密登录
64+
65+
任何失败将立即中止后续测试
66+
67+
# ● 设备状态检查(NPU/GPU)
68+
test_hccn_check_device_status()
69+
test_nvidia_check_device_status()
70+
71+
检查设备是否在线、是否可用
72+
73+
# ● HCCN / NVIDIA Ping 连通性检查
74+
test_check_hccn_ping()
75+
test_check_nvidia_ping()
76+
77+
生成所有链路状态信息,例如:
78+
79+
local_card_0 → local_card_1
80+
81+
local_card_0 → remote_IP
82+
83+
remote_card_1 → local_IP
84+
85+
# ● TLS 开关检查
86+
test_check_tls()
87+
88+
校验每张卡的tls switch是否为0
89+
90+
# ● 模型权重完整性检查
91+
test_check_model_weights()
92+
93+
权重文件列表扫描、哈希值校验和权重有效性验证
94+
95+
# ● 存储带宽检测
96+
test_check_bandwidth()
97+
98+
检查存储实际待遇是否达到预期带宽:实际 bandwidth < 阈值 * 0.85,否则判定为异常
99+
100+
101+
# ⚙️##########配置项说明(config.yaml)##########
102+
master_ip:集群主节点(Master)的 SSH 登录 IP,用于执行预检中的主节点检查。
103+
104+
worker_ip:集群工作节点(Worker)的 IP 地址,用于检测 Worker 的设备状态、网络连通性等。
105+
106+
ascend_rt_visible_devices:设置 Ascend/NPU 的可见设备序号,用于设备状态和带宽测试。
107+
108+
node_num:集群节点数量,用于预检逻辑判断是否需要跨节点检查。
109+
110+
model_path:模型权重所在目录,用于权重文件检查和哈希校验。
111+
112+
hf_model_name:Hugging Face 模型名称,用于识别模型类型与路径结构。
113+
114+
middle_page:模型对应的中间页面/组织名称,用于存储结构或路径判断
115+
116+
expected_embed_bandwidth:预期 embedding 带宽(GB/s),用于对比实际带宽是否满足阈值。
117+
118+
expected_fetch_bandwidth:预期 fetch 带宽(GB/s),与实际带宽比较判断读写性能是否正常。
119+
120+
kvCache_block_number:KV Cache 预分配 block 数量,用于环境容量检查或推理配置校验。
121+
122+
storage_backends:存储后端挂载路径,用于带宽测试和路径可用性检查。
123+
将这些内容复制打出来

0 commit comments

Comments
 (0)