Different properties of gpu can be find out by calling cudaGetDeviceProperties() function.
cudaDeviceProp is a predefined structure(i.e. structure in C language) which is defined in the cuda.h header file. It has variables, which represent the information of a gpu. For e.g. name, warpSize, major, minor etc.
cudaGetDevice() returns the id of a current gpu in the system. Id of gpu starts from 0 to n-1 where n is the total number of gpus present in the system. The gpu id is get assigned to the variable whose address is passed to cudaGetDevice() function as an argument. cudaGetDeviceProperties(&p,device_id) returns the values of properties of a gpu having id device_id. These values are get assigned to the structure variable (in this case p). p.major and p.minor gives the major and minor values of micro architecture generation of a gpu whose properties values are saved into the structure variable p.
Note: Check CUDA program to find out major and minor of gpu in this link Cuda: Finding Compute Capability of a GPU
Post a Comment