Commit 135c5763ff7c16402675d33fbbf743bb659974de

Authored by Hu Chunming
1 parent 6ecc07d5

删除aclrtSetDevice

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