Verificação das Características da GPU Instalada

 1 #include <cuda.h>
 2 #include "simple_arrays.h"
 3 
 4 Image32S *_getGPUInfo()
 5 {
 6     int n;
 7     int dims[2];
 8     if(cudaGetDeviceCount(&n) != cudaSuccess)
 9         return 0;
10 
11     dims[0] = n;
12     dims[1] = 23;
13     Image32S *img = new Image32S(2, dims);
14     int *data = (int *)img->raster;
15 
16     for(int i = 0; i < n; i++) {
17         cudaDeviceProp props;
18         if(cudaGetDeviceProperties(&props, i) != cudaSuccess) {
19             delete img;
20             return 0;
21         }
22         *data++ = props.canMapHostMemory;
23         *data++ = props.clockRate;
24         *data++ = props.computeMode;
25         *data++ = props.deviceOverlap;
26         *data++ = props.integrated;
27         *data++ = props.kernelExecTimeoutEnabled;
28         *data++ = props.major;
29         *data++ = props.maxGridSize[0];
30         *data++ = props.maxGridSize[1];
31         *data++ = props.maxGridSize[2];
32         *data++ = props.maxThread
OK