text: /*
  Some of the code is adopted from device query benchmark
  from CUDA SDK
  */
  
  // std::system includes
  
  #include <cuda_runtime.h>
  
  #include <iostream>
  #include <memory>
  #include <string>
  
  ////////////////////////////////////////////////////////////////////////////////
  // Program main
  ////////////////////////////////////////////////////////////////////////////////
  int main(int argc, char **argv) {
  
    int deviceCount = 0;
    cudaError_t error_id = cudaGetDeviceCount(&deviceCount);
  
    if (error_id != cudaSuccess) {
      printf("cudaGetDeviceCount returned %d\n-> %s\n",
             static_cast<int>(error_id), cudaGetErrorString(error_id));
      printf("Result = FAIL\n");
      exit(EXIT_FAILURE);
    }
  
    // This function call returns 0 if there are no CUDA capable devices.
    if (deviceCount == 0) {
      printf("There are no available device(s) that support CUDA\n");
    }
  
    for (int dev = 0; dev < deviceCount; ++dev) {
      cudaSetDevice(dev);
      cudaDeviceProp deviceProp;
      cudaGetDeviceProperties(&deviceProp, dev);
  
      printf("\nDevice %d: \"%s sm_%d.%d\"\n", dev, deviceProp.name,
             deviceProp.major, deviceProp.minor);
    }
  }
  