File tree Expand file tree Collapse file tree 1 file changed +23
-1
lines changed
Expand file tree Collapse file tree 1 file changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -162,13 +162,35 @@ function __init__()
162162
163163 try
164164 zeInit (0 )
165- functional[] = true
166165 catch err
166+ # Handle the specific case where no oneAPI device is available
167+ if err isa ZeError && err. code == RESULT_ERROR_UNINITIALIZED
168+ functional[] = false
169+ return
170+ end
171+ # For other errors, still report them as errors
167172 @error " Failed to initialize oneAPI" exception= (err,catch_backtrace ())
168173 functional[] = false
169174 return
170175 end
171176
177+ # Check if there are actually any drivers/devices available
178+ try
179+ drv_count = Ref {UInt32} (0 )
180+ zeDriverGet (drv_count, C_NULL )
181+ if drv_count[] == 0
182+ @info " oneAPI initialized but no drivers found. oneAPI.jl will not be functional."
183+ functional[] = false
184+ return
185+ end
186+ catch err
187+ @error " Failed to enumerate oneAPI drivers" exception= (err,catch_backtrace ())
188+ functional[] = false
189+ return
190+ end
191+
192+ functional[] = true
193+
172194 validation_layer[] = parse (Bool, get (ENV , " ZE_ENABLE_VALIDATION_LAYER" , " false" ))
173195 parameter_validation[] = parse (Bool, get (ENV , " ZE_ENABLE_PARAMETER_VALIDATION" , " false" ))
174196end
You can’t perform that action at this time.
0 commit comments