---
title: 进行AscendCL推理时报错Acl open device 0 failed, errorCode is 507033-昇腾社区
description: (待补充)
keywords: 507033,SetDevice
url: https://www.hiascend.com/document/caselibrary/detail/topic_0000001633594041
section: (其他)
---

# 进行AscendCL推理时报错Acl open device 0 failed, errorCode is 507033-昇腾社区

URL: https://www.hiascend.com/document/caselibrary/detail/topic_0000001633594041
描述: (待补充)
关键词: 507033,SetDevice

昇腾文档 [了解详情](https://www.hiascend.com/document)

故障案例 [了解详情](https://www.hiascend.com/document/caselibrary)

进行AscendCL推理时报错Acl open device 0 failed, errorCode is 507033

进行AscendCL推理时报错Acl open device 0 failed, errorCode is 507033

2023/09/14

10k

问题信息

| 问题来源 | 产品大类 | 产品子类 | 关键字 |
| --- | --- | --- | ---|
| 官方 | 模型推理 | 应用开发AscendCL | 507033、SetDevice |

#### 问题现象

通过C++ AscendCL接口编写的yolov7MultiInput demo，编译没问题，运行时在调用aclrtSetDevice()接口过程中返回错误码507033。

Demo链接：https://gitee.com/ascend/samples/tree/master/inference/modelInference/sampleYOLOV7MultiInput [了解详情](https://gitee.com/ascend/samples/tree/master/inference/modelInference/sampleYOLOV7MultiInput)

#### 原因分析

1. 可能是Device没起来。
2. 可能是驱动版本不对。
3. 可能是环境变量没配对，缺少相关库文件导致。

#### 排查方法

1. 执行npu-smi info可以看到Device信息。
2. 调用Python的API acl.rt.set_device(0)和acl.rt.create_context(0)均OK。
3. 初步怀疑是C++交叉编译运行时缺少调用Device的库导致。

#### 解决措施

1. 执行vim ~/.bashrc，在里面添加运行时的链接库文件。

```
export LD_LIBRARY_PATH=${THIRDPART_PATH}/lib:$LD_LIBRARY_PATH
```
2. 保存后，再执行source ~/.bashrc。
3. 具体操作可以参考以下链接：https://gitee.com/ascend/samples/blob/master/cplusplus/environment/catenation_environmental_guidance_CN.md

本页内容

- 问题信息
- 问题现象
- 原因分析
- 排查方法
- 解决措施
