Skip to content

Commit 353d1f6

Browse files
committed
fix #59
1 parent 26b32bf commit 353d1f6

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/backends/backends.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ end
182182

183183
function init(filterfuncs::Function...; kw_args...)
184184
devices = available_devices(filterfuncs...)
185-
devices = sort(devices, by = is_gpu) # prioritize gpu devices
185+
devices = sort(devices, by = x-> !is_gpu(x)) # prioritize gpu devices
186186
if isempty(devices)
187187
error("No device found for: $(join(string.(filterfuncs), " "))")
188188
end

src/backends/opencl/opencl.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ let contexts = Dict{cl.Device, CLContext}(), active_device = cl.Device[]
5656
all_contexts() = values(contexts)
5757
function current_device()
5858
if isempty(active_device)
59-
push!(active_device, CUDAnative.default_device[])
59+
devs = sort(devices(), by = x-> !is_gpu(x))
60+
push!(active_device, first(devs))
6061
end
6162
active_device[]
6263
end

0 commit comments

Comments
 (0)