CODE WORKS IN XP BUT NOT LINUX. WHY?

The following works on C870 in XP but not in Linux.

#define N 4

#include <stdio.h>

global void d_arrayinit(unsigned int* x);

int main()
{
unsigned int i;
unsigned int* d_x;
unsigned int x[N];

for(i=0 ; i<N ; i++) x[i] = 0;


cudaMalloc((void**)&d_x,N*sizeof(unsigned int));

cudaMemcpy(d_x,x,N*sizeof(unsigned int),cudaMemcpyHostToDevice);

d_arrayinit<<<1,N>>>(d_x);

cudaMemcpy(x,d_x,N*sizeof(unsigned int),cudaMemcpyDeviceToHost);

cudaFree(d_x);

for(i=0 ; i<N ; i++) printf("\n%i",x[i]);
printf("\n\n");
return 0;

}

////////////////////////////////

global void d_arrayinit(unsigned int* x)
{
unsigned int i = blockIdx.x*blockDim.x+threadIdx.x;

x[i] = i;

}


What reasons could there be for this?

Sorry, I forgot to add that the runtime error message appears;

“NVIDIA: could not open the device file /dev/nvidiactl (No such file or directory).”

Either start X with the nvidia driver loaded or run the script that is in the release notes to create the device nodes.

or install the nvidia drivers.

You’re talking to a mathematician who knows little about Linux, but is looking to evaluate CUDA for fluid dynamics and combinatorial optimization problems.

If I go to the CUDA download page and enter my system (Linux 64 bit and SUSE Linux enterprise desktop) two drivers are suggested. I assume the CUDA 1.1 version is the more reliable and stable, so I’ll download that for now.

What do I do then? What does the driver do exactly?

The driver is the thing that makes it possible to ‘talk’ to the card. Without it, you cannot use the card.

Maybe this will help

http://www.suse.de/~sndirsch/nvidia-installer-HOWTO.html

or this

http://en.opensuse.org/NVIDIA

You need to install this display driver. You might try yast packages first as suggested, should be easier. If this doesn’t work you’re going to have to install the driver you downloaded manually, which can be quite quirky.