aclrtSetDevice运行报tsd client wait response fail, hostpid:26035, receive device response data failed, check hdc service.
收藏回复举报
aclrtSetDevice运行报tsd client wait response fail, hostpid:26035, receive device response data failed, check hdc service.
t('forum.solved') 已解决
发表于2026-05-06 15:34:02
0 查看

环境 ascend 910b3

我写了一个简单的使用aclrtSetDevice的demo,cann 9.0.0,npu-smi 驱动为 25.4.1

#include <acl/acl.h>
#include <iostream>
#include <cstdint>
#include <cstring>


int main() {
    // Initialize ACL
    aclError err = aclInit(nullptr);
    if (err != ACL_SUCCESS) {
        std::cerr << "aclInit failed, errcode: " << err << std::endl;
        return -1;
    }
    std::cout << "ACL initialized successfully" << std::endl;

    // Set device (use device 0)
    int deviceId = 0;
    err = aclrtSetDevice(deviceId);
    if (err != ACL_SUCCESS) {
        std::cerr << "aclrtSetDevice failed, errcode: " << err << std::endl;
        aclFinalize();
        return -1;
    }
    std::cout << "Device " << deviceId << " set successfully" << std::endl;

    // Clean up ACL
    aclrtResetDevice(deviceId);
    aclFinalize();
    std::cout << "Test completed successfully!" << std::endl;

    return 0;
}

编译运行后 报下面错误

./test_main 
ACL initialized successfully
aclrtSetDevice failed, errcode: 507033

cat /root/ascend/log/debug/plog/plog-490_20260506073145547.log

root@mooncake-client-227-0:~# cat /root/ascend/log/debug/plog/plog-490_20260506073145547.log 
[ERROR] TDT(490,test_main):2026-05-06-07:31:45.542.411 [hdc_client.cpp:161][TsdRecvData][tid:490] [deviceId=1][sessionId=1] recv msg failed
[ERROR] TDT(490,test_main):2026-05-06-07:31:45.542.440 [process_mode_manager.cpp:339][WaitRsp][tid:490] tsd client wait response fail, hostpid:26035, receive device response data failed, check hdc service.
[ERROR] TDT(490,test_main):2026-05-06-07:31:45.542.494 [process_mode_manager.cpp:133][OpenProcess][tid:490] Wait open response from device failed.
[ERROR] TDT(490,test_main):2026-05-06-07:31:45.542.497 [tsd_client.cpp:45][TsdOpenEx][tid:490] TsdOpenEx failed, deviceId[1].
[ERROR] RUNTIME(490,test_main):2026-05-06-07:31:45.546.260 [runtime.cc:2618]490 PrintfTsdError:TsdOpen failed. devId=1, tdt error=31
[ERROR] RUNTIME(490,test_main):2026-05-06-07:31:45.546.272 [runtime.cc:3481]490 DeviceRetain:Start aicpu executor failed, retCode=0x7020009, devId=1
[ERROR] RUNTIME(490,test_main):2026-05-06-07:31:45.546.954 [runtime.cc:3536]490 DeviceRetain:Check param failed, dev can not be NULL!
[ERROR] RUNTIME(490,test_main):2026-05-06-07:31:45.546.965 [runtime.cc:3153]490 PrimaryContextRetain:Check param failed, dev can not be NULL!
[ERROR] RUNTIME(490,test_main):2026-05-06-07:31:45.546.974 [runtime.cc:3184]490 PrimaryContextRetain:Check param failed, ctx can not be NULL!
[ERROR] RUNTIME(490,test_main):2026-05-06-07:31:45.546.981 [api_impl.cc:3319]490 SetDevice:Check param failed, context can not be null.
[ERROR] RUNTIME(490,test_main):2026-05-06-07:31:45.546.990 [api_error.cc:2548]490 SetDevice:Set device failed, device_id=1, the current input soc version is null.
[ERROR] RUNTIME(490,test_main):2026-05-06-07:31:45.547.001 [api_c_device.cc:91]490 rtSetDevice:ErrCode=507033, desc=[device retain error], InnerCode=0x7010006[ERROR] RUNTIME(490,test_main):2026-05-06-07:31:45.547.005 [error_message_manage.cc:65]490 FuncErrorReason:rtSetDevice execution failed, reason=device retain error
[ERROR] ASCENDCL(490,test_main):2026-05-06-07:31:45.547.483 [device.cpp:53]490 aclrtSetDeviceImpl:open device 1 failed, runtime result = 507033.

然后我运行了npu-smi info 发现卡都正常也没有进程使用

a.png

b.png

本帖最后由 匿名用户2026/05/06 17:06:39 编辑

我要发帖子