From 135c5763ff7c16402675d33fbbf743bb659974de Mon Sep 17 00:00:00 2001 From: cmhu <2657262686@qq.com> Date: Fri, 23 Aug 2024 16:38:16 +0800 Subject: [PATCH] 删除aclrtSetDevice --- src/ai_platform/vpt_proj.cpp1 | 1 - src/decoder/test_face.cpp1 | 2 -- src/test/test.cpp | 2 -- src/util/JpegUtil.cpp | 9 --------- 4 files changed, 0 insertions(+), 14 deletions(-) diff --git a/src/ai_platform/vpt_proj.cpp1 b/src/ai_platform/vpt_proj.cpp1 index 7cbd277..8ada72f 100755 --- a/src/ai_platform/vpt_proj.cpp1 +++ b/src/ai_platform/vpt_proj.cpp1 @@ -86,7 +86,6 @@ int main(){ param.isTrk = false; ACL_CALL(aclInit(nullptr), ACL_ERROR_NONE, 1); - ACL_CALL(aclrtSetDevice(param.devId), ACL_ERROR_NONE, 1); aclrtContext ctx; ACL_CALL(aclrtCreateContext(&ctx, param.devId), ACL_ERROR_NONE, 1); diff --git a/src/decoder/test_face.cpp1 b/src/decoder/test_face.cpp1 index 1ef3eb2..7d6efd1 100644 --- a/src/decoder/test_face.cpp1 +++ b/src/decoder/test_face.cpp1 @@ -75,7 +75,6 @@ int main(){ string models_dir = "."; aclInit(nullptr); - aclrtSetDevice(m_devId); // 人脸检测初始化 facedet_ai_engine_param fd_param; @@ -179,7 +178,6 @@ int main(){ void algorthim_process_thread(){ - aclrtSetDevice(m_devId); aclrtCreateContext(&ctx, m_devId); while (true){ diff --git a/src/test/test.cpp b/src/test/test.cpp index e7e73dc..364d5cc 100755 --- a/src/test/test.cpp +++ b/src/test/test.cpp @@ -60,7 +60,6 @@ int main() { void* handle = nullptr; cout << "init start " << endl; ACL_CALL(aclInit(nullptr), ACL_SUCCESS, SY_FAILED); - ACL_CALL(aclrtSetDevice(param.devId), ACL_SUCCESS, SY_FAILED); aclrtContext ctx; ACL_CALL(aclrtCreateContext(&ctx, param.devId), ACL_SUCCESS, SY_FAILED); aclrtStream stream = nullptr; @@ -279,7 +278,6 @@ int main() { vpt_release(&handle); aclrtDestroyStream(stream); aclrtDestroyContext(ctx); - aclrtResetDevice(param.devId); aclFinalize(); diff --git a/src/util/JpegUtil.cpp b/src/util/JpegUtil.cpp index 2fcc63a..2f1e253 100755 --- a/src/util/JpegUtil.cpp +++ b/src/util/JpegUtil.cpp @@ -12,7 +12,6 @@ int JpegUtil::jpeg_init(int32_t devId){ aclError ret; /* 2.Run the management resource application, including Device, Context, Stream */ - aclrtSetDevice(deviceId_); aclrtCreateContext(&context_, deviceId_); // channel 准备 @@ -27,7 +26,6 @@ int JpegUtil::jpeg_init(int32_t devId){ void JpegUtil::jpeg_release(){ aclError ret; - ret = aclrtSetDevice(deviceId_); aclrtSetCurrentContext(context_); ret = acldvppDestroyChannel(dvppChannelDesc_); @@ -43,11 +41,6 @@ void JpegUtil::jpeg_release(){ } context_ = nullptr; } - - ret = aclrtResetDevice(deviceId_); - if (ret != ACL_SUCCESS) { - LOG_ERROR("reset device failed"); - } } int32_t JpegUtil::jpege_save(char* pcData , uint32_t dataLen, string out_file_name) @@ -69,7 +62,6 @@ int32_t JpegUtil::jpege_save(char* pcData , uint32_t dataLen, string out_file_na bool JpegUtil::jpeg_encode(acldvppPicDesc *encodeInputDesc_, string out_file_name) { aclError aclRet ; - aclRet = aclrtSetDevice(deviceId_); aclrtSetCurrentContext(context_); // 8. 申请输出内存,申请Device内存encodeOutBufferDev_,存放编码后的输出数据 @@ -141,6 +133,5 @@ bool JpegUtil::jpeg_encode(acldvppPicDesc *encodeInputDesc_, string out_file_nam // 释放掉输入输出的device内存 (void)acldvppFree(encodeOutBufferDev_); encodeOutBufferDev_ = nullptr; - aclRet = aclrtResetDevice(deviceId_); return bRet; } \ No newline at end of file -- libgit2 0.21.4