cl_device_available

Hi all

I’d like to ask if anyone has ever managed to get meaningful results for the CL_DEVICE_AVAILABLE query on clGetDeviceInfo. Perhaps I’m doing this wrong (code below) but so far I have never seen a device flagged as unavailable!

I’m using a unix node with 4 Tesla S1070s, running in exclusive mode. The whole programme takes a long time, occupying a single GPU. I can run the programme on device 0, send it to the background and then run a second instance of the programme, this time on device 1. It works fine, but it reports that all devices are available, even though device 0 is in use. If I were to run the second instance of the programme on device 0 then they both crash (first instance CL_OUT_OF_RESOURCES, second instance CL_DEVICE_NOT_AVAILABLE). This is to be expected, the only puzzling behaviour is the CL_DEVICE_AVAILABLE flag in clGetDeviceInfo (unless I have misunderstood what this is actually supposed to do!)

Here’s the part of the programme that checks for availability:

cl_platform_id platform;
cl_device_id devs[100];
cl_uint ndevs = 0,  ret_num_platforms = 0;
cl_bool av[10];
char devname[2048];

clGetPlatformIDs(1,&platform,&ret_num_platforms);
clGetDeviceIDs(platform, CL_DEVICE_TYPE_GPU, 100, devs, &ndevs);
printf("Devices (availability):
");
for(i = 0; (unsigned int)i < ndevs; i++)
{
        clGetDeviceInfo(devs[i],CL_DEVICE_AVAILABLE,sizeof(cl_bool),
&av[i],NULL);
        clGetDeviceInfo(devs[i],CL_DEVICE_NAME,sizeof(devname),
devname,NULL);
        printf("%d:	%s (%d)
",i,devname,av[i]);
}

I’d like to be able to check if a device is available before proceeding to create a command queue on that device. Is there a problem with how I’m querying this?

Thanks in advance for your time.

Gib

p.s. This is probably a stupid question, but how would you search the khronos forum for the whole term ‘CL_DEVICE_AVAILABLE’?
p.p.s. This is a re-post from the nvidia opencl forum, apologies if this is bad etiquette.