Skip to content

Commit 195e48a

Browse files
committed
support multiple devices per backend
1 parent f198f5c commit 195e48a

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
@@ -546,6 +546,33 @@ function priority!(::Backend, prio::Symbol)
546546
return nothing
547547
end
548548

549+
"""
550+
device(::Backend)
551+
552+
Returns the ordinal number of the currently active device starting at one.
553+
"""
554+
function device(::Backend)
555+
return 1
556+
end
557+
558+
"""
559+
ndevices(::Backend)
560+
561+
Returns the number of devices the backend supports.
562+
"""
563+
function ndevices(::Backend)
564+
return 1
565+
end
566+
567+
"""
568+
device!(::Backend, id::Int)
569+
"""
570+
function device!(backend::Backend, id::Int)
571+
if 0 < id <= ndevices(backend)
572+
throw(ArgumentError("Device id $id out of bounds."))
573+
return nothing
574+
end
575+
549576
"""
550577
functional(::Backend)
551578

0 commit comments

Comments
 (0)