---
title: 函数：query_device_status
description: "| 产品 | 是否支持 |"
url: https://www.hiascend.com/document/detail/zh/canncommercial/latest/API/runtimeapi/aclpythondevg_01_0069.html
sourcePath: /source/zh/canncommercial/900/API/runtimeapi/aclpythondevg_01_0069.html
indexId: 41e61c6491451b51b968bd8d7dbc8c8324ab40c8ebb15b0df8979825121b092e71
---
# 函数：query_device_status

#### 产品支持情况

| 产品 | 是否支持 |
| --- | --- |
| Atlas 350 加速卡 | √ |
| Atlas A3 训练系列产品 / Atlas A3 推理系列产品 | √ |
| Atlas A2 训练系列产品 / Atlas A2 推理系列产品 | √ |
| Atlas 训练系列产品 | √ |
| Atlas 推理系列产品 | √ |
| Atlas 200I/500 A2 推理产品 | √ |


#### 功能说明

查询Device状态是正常可用、还是异常不可用。


#### 函数原型

- C函数原型
  1 aclError aclrtQueryDeviceStatus(int32_t deviceId, aclrtDeviceStatus *deviceStatus)

- python函数
  1 device_status, ret = acl.rt.query_device_status(device_id)


#### 参数说明

| 参数名 | 说明 |
| --- | --- |
| device\_id | int，Device设备号。 用户调用acl.rt.get\_device\_count接口获取可用的Device数量后，该Device ID的取值范围为[0, (可用的Device数量\-1)]。 |


#### 返回值说明

| 返回值 | 说明 |
| --- | --- |
| device\_status | int，Device状态，具体请参见aclrtDeviceStatus。 |
| ret | int，错误码，返回0表示成功，返回其它值表示失败。 |
