-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Concurrent device listing #189
Comments
As a temporary workaround you can also force the tests to run concurrently with |
sure, but I actually need to compile and run kernels in parallel in my application. |
Maybe you could use a global |
I will use a static reference to the device for now (see code below). I would very much like to see this issue fixed though, as thread-safety is stated to be a major goal of this crate. #[cfg(test)]
mod tests {
use super::*;
use ocl::{Platform, Device};
use lazy_static::lazy_static;
lazy_static! {
static ref DEVICE: Device = Device::first(Platform::default()).expect("Device has to exist");
}
fn ocl(){
let platform = Platform::default();
println!("Platform:{:?}", platform);
let device = *DEVICE;
println!("Device{:?}", device);
}
#[test]
fn test1() {
ocl()
}
#[test]
fn test2() {
ocl()
}
} |
I don't think this is an issue with this library though - all the OpenCL calls involved in this example are supposed to be thread safe at the driver level; if the driver is breaking its own safety guarantees that's a problem with the driver. |
I'm facing the issue that concurrent access of the available OpenCL devices fails. While one call gets the correct device, a parallel call gets shown no devices at all.
If I run the following tests in parallel:
most of the time only one test succeeds and yields
while the other one shows:
Executing only one test or adding a sleep before the first one, both tests succeed.
The text was updated successfully, but these errors were encountered: