我正在尝试使用以下代码获取设备的内存总线带宽:
#include <stdio.h>
int main() {
int nDevices;
cudaGetDeviceCount(&nDevices);
for (int i = 0; i < nDevices; i++) {
cudaDeviceProp prop;
cudaGetDeviceProperties(&prop, i);
printf("Device Number: %d\n", i);
printf(" Device name: %s\n", prop.name);
printf(" Memory Clock Rate (KHz): %d\n",
prop.memoryClockRate);
printf(" Memory Bus Width (bits): %d\n",
prop.memoryBusWidth);
printf(" Peak Memory Bandwidth (GB/s): %f\n\n",
2.0*prop.memoryClockRate*(prop.memoryBusWidth/8)/1.0e6);
}
}
我收到了这个错误:
bandwidth.cu(13): error: class "cudaDeviceProp" has no member "memoryClockRate"
bandwidth.cu(15): error: class "cudaDeviceProp" has no member "memoryBusWidth"
bandwidth.cu(17): error: class "cudaDeviceProp" has no member "memoryClockRate"
bandwidth.cu(17): error: class "cudaDeviceProp" has no member "memoryBusWidth"
4 errors detected in the compilation of "/tmp/tmpxft_000003c4_00000000-4_bandwidth.cpp1.ii".
make: *** [hello.cu_o] Error 2
有人可以帮忙吗?我正在使用Tesla T10 处理器GPU 和CUDA 3.2。