Commit 135c5763ff7c16402675d33fbbf743bb659974de
1 parent
6ecc07d5
删除aclrtSetDevice
Showing
4 changed files
with
0 additions
and
14 deletions
src/ai_platform/vpt_proj.cpp1
@@ -86,7 +86,6 @@ int main(){ | @@ -86,7 +86,6 @@ int main(){ | ||
86 | param.isTrk = false; | 86 | param.isTrk = false; |
87 | 87 | ||
88 | ACL_CALL(aclInit(nullptr), ACL_ERROR_NONE, 1); | 88 | ACL_CALL(aclInit(nullptr), ACL_ERROR_NONE, 1); |
89 | - ACL_CALL(aclrtSetDevice(param.devId), ACL_ERROR_NONE, 1); | ||
90 | aclrtContext ctx; | 89 | aclrtContext ctx; |
91 | ACL_CALL(aclrtCreateContext(&ctx, param.devId), ACL_ERROR_NONE, 1); | 90 | ACL_CALL(aclrtCreateContext(&ctx, param.devId), ACL_ERROR_NONE, 1); |
92 | 91 |
src/decoder/test_face.cpp1
@@ -75,7 +75,6 @@ int main(){ | @@ -75,7 +75,6 @@ int main(){ | ||
75 | string models_dir = "."; | 75 | string models_dir = "."; |
76 | 76 | ||
77 | aclInit(nullptr); | 77 | aclInit(nullptr); |
78 | - aclrtSetDevice(m_devId); | ||
79 | 78 | ||
80 | // 人脸检测初始化 | 79 | // 人脸检测初始化 |
81 | facedet_ai_engine_param fd_param; | 80 | facedet_ai_engine_param fd_param; |
@@ -179,7 +178,6 @@ int main(){ | @@ -179,7 +178,6 @@ int main(){ | ||
179 | 178 | ||
180 | void algorthim_process_thread(){ | 179 | void algorthim_process_thread(){ |
181 | 180 | ||
182 | - aclrtSetDevice(m_devId); | ||
183 | aclrtCreateContext(&ctx, m_devId); | 181 | aclrtCreateContext(&ctx, m_devId); |
184 | 182 | ||
185 | while (true){ | 183 | while (true){ |
src/test/test.cpp
@@ -60,7 +60,6 @@ int main() { | @@ -60,7 +60,6 @@ int main() { | ||
60 | void* handle = nullptr; | 60 | void* handle = nullptr; |
61 | cout << "init start " << endl; | 61 | cout << "init start " << endl; |
62 | ACL_CALL(aclInit(nullptr), ACL_SUCCESS, SY_FAILED); | 62 | ACL_CALL(aclInit(nullptr), ACL_SUCCESS, SY_FAILED); |
63 | - ACL_CALL(aclrtSetDevice(param.devId), ACL_SUCCESS, SY_FAILED); | ||
64 | aclrtContext ctx; | 63 | aclrtContext ctx; |
65 | ACL_CALL(aclrtCreateContext(&ctx, param.devId), ACL_SUCCESS, SY_FAILED); | 64 | ACL_CALL(aclrtCreateContext(&ctx, param.devId), ACL_SUCCESS, SY_FAILED); |
66 | aclrtStream stream = nullptr; | 65 | aclrtStream stream = nullptr; |
@@ -279,7 +278,6 @@ int main() { | @@ -279,7 +278,6 @@ int main() { | ||
279 | vpt_release(&handle); | 278 | vpt_release(&handle); |
280 | aclrtDestroyStream(stream); | 279 | aclrtDestroyStream(stream); |
281 | aclrtDestroyContext(ctx); | 280 | aclrtDestroyContext(ctx); |
282 | - aclrtResetDevice(param.devId); | ||
283 | aclFinalize(); | 281 | aclFinalize(); |
284 | 282 | ||
285 | 283 |
src/util/JpegUtil.cpp
@@ -12,7 +12,6 @@ int JpegUtil::jpeg_init(int32_t devId){ | @@ -12,7 +12,6 @@ int JpegUtil::jpeg_init(int32_t devId){ | ||
12 | 12 | ||
13 | aclError ret; | 13 | aclError ret; |
14 | /* 2.Run the management resource application, including Device, Context, Stream */ | 14 | /* 2.Run the management resource application, including Device, Context, Stream */ |
15 | - aclrtSetDevice(deviceId_); | ||
16 | aclrtCreateContext(&context_, deviceId_); | 15 | aclrtCreateContext(&context_, deviceId_); |
17 | 16 | ||
18 | // channel 准备 | 17 | // channel 准备 |
@@ -27,7 +26,6 @@ int JpegUtil::jpeg_init(int32_t devId){ | @@ -27,7 +26,6 @@ int JpegUtil::jpeg_init(int32_t devId){ | ||
27 | 26 | ||
28 | void JpegUtil::jpeg_release(){ | 27 | void JpegUtil::jpeg_release(){ |
29 | aclError ret; | 28 | aclError ret; |
30 | - ret = aclrtSetDevice(deviceId_); | ||
31 | aclrtSetCurrentContext(context_); | 29 | aclrtSetCurrentContext(context_); |
32 | 30 | ||
33 | ret = acldvppDestroyChannel(dvppChannelDesc_); | 31 | ret = acldvppDestroyChannel(dvppChannelDesc_); |
@@ -43,11 +41,6 @@ void JpegUtil::jpeg_release(){ | @@ -43,11 +41,6 @@ void JpegUtil::jpeg_release(){ | ||
43 | } | 41 | } |
44 | context_ = nullptr; | 42 | context_ = nullptr; |
45 | } | 43 | } |
46 | - | ||
47 | - ret = aclrtResetDevice(deviceId_); | ||
48 | - if (ret != ACL_SUCCESS) { | ||
49 | - LOG_ERROR("reset device failed"); | ||
50 | - } | ||
51 | } | 44 | } |
52 | 45 | ||
53 | int32_t JpegUtil::jpege_save(char* pcData , uint32_t dataLen, string out_file_name) | 46 | 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 | @@ -69,7 +62,6 @@ int32_t JpegUtil::jpege_save(char* pcData , uint32_t dataLen, string out_file_na | ||
69 | bool JpegUtil::jpeg_encode(acldvppPicDesc *encodeInputDesc_, string out_file_name) { | 62 | bool JpegUtil::jpeg_encode(acldvppPicDesc *encodeInputDesc_, string out_file_name) { |
70 | 63 | ||
71 | aclError aclRet ; | 64 | aclError aclRet ; |
72 | - aclRet = aclrtSetDevice(deviceId_); | ||
73 | aclrtSetCurrentContext(context_); | 65 | aclrtSetCurrentContext(context_); |
74 | 66 | ||
75 | // 8. 申请输出内存,申请Device内存encodeOutBufferDev_,存放编码后的输出数据 | 67 | // 8. 申请输出内存,申请Device内存encodeOutBufferDev_,存放编码后的输出数据 |
@@ -141,6 +133,5 @@ bool JpegUtil::jpeg_encode(acldvppPicDesc *encodeInputDesc_, string out_file_nam | @@ -141,6 +133,5 @@ bool JpegUtil::jpeg_encode(acldvppPicDesc *encodeInputDesc_, string out_file_nam | ||
141 | // 释放掉输入输出的device内存 | 133 | // 释放掉输入输出的device内存 |
142 | (void)acldvppFree(encodeOutBufferDev_); | 134 | (void)acldvppFree(encodeOutBufferDev_); |
143 | encodeOutBufferDev_ = nullptr; | 135 | encodeOutBufferDev_ = nullptr; |
144 | - aclRet = aclrtResetDevice(deviceId_); | ||
145 | return bRet; | 136 | return bRet; |
146 | } | 137 | } |
147 | \ No newline at end of file | 138 | \ No newline at end of file |