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

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);

主站蜘蛛池模板: 富裕县| 大竹县| 郧西县| 太仓市| 济宁市| 海门市| 北宁市| 呼伦贝尔市| 美姑县| 社旗县| 和静县| 晴隆县| 宁波市| 大邑县| 东乡族自治县| 伊金霍洛旗| 井陉县| 钟祥市| 遵义市| 北辰区| 建昌县| 安西县| 新巴尔虎右旗| 怀集县| 库尔勒市| 芜湖市| 鄂尔多斯市| 嘉荫县| 巴南区| 揭阳市| 安顺市| 涡阳县| 万全县| 白山市| 日土县| 丰原市| 彭山县| 囊谦县| 志丹县| 黎平县| 江永县|