The Khronos Group - a non-profit industry consortium to develop, publish and promote open standard, royalty-free media authoring and acceleration standards for desktop and handheld devices, combined with conformance qualification programs for platform and device interoperability.

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Wait if CL_DEVICE_NOT_AVAILABLE is returned?

Hi there,

I'm now pushig my Project to work in multiple instances. One error thats hard to produce but happens often is CL_DEVICE_NOT_AVAILABLE while creating the context. Do you think it is good practice to wait when you get this? I can't sync over multiple instances of the program so blocking would not solve the problem.

Thanks in advance,
clint3112

P.S.: If the topic already exists, I could not find it, because the search term "CL_DEVICE_NOT_AVAILABLE" was rejected by the search system (all 4 words are too common)

Re: Wait if CL_DEVICE_NOT_AVAILABLE is returned?

Correct with the Instances.

My Program has only a small part of openCL and lots of other parts with many user interaction. I had to run 6 instances in parallel end do some mouse artistics to get the error. OpenCL is only used for a few secs in each instance, so there is a good chance that it will never happend to a user but still i have to avoid this problem.

What i am doing right now is:
1. try to aquire the context
a. if i get the context, continue
b. if i get Dev_not_available show a modal dialoge that says "please wait until the calculations of other instances are completed an press okay". Than will try to get the context again.

I could answer the hardware question for my dev PC (x990 + gtx580) but the user will not have that compute caps. So maybe they will get the problem more often.

Re: Wait if CL_DEVICE_NOT_AVAILABLE is returned?

Ah, now I understand why you are doing this. In addition to trying to create the context and catch an error when that fails, you could also query the device properties for CL_DEVICE_AVAILABLE. If that returns CL_TRUE then your program should be able to continue. If CL_FALSE, show the error. Strangely enough, I have run code that has used two contexts on a device at the same time without any problems. Perhaps the number of contexts is implementation specific.

Re: Wait if CL_DEVICE_NOT_AVAILABLE is returned?

As you said, you used "just" two. I was actively working on 6 in parallel. So the problem might be that an enqueue call came "at the same time", the createContext was called. It worked with 5 / 6 in parallel most of the time
Thanks for the hint. Maybe that could bring me the extra time i need to get that running.