CUDA on notebook

i have a notebook with 2 graphic cards, Intel and Nvidia.
My software uses CUDA for some steps, but i found some troubles.

In Nvidia Control Panel i can set preferred card(Automatic, Nvidia or Intel).
If selected Automatic or Intel, my CUDA program dosn’t work, calls like “cudaGetDeviceProperties” fails or “cudaGetDeviceCount” return only 1 device(wrong one).

So, how can i PRETENT to use the NVIDIA card?
(On notebook there is an NVIDIA application that show programs using CUDA, my one dosn’t appear in that state)


Actually i used

extern "C" { 
 _declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001;

and is linked “cudart_static.lib”(it’s necessary for linking) and still not working, i am checking a compatibile GPU is present with:

bool ElaborazioneDati::IsGpuAvailable()

	int devicesCount;
	for (int deviceIndex = 0; deviceIndex < devicesCount; ++deviceIndex)
		cudaDeviceProp deviceProperties;
		cudaGetDeviceProperties(&deviceProperties, deviceIndex);
		if (deviceProperties.major >= 2	&& deviceProperties.minor >= 0)
			return true;
	return false;

I get false from this function.

sorry, i have no idea how it should be implemented. but if you can provide full compilable source code, i will at least try it here (i7-4770 + gf560, win7, cuda 7.5)

try this piece of code posted above, call it and check if return true or false on your machine.
Change preferred card too(and restart) if you have a notebook.


“cudaGetDeviceCount” return only 1

Right, you have only one CUDA device (nVidia), Intel card is not CUDA aware

Yes, but this happens onyl sometimes(this 1 can be INTEL too).
I investigated and this is what i found:
cudaInit(0) return “CUDA_ERROR_UNKNOWN”, from here there is no chance to make CUDA work in this instance, but wakeup CUDA.
I need start a new instance of same software to make it work.