Skip to content

Commit

Permalink
executor error handling for gpu cases
Browse files Browse the repository at this point in the history
  • Loading branch information
youwuyou committed Jun 2, 2024
1 parent fff44d5 commit 4ec0a30
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/base/Executor.jl
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,13 @@ function create(executor_type::Symbol; device_id::Integer = 0)
if executor_type == :reference || executor_type == :omp
return GkoExecutor(executor_type)
else
return GkoExecutor(executor_type, device_id = device_id)
# on GPU
num_device = get_num_devices(executor_type)
if num_device > 0
return GkoExecutor(executor_type, device_id = device_id)
else
throw(ArgumentError("No device available for $executor_type, num_device = $num_device"))
end
end
end

Expand Down

0 comments on commit 4ec0a30

Please sign in to comment.