1. ホーム
  2. CUDA

CUDA (V) deviceQueryを使ったGPUのプロパティ

2022-03-15 06:58:51
<パス

CUDAがインストールされた後、DeviceQueryを使用してGPU関連のプロパティを見ることで、GPUをある程度理解し、将来のCUDAプログラミングに役立てることができます。


#include "cuda_runtime.h"
#include "device_launch_parameters.h"
#include
The code starts with cudaGetDeviceCount to get the number of NVIDIA GPUs on the system 

then the function cudaGetDeviceProperties to get the properties of the GPUs on the system.
The most direct way to view the properties after getting them again is to set a breakpoint to see them through debugging;

Or it can be displayed on the console by printing.

As shown in the results of the run.
deviceProp.name is the GPU name, if there is no GPU then Device Emulation will be output
deviceProp.totalGlobalMem returns the size of the global storage, for big data or some big model calculations the video memory size must be bigger than the data size, as the figure returns 2GB of storage size.
deviceProp.multiProcessorCount returns the number of stream multiprocessors (SMs) in the device, the number of stream processors (SPs) SMs x the number of SPs each SM contains, where Pascal is 64 SPs per SM, Maxwell is 128, Kepler is 192, and Fermi is 32.
deviceProp.totalConstMem returns the size of the constant store as if it were 64kB
deviceProp.sharedMemPerBlock returns the size of the shared storage, which is faster than the global storage.
deviceProp.regsPerBlock returns the number of registers.
deviceProp.warpSize returns how many threads are in the thread bundle.
deviceProp.maxThreadsPerBlock returns the maximum number of threads that can be in a block.
deviceProp.maxThreadsDim[] returns the maximum value of each of the 3 dimensions within the block
deviceProp.maxGridSize[] returns the maximum value of each of the 3 dimensions within the grid.
deviceProp.memPitch returns the maximum value of the pitch when aligned for video memory access.
deviceProp.texturePitchAlignment returns the maximum value of the pitch for its parameters when accessed against the texture unit.
deviceProp.clockRate returns the frequency of the video memory.