2
* Copyright 1993-2007 NVIDIA Corporation. All rights reserved.
6
* This source code is subject to NVIDIA ownership rights under U.S. and
7
* international Copyright laws. Users and possessors of this source code
8
* are hereby granted a nonexclusive, royalty-free license to use this code
9
* in individual and commercial software.
11
* NVIDIA MAKES NO REPRESENTATION ABOUT THE SUITABILITY OF THIS SOURCE
12
* CODE FOR ANY PURPOSE. IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR
13
* IMPLIED WARRANTY OF ANY KIND. NVIDIA DISCLAIMS ALL WARRANTIES WITH
14
* REGARD TO THIS SOURCE CODE, INCLUDING ALL IMPLIED WARRANTIES OF
15
* MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
16
* IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL,
17
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
18
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
19
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
20
* OR PERFORMANCE OF THIS SOURCE CODE.
22
* U.S. Government End Users. This source code is a "commercial item" as
23
* that term is defined at 48 C.F.R. 2.101 (OCT 1995), consisting of
24
* "commercial computer software" and "commercial computer software
25
* documentation" as such terms are used in 48 C.F.R. 12.212 (SEPT 1995)
26
* and is provided to the U.S. Government only as a commercial end item.
27
* Consistent with 48 C.F.R.12.212 and 48 C.F.R. 227.7202-1 through
28
* 227.7202-4 (JUNE 1995), all U.S. Government End Users acquire the
29
* source code with only those rights set forth herein.
31
* Any use of this source code in individual and commercial software must
32
* include, in the user documentation and internal comments to the code,
33
* the above Disclaimer and U.S. Government End Users Notice.
36
/* This sample queries the properties of the CUDA devices present in the system. */
46
////////////////////////////////////////////////////////////////////////////////
48
////////////////////////////////////////////////////////////////////////////////
50
main( int argc, char** argv)
53
CUDA_SAFE_CALL(cudaGetDeviceCount(&deviceCount));
55
printf("There is no device supporting CUDA\n");
57
for (dev = 0; dev < deviceCount; ++dev) {
58
cudaDeviceProp deviceProp;
59
CUDA_SAFE_CALL(cudaGetDeviceProperties(&deviceProp, dev));
61
if (deviceProp.major == 9999 && deviceProp.minor == 9999)
62
printf("There is no device supporting CUDA.\n");
63
else if (deviceCount == 1)
64
printf("There is 1 device supporting CUDA\n");
66
printf("There are %d devices supporting CUDA\n", deviceCount);
68
printf("\nDevice %d: \"%s\"\n", dev, deviceProp.name);
69
printf(" Major revision number: %d\n",
71
printf(" Minor revision number: %d\n",
73
printf(" Total amount of global memory: %u bytes\n",
74
deviceProp.totalGlobalMem);
75
#if CUDART_VERSION >= 2000
76
printf(" Number of multiprocessors: %d\n",
77
deviceProp.multiProcessorCount);
78
printf(" Number of cores: %d\n",
79
8 * deviceProp.multiProcessorCount);
81
printf(" Total amount of constant memory: %u bytes\n",
82
deviceProp.totalConstMem);
83
printf(" Total amount of shared memory per block: %u bytes\n",
84
deviceProp.sharedMemPerBlock);
85
printf(" Total number of registers available per block: %d\n",
86
deviceProp.regsPerBlock);
87
printf(" Warp size: %d\n",
89
printf(" Maximum number of threads per block: %d\n",
90
deviceProp.maxThreadsPerBlock);
91
printf(" Maximum sizes of each dimension of a block: %d x %d x %d\n",
92
deviceProp.maxThreadsDim[0],
93
deviceProp.maxThreadsDim[1],
94
deviceProp.maxThreadsDim[2]);
95
printf(" Maximum sizes of each dimension of a grid: %d x %d x %d\n",
96
deviceProp.maxGridSize[0],
97
deviceProp.maxGridSize[1],
98
deviceProp.maxGridSize[2]);
99
printf(" Maximum memory pitch: %u bytes\n",
100
deviceProp.memPitch);
101
printf(" Texture alignment: %u bytes\n",
102
deviceProp.textureAlignment);
103
printf(" Clock rate: %.2f GHz\n",
104
deviceProp.clockRate * 1e-6f);
105
#if CUDART_VERSION >= 2000
106
printf(" Concurrent copy and execution: %s\n",
107
deviceProp.deviceOverlap ? "Yes" : "No");
110
printf("\nTest PASSED\n");
111
CUT_EXIT(argc, argv);