devices selection

hi,
I’m still new to opencl,
I have two GPU cards on my pc
what is the easiest way to choose the card I want to use to compute my program?
thx in advance

You can do it like this:


	//Get devices of first platform
	clGetDeviceIDs(*platform, CL_DEVICE_TYPE_GPU, NULL, NULL, &amount);
	cl_device_id *devices = (cl_device_id*) malloc(amount * sizeof(cl_device_id));
	clGetDeviceIDs(*platform, CL_DEVICE_TYPE_GPU, amount, devices, NULL);
	

Then, when you create your command queue, you can specify whether you want to use the first device (device[0]) or the second device[0]). This worked for me.

If you want to know which number your device has, I would run CLInfo which is included in the ATI Stream SDK Samples. Or you can run a clGetDeviceInfo with an appropriate flag.

Greets,
centershock