It does not select the right gpu

Hi all,

I have a GeForce 285 and 580. The 285 is my primary since I am using that with the monitor and the 580 totally dedicated to Cuda computing.

I wrote my code, i specified “compute_20,sm_20” and also

int deviceCount, device;

	cudaDeviceProp prop;

	 // Num. of Device Count


        printf("\nDevice found:\n");

		for(i=0; i<deviceCount; i++)	{

			cudaGetDeviceProperties(&prop, i);



        // Device Selection

		device = 0;


// Current Device Detection    

        cudaGetDeviceProperties(&prop, device);

        printf("Using device %d: %s \n", device,;

To select the 580 (that is 0, 285 is 1)

Well, when I run it, if I set a thread/block until 512 everything fine, but from 513 going over I get error…

I guess it is using anyway the 285 since it has the 512 threads/block limit, while on 580 this is 1024.

What could I do?

Update: I toke the 285 out from the pc, but I still get the error.

It is related with the “Generate GPU Debug Information” field.

When this is “Yes”, I can run my program with up to 768 (only limited by Shared Memory).

But if it is “No.” then I get errors, and it runs fine again only with =< 512 kernels.

Any idea?

Where exactly have you specified “compute_20,sm_20”? It seems you put it somewhere where it is only used for debug builds, not for release builds.


Property -> CUDA C/C++ -> Device -> Code Generation

And I double checked, the configuration is the Release one