模型推理报错[ERROR] Malloc memory failed, type: 3, errorno:107002
收藏回复举报
模型推理报错[ERROR] Malloc memory failed, type: 3, errorno:107002
t('forum.solved') 已解决
发表于2024-12-11 14:28:25
0 查看

驱动版本:23.0.3

CANN版本:8.0.RC3.alpha001

报错信息:

[ERROR] Malloc memory failed, type: 3, errorno:107002 

2024-12-11 10:13:24] [error] Ascend.cpp[76]ProcessInput: CopyImageToDevice failed, errorCode is 313

代码:

SampleYOLOV8 sampleYOLO(modelPath,modelWidth,modelHeight);
Result ret = sampleYOLO.InitResource();
if (ret == FAILED)
{
    ACLLITE LOG ERROR("InitResource failed,errorCode is %d", ret),
    return FAILED;
}
for (size_t i-0;i<allPath.size();i++)
    if (allPath.size()==i)
    {
        release=true;
    }
    std::vector<InferenceOutput> inferOutputs;
    fileName = allPath.at(i).c_str(θ);
    std::chrono::time_point<std::chrono::steady_clock>start =std::chrono::steady_clock::now();
    ret = sampleYOLO.ProcessInput(fileName);
    if (ret==FAILED)
    {
        ACLLITE_LOG_ERROR("ProcessInput image failed, errorCode is %d",ret);
        return FAILED;
    ret= sampleYOLO.Inference(inferOutputs);
    if (ret==FAILED)
    {
        ACLLITE_LOG_ERROR("Inference failed, errorCode is $d", ret);
        return FAILED;
    ret= sampleYOLO.GetResult(inferOutputs, fileName, i, release);
    if (ret == FAILED)
    {
        ACLLITE_LOG_ERROR("GetResult failed, errorCode is %d", ret);
        return FAILED;
    }
    std::chrono::time_point<std::chrono::steady_clock>end=std::chrono::steady_clock::now();
    std::chrono::duration<double> elapsed = end-start;
    ACLLITE_LOG_INFO("Inference elapsed time: %fs, fps is %f", elapsed.count(), 1 / elapsed.count());
}
return SUCCESS;

问题描述:在昇腾上使用C++进行推理开发,sample仓推理样例可以正常运行。当把CopyImageToDevice相关代码放在循环外可以正常推理,放在循环内就会报错。

我要发帖子