RuntimeError: Initialize:build/CMakeFiles/torch_npu.dir/compiler_depend.ts:153 NPU function error: c10_npu::SetDevice(de
收藏回复举报
RuntimeError: Initialize:build/CMakeFiles/torch_npu.dir/compiler_depend.ts:153 NPU function error: c10_npu::SetDevice(de
t('forum.solved') 已解决
新人帖
发表于2026-01-07 16:09:45
0 查看
python3 -c "import torch;import torch_npu; a = torch.randn(3, 4).npu(); print(a + a);"
结果:
[W compiler_depend.ts:148] Warning: Failed to find function aclsysGetCANNVersion (function operator())

[W compiler_depend.ts:51] Warning: Version:  is invalid. (function operator())

Traceback (most recent call last):

  File "<string>", line 1, in <module>

  File "/root/miniconda3/envs/npu-test1/lib/python3.11/site-packages/torch/utils/backend_registration.py", line 153, in wrap_tensor_to

    device_idx = _normalization_device(custom_backend_name, device)

                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/root/miniconda3/envs/npu-test1/lib/python3.11/site-packages/torch/utils/backend_registration.py", line 109, in _normalization_device

    return _get_current_device_index()

           ^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/root/miniconda3/envs/npu-test1/lib/python3.11/site-packages/torch/utils/backend_registration.py", line 103, in _get_current_device_index

    return getattr(getattr(torch, custom_backend_name), _get_device_index)()

           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/root/miniconda3/envs/npu-test1/lib/python3.11/site-packages/torch_npu/npu/utils.py", line 187, in current_device

    torch_npu.npu._lazy_init()

  File "/root/miniconda3/envs/npu-test1/lib/python3.11/site-packages/torch_npu/npu/__init__.py", line 252, in _lazy_init

    torch_npu._C._npu_init()

RuntimeError: Initialize:build/CMakeFiles/torch_npu.dir/compiler_depend.ts:153 NPU function error: c10_npu::SetDevice(device_id_), error code is 507033

[ERROR] 2026-01-07-16:08:03 (PID:68607, Device:0, RankID:-1) ERR00100 PTA call acl api failed

[Error]: Failed to start the device. 

        Rectify the fault based on the error information in the ascend log.

EE1001: [PID: 68607] 2026-01-07-16:08:03.824.785 The argument is invalid.Reason: rtGetDevMsg execute failed, reason=[context pointer null]

        Solution: 1.Check the input parameter range of the function. 2.Check the function invocation relationship.

        TraceBack (most recent call last):

        TsdOpen failed. devId=0, tdt error=35[FUNC:PrintfTsdError][FILE:runtime.cc][LINE:3184]

        Start aicpu executor failed, retCode=0x7020009 devId=0[FUNC:DeviceRetain][FILE:runtime.cc][LINE:3941]

        Check param failed, dev can not be NULL![FUNC:PrimaryContextRetain][FILE:runtime.cc][LINE:3690]

        Check param failed, ctx can not be NULL![FUNC:PrimaryContextRetain][FILE:runtime.cc][LINE:3717]

        Check param failed, context can not be null.[FUNC:NewDevice][FILE:api_impl.cc][LINE:2457]

        New device failed, retCode=0x7010006[FUNC:SetDevice][FILE:api_impl.cc][LINE:2480]

        rtSetDevice execute failed, reason=[device retain error][FUNC:FuncErrorReason][FILE:error_message_manage.cc][LINE:53]

        open device 0 failed, runtime result = 507033.[FUNC:ReportCallError][FILE:log_inner.cpp][LINE:161]

        ctx is NULL![FUNC:GetDevErrMsg][FILE:api_impl.cc][LINE:5315]

        The argument is invalid.Reason: rtGetDevMsg execute failed, reason=[context pointer null]


当前环境:
cat /usr/local/Ascend/driver/version.info
Version=25.3.rc1

ascendhal_version=7.35.23

aicpu_version=1.0

tdt_version=1.0

log_version=1.0

prof_version=2.0

dvppkernels_version=1.1

tsfw_version=1.0

Innerversion=V100R001C23SPC002B212

compatible_version=[V100R001C19],[V100R001C20],[V100R001C21],[V100R001C22],[V100R001C23]

compatible_version_fw=[6.4.0,6.4.99],[7.0.0,8.9.9]

package_version=25.3.rc1
##########################################################
cat /usr/local/Ascend/ascend-toolkit/latest/version.cfg

# version: 1.0

device-sw-plugin_running_version=[8.3.0.1.200:8.3.RC1]

runtime_running_version=[7.5.0.1.129:8.0.RC3]

compiler_running_version=[7.5.0.1.129:8.0.RC3]

hccl_running_version=[7.5.0.1.129:8.0.RC3]

opp_running_version=[7.5.0.1.129:8.0.RC3]

toolkit_running_version=[7.5.0.1.129:8.0.RC3]

aoe_running_version=[7.5.0.1.129:8.0.RC3]

ncs_running_version=[7.5.0.1.129:8.0.RC3]

opp_kernel_running_version=[7.5.0.1.129:8.0.RC3]

runtime_upgrade_version=[7.5.0.1.129:8.0.RC3]

compiler_upgrade_version=[7.5.0.1.129:8.0.RC3]

hccl_upgrade_version=[7.5.0.1.129:8.0.RC3]

opp_upgrade_version=[7.5.0.1.129:8.0.RC3]

toolkit_upgrade_version=[7.5.0.1.129:8.0.RC3]

aoe_upgrade_version=[7.5.0.1.129:8.0.RC3]

ncs_upgrade_version=[7.5.0.1.129:8.0.RC3]

device-sw-plugin_upgrade_version=[8.3.0.1.200:8.3.RC1]

opp_kernel_upgrade_version=[7.5.0.1.129:8.0.RC3]

runtime_installed_version=[8.3.0.1.200:8.3.RC1][7.5.0.1.129:8.0.RC3]

compiler_installed_version=[8.3.0.1.200:8.3.RC1][7.5.0.1.129:8.0.RC3]

hccl_installed_version=[8.3.0.1.200:8.3.RC1][7.5.0.1.129:8.0.RC3]

opp_installed_version=[8.3.0.1.200:8.3.RC1][7.5.0.1.129:8.0.RC3]

toolkit_installed_version=[8.3.0.1.200:8.3.RC1][7.5.0.1.129:8.0.RC3]

aoe_installed_version=[8.3.0.1.200:8.3.RC1][7.5.0.1.129:8.0.RC3]

ncs_installed_version=[8.3.0.1.200:8.3.RC1][7.5.0.1.129:8.0.RC3]

device-sw-plugin_installed_version=[8.3.0.1.200:8.3.RC1]

opp_kernel_installed_version=[7.5.0.1.129:8.0.RC3]

我要发帖子