Skip to content

Commit 339772e

Browse files
committed
make init_GPU_workers safe to run w/o GPU
1 parent ffd16f4 commit 339772e

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/util.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,10 @@ init_GPU_workers(n=nothing) = init_GPU_workers(Val(PARALLEL_WORKER_TYPE), n)
417417

418418
function init_GPU_workers(::Val{:MPI}, n=nothing; stdout_to_master=false, stderr_to_master=false)
419419

420+
if !CuArrays.functional()
421+
return
422+
end
423+
420424
!MPI.Initialized() && MPI.Init()
421425
size = MPI.Comm_size(MPI.COMM_WORLD)
422426
rank = MPI.Comm_rank(MPI.COMM_WORLD)
@@ -436,6 +440,10 @@ init_GPU_workers(n=nothing) = init_GPU_workers(Val(PARALLEL_WORKER_TYPE), n)
436440

437441
function init_GPU_workers(::Val{:procs}, n=nothing)
438442

443+
if !CuArrays.functional()
444+
return
445+
end
446+
439447
if n == nothing
440448
n = length(devices())
441449
end

0 commit comments

Comments
 (0)