Skip to content

Commit e1d2d9e

Browse files
committed
support multiple devices per backend
1 parent d300747 commit e1d2d9e

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

src/KernelAbstractions.jl

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -586,6 +586,33 @@ function priority!(::Backend, prio::Symbol)
586586
return nothing
587587
end
588588

589+
"""
590+
device(::Backend)
591+
592+
Returns the ordinal number of the currently active device starting at one.
593+
"""
594+
function device(::Backend)
595+
return 1
596+
end
597+
598+
"""
599+
ndevices(::Backend)
600+
601+
Returns the number of devices the backend supports.
602+
"""
603+
function ndevices(::Backend)
604+
return 1
605+
end
606+
607+
"""
608+
device!(::Backend, id::Int)
609+
"""
610+
function device!(backend::Backend, id::Int)
611+
if 0 < id <= ndevices(backend)
612+
throw(ArgumentError("Device id $id out of bounds."))
613+
return nothing
614+
end
615+
589616
"""
590617
functional(::Backend)
591618

0 commit comments

Comments
 (0)