报错代码如下:
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");
报错代码如下:
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");