amitdonanand
amitdonanand

Reputation: 101

Error in cudaGetDeviceProperties

I am trying to get the memory bus bandwidth of my device using the following code:

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

And I am getting this error:

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

Can Someone please help? I am using a Tesla T10 Processor GPU and CUDA 3.2.

Upvotes: 1

Views: 2753

Answers (1)

BenC
BenC

Reputation: 8976

You can check the CUDA 3.2 documentation online, and you will see that the device properties were different back then. Either upgrade to CUDA 5.0 or adapt your code to CUDA 3.2.

If you decide to stick with CUDA 3.2, have a look at the SDK examples, especially bandwidthTest.cu which shows how it used to be done.

Upvotes: 1

Related Questions