diff --git a/Project.toml b/Project.toml index bcf2709a..fc7cd1bc 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "oneAPI" uuid = "8f75cd03-7ff8-4ecb-9b8f-daf728133b1b" -version = "2.5.0" -authors = ["Tim Besard "] +version = "2.5.1" +authors = ["Tim Besard ", "Alexis Montoison", "Michel Schanen "] [deps] AbstractFFTs = "621f4979-c628-5d54-868e-fcf4e3e8185c" diff --git a/lib/level-zero/oneL0.jl b/lib/level-zero/oneL0.jl index 7227a1ba..f9697029 100644 --- a/lib/level-zero/oneL0.jl +++ b/lib/level-zero/oneL0.jl @@ -162,13 +162,35 @@ function __init__() try zeInit(0) - functional[] = true catch err + # Handle the specific case where no oneAPI device is available + if err isa ZeError && err.code == RESULT_ERROR_UNINITIALIZED + functional[] = false + return + end + # For other errors, still report them as errors @error "Failed to initialize oneAPI" exception=(err,catch_backtrace()) functional[] = false return end + # Check if there are actually any drivers/devices available + try + drv_count = Ref{UInt32}(0) + zeDriverGet(drv_count, C_NULL) + if drv_count[] == 0 + @info "oneAPI initialized but no drivers found. oneAPI.jl will not be functional." + functional[] = false + return + end + catch err + @error "Failed to enumerate oneAPI drivers" exception = (err, catch_backtrace()) + functional[] = false + return + end + + functional[] = true + validation_layer[] = parse(Bool, get(ENV, "ZE_ENABLE_VALIDATION_LAYER", "false")) parameter_validation[] = parse(Bool, get(ENV, "ZE_ENABLE_PARAMETER_VALIDATION", "false")) end