docs: 修复文档 markdownlint 扫描问题

Co-authored-by: Xinrui Chen<chenxinrui11@huawei.com>



# message auto-generated for no-merge-commit merge:
!45683 merge codex/fix-markdownlint-docs into master

docs: 修复文档 markdownlint 扫描问题

Created-by: chenrayray
Commit-by: Xinrui Chen
Merged-by: ascend-robot
Description: <!--
PR描述模板更新日期:20260203
-->

# 【合入来源】
> <font color="red">**如有社区issue,请关联issue链接**</font>\
> <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font>

- [ ] 需求
- [ ] 问题单
- [x] issue/工单:#4529
- [ ] 重构优化
- [x] 资料更新

# 【修改方案】

1. 调整文档标题层级及标题前后的空行。
2. 为围栏代码块补充语言标识,并补齐代码块前后的空行。
3. 修复列表间距、标题末尾标点、多余空行及文件末尾换行问题。
4. 本次仅修改 Markdown 排版,不改变文档语义。

# 【资料变更】

涉及资料变更,修改以下文档:

- `test/README.md`
- `tools/flight_recorder/flight_recorder.md`
- `examples/libtorch_hccl/README_HCCL.md`
- `torch_npu/csrc/libs/README.md`
- `tools/linter/adapters/README.md`

# 【接口变更】

不涉及。

# 【功能验证】

1. 执行 `git diff --check`,检查通过。
2. 文档门禁中的 markdownlint、链接有效性、资源存在性及标签闭合检查均已通过。
3. 本次为纯文档格式修复,不涉及 UT 用例变更。

# 【CheckList】

- [x] 代码注释完备,正确记录错误日志(不涉及代码变更)
- [x] 代码实现进行了返回值、空指针等校验(不涉及代码变更)
- [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等
- [x] PR持续集成流水线(CI)执行通过,代码检查无异常

See merge request: Ascend/pytorch!45683
This commit is contained in:
chenrayray
2026-09-04 09:31:35 +08:00
committed by ascend-robot
parent 2f859125cb
commit 239325b2a5
5 changed files with 29 additions and 13 deletions
+5 -2
View File
@@ -15,10 +15,12 @@
CMakeLists.txt会自动从Python环境检测libtorch的安装路径。
**自动检测**(推荐):
- 确保Python环境中已安装torch
- CMake会自动从Python获取路径
**手动指定**(可选):
```bash
# 如果自动检测失败,可以手动设置环境变量
export TORCH_INSTALL_DIR=/path/to/torch # 通常在 site-packages/torch
@@ -36,7 +38,7 @@ make
## 运行
### 方法:
### 方法
```bash
cd examples/libtorch_hccl
@@ -45,13 +47,14 @@ chmod +x libtorch_hccl.sh
```
自定义进程数:
```bash
NUM_PROCESSES=4 ./libtorch_hccl.sh
```
## 预期输出
```
```text
启动HCCL allreduce示例: rank=0, size=2
NPU设备 0 初始化完成
在NPU设备 0 上创建了 10 个张量
+19 -7
View File
@@ -1,29 +1,38 @@
## 简介
# 简介
test目录为PTA相关的测试用例。
## 安装依赖
`pip3 install -r requirements.txt`
## 补全脚本
该操作需要联网
```
```shell
cd test
bash get_synchronized_files.sh
```
通过以上操作,会自动补齐testfiles_synchronized.txt和testfolder_synchronized.txt中的文件或文件夹。
## 跳过失败用例
`export DISABLED_TESTS_FILE=./unsupported_test_cases/.pytorch-disabled-tests.json`
如果不是在test目录下运行测试用例,需要传入.pytorch-disabled-tests.json的绝对路径。
## 执行方式
### 执行单个测试脚本
运行以test开头的文件。以test_autocast.py为例:
方式一:
`python test_autocast.py`
方式二:
`python run_test.py -i test_autocast`
@@ -31,6 +40,7 @@ bash get_synchronized_files.sh
说明:部分以test开头的脚本不是直接运行的脚本,比如jit中的测试脚本是通过test_jit.py执行的。
### 执行具体的用例
通过-k参数传入具体的用例名。以test_autocast.py为例:
方式一:
@@ -42,25 +52,27 @@ bash get_synchronized_files.sh
`python run_test.py -v -i test_autocast -- -k test_autocast_nn_fp32`
### 执行全量UT的方式
```
```shell
# 进入到test目录的上一级
cd ../
```
运行非分布式全量用例:
```
```shell
python ci/access_control_test.py --all
```
运行分布式全量用例:
```
```shell
python ci/access_control_test.py --distributed
```
## FAQ
1. 报错:"dictionary changed size during interation".
1. 报错:"dictionary changed size during iteration".
如果python 环境是3.8.1版本,报错在unitest/case.py中,可考虑是sys.modules被修改导致的。第三方包可能会有对sys.modules的修改,比如beartype。
此问题为python 3.8.1版本/3.9.0版本的已知bug,可按照 https://github.com/python/cpython/issues/73806 中修改方式修改,将
+3 -3
View File
@@ -9,7 +9,7 @@
按照如下方法设置环境变量开启飞行记录器
```
```shell
export TORCH_HCCL_ENABLE_MONITORING=1 #用于检测是否开启卡住问题检测
export TORCH_HCCL_DUMP_ON_TIMEOUT=1 # 用于控制是否保存诊断信息
export TORCH_HCCL_TRACE_BUFFER_SIZE=1 # 用于控制保存的集合通信状态数量
@@ -19,7 +19,7 @@ export TORCH_HCCL_DEBUG_INFO_TEMP_FILE=/tmp/ #保存诊断信息的文件路径
## 2 工具使用方法
```
```shell
python fr_trace.py <trace_dir> [options]
```
@@ -40,4 +40,4 @@ python fr_trace.py <trace_dir> [options]
```bash
python script.py trace_dir --selected-ranks 0 1 2 --allow-incomplete-ranks --pg-filters pg1 pg2 -o output.pkl -p prefix_ -j -v
```
```
+1
View File
@@ -3,6 +3,7 @@
These files adapt our various linters to work with `lintrunner`.
## Adding a new linter
1. init and linter
2. {{DRYRUN}} and {{PATHSFILE}}
3. never exit uncleanly
+1 -1
View File
@@ -1,3 +1,3 @@
## caution:
# Caution
This folder is used to export interfaces related to NPU, such as operators, device init and so on. And it will only be built in libtorch_npu without Python, which is used in inference with NPU.