-2

I am writing a program that can get and display all information (properties) about GPU device in CUDA 6.5 (C++). But when I run, it does not show the device name as I want and maximum number of threads per block is 1.

I used GPU EN9400GT ASUS.

enter image description here

Lee Dat
  • 155
  • 1
  • 6
  • 20
  • 2
    Bot API calls are failing, but because you have no (or badly broken) error checking, you don't know this. Also, never post code in screenshots. It is unsearchable and completely unhelpful for others. – talonmies May 12 '17 at 05:14

1 Answers1

2

EN9400GT ASUS uses GeForce 9400GT and its compute capability is 1.0. CUDA 6.5 dropped support for cc1.0 so your code won't work. You should use CUDA 6.0 for cc1.0 devices (link).

You could have found out this by yourself if you had used correct error checking code for the CUDA APIs. When checking the return value of a CUDA API, you should compare the return value with cudaSuccess, not with an arbitrary integer value. If you had compared GPUAvail with cudaSuccess like this:

if (GPUAvail != cudaSuccess)
    exit(EXIT_FAILURE);

then your program would have stopped. See this article for proper error checking method.

Also, check out deviceQuery CUDA sample code. This sample code does what you are trying to do.

Community
  • 1
  • 1
nglee
  • 1,913
  • 9
  • 32
  • How do we check if a machine (computer) already has GPU or not in code CUDA ? Can function cudaGetDeviceCount() do this work ? – Lee Dat May 12 '17 at 15:34
  • 1
    You can check out the compute capability number of your gpu at [this page](https://developer.nvidia.com/cuda-legacy-gpus) or at [this page](https://developer.nvidia.com/cuda-gpus). Also, with help from [this CUDA api documentation for the 6.5 version](http://pleiades.ucsc.edu/doc/cuda/6.5/cuda-runtime-api/group__CUDART__DEVICE.html#group__CUDART__DEVICE_1gd3f924ba23b94793b0c93b2addba0741) you should be able to check if your method using `cudaGetDeviceCount()` works by yourself. I can't do it because I don't have many GPUs to test on. Also, it'd be really helpful if you share the result. – nglee May 13 '17 at 01:30