---
name: "PAPI_get_dev_type_attr"
section: "3"
platform: "linux"
package: "libpapi-dev"
version: "7.1.0-5+b1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/PAPI_get_dev_type_attr"
---

# PAPI\_get\_dev\_type\_attr(3)

returns device type attributes

## NAME

PAPI\_get\_dev\_type\_attr - returns device type attributes

## SYNOPSIS

## Detailed Description

**Return values**

*ENOSUPP* invalid attribute

**Parameters**

*handle* opaque handle for device, obtained through **PAPI\_enum\_dev\_type** \
 *attr* device type attribute to query \
 *val* value of the requested device type attribute

**Example:**

```
typedef enum {
    PAPI_DEV_TYPE_ATTR__INT_PAPI_ID,    // PAPI defined device type id
    PAPI_DEV_TYPE_ATTR__INT_VENDOR_ID,  // Vendor defined id
    PAPI_DEV_TYPE_ATTR__CHAR_NAME,      // Vendor name
    PAPI_DEV_TYPE_ATTR__INT_COUNT,      // Devices of that type and vendor
    PAPI_DEV_TYPE_ATTR__CHAR_STATUS,    // Status string for the device type
} PAPI_dev_type_attr_e;
typedef enum {
    PAPI_DEV_TYPE_ID__CPU,   // Device id for CPUs
    PAPI_DEV_TYPE_ID__CUDA,  // Device id for Nvidia GPUs
    PAPI_DEV_TYPE_ID__ROCM,  // Device id for AMD GPUs
} PAPI_dev_type_id_e;
void *handle;
int id;
int enum_modifier = PAPI_DEV_TYPE_ENUM__ALL;
while (PAPI_OK == PAPI_enum_dev_type(enum_modifier, &handle)) {
    PAPI_get_dev_type_attr(handle, PAPI_DEV_TYPE_ATTR__INT_PAPI_ID, &id);
    switch (id) {
        case PAPI_DEV_TYPE_ID__CPU:
            // query cpu attributes
            break;
        case PAPI_DEV_TYPE_ID__CUDA:
            // query nvidia gpu attributes
            break;
        case PAPI_DEV_TYPE_ID__ROCM:
            // query amd gpu attributes
            break;
        default: ...
    }
}
```

 **PAPI\_get\_dev\_type\_attr()** allows the user to query all device type attributes. It takes a device type handle, returned by **PAPI\_enum\_dev\_type**, and an attribute to be queried for the device type and returns the attribute value.

**See also**

**PAPI\_enum\_dev\_type**

**PAPI\_get\_dev\_attr**

## Author

Generated automatically by Doxygen for PAPI from the source code.
