官术网_书友最值得收藏!

General device properties

cudaDeviceProp provides several properties that can be used to identify the device and the versions being used. It provides the name property that returns the name of the device as a string. We can also get a version of the driver and the runtime engine the device is using by querying cudaDriverGetVersion and cudaRuntimeGetVersion properties. Sometimes, if you have more than one device, you want to use the device that has more multiprocessors. The multiProcessorCount property returns the count of the number of multiprocessors on the device. The speed of the GPU in terms of clock rate can be fetched by using the clockRate property. It returns clock rate in Khz. The following code snippet shows how to use these properties from the CUDA program:

cudaDeviceProp device_Property;
cudaGetDeviceProperties(&device_Property, device);
printf("\nDevice %d: \"%s\"\n", device, device_Property.name);
cudaDriverGetVersion(&driver_Version);
cudaRuntimeGetVersion(&runtime_Version);
printf(" CUDA Driver Version / Runtime Version %d.%d / %d.%d\n", driver_Version / 1000, (driver_Version % 100) / 10, runtime_Version / 1000, (runtime_Version % 100) / 10);
printf( " Total amount of global memory: %.0f MBytes (%llu bytes)\n",
(float)device_Property.totalGlobalMem / 1048576.0f, (unsigned long long) device_Property.totalGlobalMem);
printf(" (%2d) Multiprocessors", device_Property.multiProcessorCount );
printf(" GPU Max Clock rate: %.0f MHz (%0.2f GHz)\n", device_Property.clockRate * 1e-3f, device_Property.clockRate * 1e-6f);

主站蜘蛛池模板: 齐河县| 禹州市| 芜湖市| 南涧| 德保县| 宜丰县| 蓬溪县| 全椒县| 亚东县| 宜黄县| 合水县| 临澧县| 闽侯县| 万州区| 明星| 永安市| 汉沽区| 彭水| 南靖县| 类乌齐县| 湘阴县| 文水县| 新密市| 时尚| 德清县| 衡山县| 察雅县| 峡江县| 海城市| 南召县| 当雄县| 壶关县| 都兰县| 刚察县| 广安市| 盖州市| 桓台县| 泸西县| 太仆寺旗| 自贡市| 苏尼特右旗|