Hello! Please be a little forgiving, I’m learning C and OpenCL at the same time
I’m busy querying devices on my mbp to make a choice which gpu to use. I have set up a list of devices with
cl_device_id allCLdevices[4] ;
cl_device_id *selectedCLdevice = &allCLdevices[0];
and
err = clGetDeviceIDs(NULL, CL_DEVICE_TYPE_GPU, 2, allCLdevices, &numberOfCLdevices);
when I’m getting info about the devices with
for (int devNr=0; devNr<numberOfCLdevices; devNr++) {
selectedCLdevice = &allCLdevices[devNr];
err = clGetDeviceInfo(*selectedCLdevice, CL_DEVICE_NAME, sizeof(device_name), device_name, NULL);
printf("device %d: %s
", devNr, device_name);
...
};
all present GPUs are listed (two of them). Now I’m running the whole (test-)calculation on the CPU, which works fine.
After that I’m running the same CL-routine on the gpu, where I’m trying to select a device with
if (numberOfCLdevices > 1) {
selectedCLdevice = &allCLdevices[1];
printf("%s, (%d devices)
", device, numberOfCLdevices);
}else {
selectedCLdevice = &allCLdevices[0];
};
To select the “bigger” GPU on the MacBookPro, which is not being used for display, I’m choosing the selectedCLdevice = &allCLdevices[1], whenever there is more than one device.
Problem:
selectedCLdevice = &allCLdevices[0] will work (also in the GPU-run), selectedCLdevice = &allCLdevices[1] will give me a nice litte
creating queue... queue error number -2
i.e. CL_DEVICE_NOT_AVAILABLE
coming from
commandQueue = clCreateCommandQueue(CLcontext, *selectedCLdevice , 0, &err);
Shouldn’t the secondary gpu, that I’m not using for display, be available for OpenCL just like the first one? Or did I make a mistake with the pointers or the allCLdevices-list?
Thanks