Skip to content
This repository was archived by the owner on Sep 27, 2021. It is now read-only.

Commit 5c74582

Browse files
committed
add filter device functionality
1 parent 9a4cf7f commit 5c74582

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

src/CLArrays.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ include("context.jl")
1717
include("compilation.jl")
1818
include("3rdparty.jl")
1919

20-
export CLArray, gpu_call
20+
export CLArray, gpu_call, is_gpu, is_cpu
2121

2222
end # module

src/compilation.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ using Sugar: isfunction
1010
using Base: tail
1111

1212

13-
1413
function _gpu_call(f, A::CLArray, args::Tuple, blocks_threads::Tuple{T, T}) where T <: NTuple{N, Integer} where N
1514
ctx = context(A)
1615
_args = (KernelState(), args...) # CLArrays "state"

src/device.jl

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
import GPUArrays: is_gpu, is_cpu, name, threads, blocks, global_memory
22
import GPUArrays: supports_double, local_memory
33

4-
function devices()
5-
filter(cl.devices()) do dev
4+
5+
function devices(filter_funcs...)
6+
sort(filter(cl.devices()) do dev
67
# These drivers have some problems - TODO figure out if we are the problem
7-
!contains(cl.info(dev, :version), "(Build 10)") # intels experimental 2.1 driver
8-
end
8+
!contains(cl.info(dev, :version), "(Build 10)") && # intels experimental 2.1 driver
9+
!any(f-> !f(dev), filter_funcs)
10+
end, by = x-> !is_gpu(x)) # now gpu devices come first
911
end
1012

1113
is_gpu(dev::cl.Device) = cl.info(dev, :device_type) == :gpu

0 commit comments

Comments
 (0)