View Full Version : Wait if CL_DEVICE_NOT_AVAILABLE is returned?
11-13-2012, 05:29 AM
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,
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)
11-14-2012, 09:21 AM
Why is the device unavailable? By the sounds of it, you are launching more instances of your program than there are devices. Is that correct?
Whether it is good practice to wait depends on the program you are writing and the program that is using the device? Please give some more details about both. Also, what hardware are you using?
11-15-2012, 12:08 AM
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.
11-15-2012, 05:49 AM
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.
11-15-2012, 08:38 AM
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.
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.