PAPI_get_dev_type_attr(3)

🌸 NAME 🌸

Welcome to the PAPI manual, bestie β€” this is the page for PAPI_get_dev_type_attr (section 3, iykyk), and it returns device type attributes. πŸ’–

✨ SYNOPSIS ✨

πŸ’– Detailed Description πŸ’–

🌈 Return values 🌈

  • ENOSUPP β€” invalid attribute. That's the return-value tea. 🍡

πŸŽ€ 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: ...
    }
}

Okay so PAPI_get_dev_type_attr() literally allows you to query all device type attributes. You pass it a device type handle (the kind returned by PAPI_enum_dev_type) and an attribute to be queried for that device type, and it returns the attribute value. That's the whole arc, no cap. πŸ’…

πŸ¦‹ See also πŸ¦‹

  • PAPI_enum_dev_type
  • PAPI_get_dev_attr

πŸ‘‘ AUTHOR πŸ‘‘

Generated automatically by Doxygen for PAPI from the source code. πŸ’€πŸ€–


Cute little sign-off time: this is from the PAPI source, version 7.2.0.0, dated Wed Jun 25 2025 19:30:48. Bye bestie, stay iconic! 🫢✨