24 #include "../include/mycuda.h"
30 printf(
"CUDA Device Query (Runtime API) version (CUDART static linking)\n\n");
33 cudaError_t err = cudaGetDeviceCount(&deviceCount);
35 if (err != cudaSuccess) {
36 printf(
"cudaGetDeviceCount returned %d\n-> %s\n", (
int)err, cudaGetErrorString(err));
40 if (deviceCount == 0) {
41 printf(
"There are no available device(s) that support CUDA\n");
43 printf(
"Detected %d CUDA Capable device(s)\n", deviceCount);
46 int driverVersion=0, runtimeVersion=0;
48 for (
int dev = 0; dev < deviceCount; ++dev)
50 cudaDeviceProp deviceProp;
54 printf(
"\nDevice %d: \"%s\"\n", dev, deviceProp.name);
59 printf(
" CUDA Driver Version / Runtime Version %d.%d / %d.%d\n",
61 (driverVersion%100)/10,
63 (runtimeVersion%100)/10);
64 printf(
" CUDA Capability Major/Minor version number: %d.%d\n",
67 printf(
" Total amount of global memory: %.0f MBytes (%llu bytes)\n",
68 (
float)deviceProp.totalGlobalMem/1048576.0f,
69 (
unsigned long long) deviceProp.totalGlobalMem);
70 printf(
" (%2d) Multiprocessors x (%3d) CUDA Cores/MP: %d CUDA Cores\n",
71 deviceProp.multiProcessorCount,
74 printf(
" GPU Clock rate: %.0f MHz (%0.2f GHz)\n",
75 deviceProp.clockRate * 1e-3f,
76 deviceProp.clockRate * 1e-6f);
77 printf(
" Memory Clock rate: %.0f Mhz\n",
78 deviceProp.memoryClockRate * 1e-3f);
79 printf(
" Memory Bus Width: %d-bit\n",
80 deviceProp.memoryBusWidth);
81 printf(
" L2 Cache Size: %d bytes\n",
82 deviceProp.l2CacheSize);
83 printf(
" Max Texture Dimension Size (x,y,z) 1D=(%d), 2D=(%d,%d), 3D=(%d,%d,%d)\n",
84 deviceProp.maxTexture1D ,
85 deviceProp.maxTexture2D[0],
86 deviceProp.maxTexture2D[1],
87 deviceProp.maxTexture3D[0],
88 deviceProp.maxTexture3D[1],
89 deviceProp.maxTexture3D[2]);
90 printf(
" Max Layered Texture Size (dim) x layers 1D=(%d) x %d, 2D=(%d,%d) x %d\n",
91 deviceProp.maxTexture1DLayered[0],
92 deviceProp.maxTexture1DLayered[1],
93 deviceProp.maxTexture2DLayered[0],
94 deviceProp.maxTexture2DLayered[1],
95 deviceProp.maxTexture2DLayered[2]);
96 printf(
" Total amount of constant memory: %lu bytes\n",
97 deviceProp.totalConstMem);
98 printf(
" Total amount of shared memory per block: %lu bytes\n",
99 deviceProp.sharedMemPerBlock);
100 printf(
" Total number of registers available per block: %d\n",
101 deviceProp.regsPerBlock);
102 printf(
" Warp size: %d\n",
103 deviceProp.warpSize);
104 printf(
" Maximum number of threads per multiprocessor: %d\n",
105 deviceProp.maxThreadsPerMultiProcessor);
106 printf(
" Maximum number of threads per block: %d\n",
107 deviceProp.maxThreadsPerBlock);
108 printf(
" Maximum sizes of each dimension of a block: %d x %d x %d\n",
109 deviceProp.maxThreadsDim[0],
110 deviceProp.maxThreadsDim[1],
111 deviceProp.maxThreadsDim[2]);
112 printf(
" Maximum sizes of each dimension of a grid: %d x %d x %d\n",
113 deviceProp.maxGridSize[0],
114 deviceProp.maxGridSize[1],
115 deviceProp.maxGridSize[2]);
116 printf(
" Maximum memory pitch: %lu bytes\n",
117 deviceProp.memPitch);
118 printf(
" Texture alignment: %lu bytes\n",
119 deviceProp.textureAlignment);
120 printf(
" Concurrent copy and kernel execution: %s with %d copy engine(s)\n",
121 (deviceProp.deviceOverlap ?
"Yes" :
"No"),
122 deviceProp.asyncEngineCount);
123 printf(
" Run time limit on kernels: %s\n",
124 deviceProp.kernelExecTimeoutEnabled ?
"Yes" :
"No");
125 printf(
" Integrated GPU sharing Host Memory: %s\n",
126 deviceProp.integrated ?
"Yes" :
"No");
127 printf(
" Support host page-locked memory mapping: %s\n",
128 deviceProp.canMapHostMemory ?
"Yes" :
"No");
129 printf(
" Alignment requirement for Surfaces: %s\n",
130 deviceProp.surfaceAlignment ?
"Yes" :
"No");
131 printf(
" Device has ECC support: %s\n",
132 deviceProp.ECCEnabled ?
"Enabled" :
"Disabled");
133 printf(
" Device supports Unified Addressing (UVA): %s\n",
134 deviceProp.unifiedAddressing ?
"Yes" :
"No");
135 printf(
" Device PCI Bus ID / PCI location ID: %d / %d\n",
137 deviceProp.pciDeviceID);
139 const char *sComputeMode[] =
141 "Default (multiple host threads can use ::cudaSetDevice() with device simultaneously)",
142 "Exclusive (only one host thread in one process is able to use ::cudaSetDevice() with this device)",
143 "Prohibited (no host thread can use ::cudaSetDevice() with this device)",
144 "Exclusive Process (many threads in one process is able to use ::cudaSetDevice() with this device)",
148 printf(
" Compute Mode:\n");
149 printf(
" < %s >\n", sComputeMode[deviceProp.computeMode]);