Problem with CUDA program

[font=“Franklin Gothic Medium”]Hi Everyone,

PENTIUM CORE 2 DUO 64 Bit Processor.

I’m currently working on a Stereo Vision Algorithm. The basic steps are

  1. Upload the data
  2. Perform the computation
  3. Download the result

after downloading the result, I’m finding that the result is just “filled” with zeros.

So I’ve written a small snippet which allocates an array of size equal to the number of threads. Using memset(), i’m setting all the entries to “0”. In CUDA kernel, each thread just places it’s ID in the array location indexed by ID.

in other words, a thread with ID = “N” does this

array[N] = N;

But after downloading, the array is just filled with zeroes.

Please let me know, what could the possible cause.

Thanks for your time.

Bhanu Kiran Challa


I think that you should check if kernel is launched successfully or not.

kernel<<< , >>>(...)


cudaError_t status = cudaGetLastError();

if (cudaSuccess != status ){

   printf("Error: %s\n", cudaGetErrorString(status));


Hi Mr. Chein,

I’ve inserted the code you’ve suggested. And I get the following error :

“Error : initialization error”.

I’ve run the deviceQuery program that is available on the net. And it is giving the error -

“There are 0 CUDA devices.”

I must say I’m more than puzzled, as

  1. My Graphics card is CUDA enabled (GEFORCE GTX 465)

  2. I’ve installed the NVIDIA driver, CUDA Toolkit and CUDA Tools (from NVIDIA website)

So why would the program not detect the CUDA device ???

Please direct me in the right direction !!!

Many thanks for your time.

Bhanu Kiran Challa.

what is your OS? and whic version of driver/toolkit do you install? can download latest version.

You could also try this test program:

It might report a little bit more than just initialization error… would be interesting to see what it reports ;)

I’m working on OpenSUSE 11.4 (Linux-x86_64) running on a 64 bit INTEL hardware.

I’ve installed the following NVIDIA driver :


I’ve installed the toolkits


  2. cudatools_4.0.17_linux_64

Even running “lspci | grep -i nvidia” gives no devices.

Bhanu Kiran Challa

It gives the following output :


Thanks for trying out the test program. I was expecting that it would return something like that.

What this means is the following:

The test program cannot find: nvcuda.dll

The test program simply assumes that this is somewhere on the environment path.

Perhaps you are using a secured version of Windows 7 which does not allow loading libraries with just “nvcuda.dll”.

The reason for this refusal is because of the “LoadLibrary” exploit/vunerability which exists on all windows versions.

If a hacker/attacker/virus/trojan would be another nvcuda.dll somewhere in the environment path then there is a chance that for example my program would load the fake nvcuda.dll.

And then the hacker can do anything he wants from nvcuda.dll.

Yesterday my system was automatically patched/updated by Microsoft’s Windows Update, it has installed 3 or so new api’s for loading libraries.

I have not yet installed service pack 1 so I don’t know if Windows 7 service pack 1 behaves differently.

So bottom line is:

As application developer I still have no idea how to load libraries “safely”. (It’s also kinda annoying having to change the way I do it and everybody else on the face of the planet ;) :) <- more research required and spending time on it ;))

I suspect this is what might be going on on your system.

Other explanation could be:

The drivers were not installed properly or your system might have environment settings/path settings screwed up (unlikely).

Euhm lol… I am getting a bit confused with your problem statement.

You say your computer OS is “OPENSUSE 11.4”.

Last time I checked that was “linux variant” ;) :) =D

So how are you running my TestProgram (which was for windows) on your system ? I am guessing wine ?!?

Well then you would probably have to copy the nvcuda.dll to the TestProgram folder.

But I doubt this will work… the nvcuda.dll probably hooks into windows drivers and not linux drivers…

But you could give it a try, but I am not responsible for any crashes or whatever, that’s your own risk ;) :)

Maybe I can try and compile it for linux… but that not my interest for now sorry ;) :)

Also I do wonder how Linux solves the windows vunerability ! LOL.

^ That’s really funny… wine copieing windows vunerabilities ! LOL.

I have my hands full on windows vunerabilities already ! LOL.

Thanks for the reply. You were right, it was driver problem. I’ve installed the latest driver and the program in now detecting the hardware successfully.

Bhanu Kiran Challa