已合并
test(fx):Add validation cases for torch._C._distributed_rpc._is_current_rpc_agent_set on NPU #43171
olpk创建于 23 天前
test(fx):Add validation cases for torch._C._distributed_rpc._is_current_rpc_agent_set on NPU #43171
已合并
Pull Request已成功合入, 合并人@ascend-robot
(感谢 olpk 的贡献)atomgit-bot
23 天前 评论:
23 天前 评论:
变更摘要
此PR为NPU平台新增了 torch._C._distributed_rpc._is_current_rpc_agent_set 接口的测试用例文件,旨在弥补PyTorch社区对该API验证覆盖不足的问题。新增的测试类 TestIsCurrentRpcAgentSet 覆盖了导入可用性、默认状态以及完整的RPC初始化/关闭生命周期中的返回值校验。
主要改动
- 新增测试文件
test/distributed/rpc/test_rpc_agent_set.py: 为torch._C._distributed_rpc._is_current_rpc_agent_set新增独立的测试用例文件,包含3个测试方法,覆盖NPU场景下的API验证。 test_is_current_rpc_agent_set_import测试用例: 验证_is_current_rpc_agent_set可从torch._C._distributed_rpc正常导入且为可调用对象。test_is_current_rpc_agent_set_default测试用例: 验证在RPC未初始化的默认状态下,_is_current_rpc_agent_set()返回False。test_is_current_rpc_agent_set_after_init测试用例: 验证完整生命周期——init_rpc后返回True,shutdown后恢复为False。


ascend-robot
23 天前 评论:
23 天前 评论:
atomgit-bot
23 天前 评论:
23 天前 评论:
23 天前 添加了label:ascend-cla/no
此处折叠了78条消息 查看更多
chenrayray
7 天前 评论:
7 天前 评论:
/lgtm


7 天前 添加了label:lgtm
7 天前 删除了label:ci-pipeline-passed
7 天前 合入了pull request
ascend-robot
7 天前 评论:
7 天前 评论:
流水线 pytorch_gitcode_PR_multiVersion#14011 [ commitID:60b087d5 ] 已完成


关联issue:https://gitcode.com/Ascend/pytorch/issues/2748
关联issue: https://gitcode.com/Ascend/pytorch/issues/2828
API 功能
torch._C._distributed_rpc._is_current_rpc_agent_set:检查当前 RPC agent 是否已初始化,返回 bool。用例完备性说明
PyTorch 社区在
test/目录下无针对此 API 的直接测试用例(grep 结果为 0),仅在torch/testing/_internal/distributed/rpc/rpc_test.py中有一处非直接的辅助引用。因此新增测试文件。新增用例
本次自写用例
test/distributed/rpc/test_rpc_agent_set.py,包含 3 个测试方法:适配方案
该 API 为框架层 RPC 状态查询接口,与底层设备无关,直接可用,无需 NPU 适配。
运行结果
NPU Ascend910B4 环境测试通过:
