在arm中,将数据写入device时,报错malloc device data buffer failed, aclRet is 107002
收藏回复举报
在arm中,将数据写入device时,报错malloc device data buffer failed, aclRet is 107002
t('forum.solved') 已解决
发表于2023-09-09 07:05:23
0 查看

报错代码如下:

void* AtlasEngine::CopyDataToDevice(void* data, uint32_t dataSize, aclrtMemcpyKind policy) {

    void* buffer = nullptr;

    aclError aclRet = aclrtMalloc(&buffer, dataSize, ACL_MEM_MALLOC_HUGE_FIRST);

    if (aclRet != ACL_SUCCESS) {

        ERROR_LOG("malloc device data buffer failed, aclRet is %d", aclRet);

        return nullptr;

    }

根据错误码,也检查了context,返回的是create context success,是创建成功的;aclrtSetDevice(deviceId_);也是成功的,

 ret = aclrtCreateContext(&context_, deviceId_);

    if (ret != ACL_SUCCESS) {

        ERROR_LOG("acl create context failed, deviceId = %d, errorCode = %d",

            deviceId_, static_cast<int32_t>(ret));

        return FAILED;

    }

    INFO_LOG("create context success");

我要发帖子