ACL初始化报错
收藏回复举报
ACL初始化报错
t('forum.solved') 已解决
新人帖
发表于2025-07-23 15:31:27
0 查看

DishDetector::DishDetector(QObject *parent) : QObject(parent),

    m_model(nullptr), m_modelInitialized(false),

    m_modelWidth(1024), m_modelHeight(1024) {

    // 初始化昇腾环境

    //1.acl

    aclError ret = aclInit(nullptr);

    //qDebug() << "ACL Version:" << aclrtGetVersion();

    if (ret != ACL_ERROR_NONE) {

        qCritical() << "ACL init failed:" << aclGetRecentErrMsg();

        return;

    }

    //2.device

    ret = aclrtSetDevice(0);

    if (ret != ACL_ERROR_NONE) {

        qCritical() << "Set device failed:" << aclGetRecentErrMsg();

        return;

    }

    // 创建Context

    ret = aclrtCreateContext(&m_context, 0);

    if (ret != ACL_ERROR_NONE) {

        qCritical() << "Failed to create ACL context:" << aclGetRecentErrMsg();

        aclrtResetDevice(0);

        aclFinalize();

        return;

    }

   

    // 创建Stream

    ret = aclrtCreateStream(&m_stream);

    if (ret != ACL_ERROR_NONE) {

        qCritical() << "Failed to create ACL stream:" << aclGetRecentErrMsg();

        aclrtDestroyContext(m_context);

        aclrtResetDevice(0);

        aclFinalize();

        return;

    }

}报错部分是这里,错误信息如下:ACL init failed: EE1001: 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): 

        [Init][Version]init soc version failed, ret = 507008[FUNC:ReportInnerError][FILE:log_inner.cpp][LINE:145] 

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

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

CANN环境应该是没问题的,别的项目可以运行,求助一下

我要发帖子