cuda_utils_kernels.cu 357 B

123456789101112131415161718
  1. #ifdef USE_ROCM
  2. #include <hip/hip_runtime.h>
  3. #endif
  4. int get_device_attribute(
  5. int attribute,
  6. int device_id)
  7. {
  8. int device, value;
  9. if (device_id < 0) {
  10. cudaGetDevice(&device);
  11. }
  12. else {
  13. device = device_id;
  14. }
  15. cudaDeviceGetAttribute(&value, static_cast<cudaDeviceAttr>(attribute), device);
  16. return value;
  17. }