Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-12-02 04:24:34

0001 // C/C++ standard headers
0002 #include <cstdlib>
0003 #include <iomanip>
0004 #include <iostream>
0005 
0006 // ROCm headers
0007 #include <hip/hip_runtime.h>
0008 
0009 // CMSSW headers
0010 #include "HeterogeneousCore/ROCmUtilities/interface/hipCheck.h"
0011 #include "isRocmDeviceSupported.h"
0012 
0013 int main() {
0014   int devices = 0;
0015   hipError_t status = hipGetDeviceCount(&devices);
0016   if (status != hipSuccess) {
0017     std::cerr << "rocmComputeCapabilities: " << hipGetErrorString(status) << std::endl;
0018     return EXIT_FAILURE;
0019   }
0020 
0021   for (int i = 0; i < devices; ++i) {
0022     hipDeviceProp_t properties;
0023     hipCheck(hipGetDeviceProperties(&properties, i));
0024     std::cout << std::setw(4) << i << "    " << std::setw(8) << properties.gcnArchName << "    " << properties.name;
0025     if (not isRocmDeviceSupported(i)) {
0026       std::cout << " (unsupported)";
0027     }
0028     std::cout << std::endl;
0029   }
0030 
0031   return EXIT_SUCCESS;
0032 }