You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/src/index.md
+2-3Lines changed: 2 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,10 +9,9 @@ will get a lot of functionality for free. This will allow to have multiple GPUAr
9
9
implementation for different purposes, while maximizing the ability to share code.
10
10
11
11
**This package is not intended for end users!** Instead, you should use one of the packages
12
-
that builds on GPUArrays.jl. There is currently only a single package that actively builds
13
-
on these interfaces, namely [CuArrays.jl](https://github.com/JuliaGPU/CuArrays.jl).
12
+
that builds on GPUArrays.jl such as [CUDA](https://github.com/JuliaGPU/CUDA.jl), [AMDGPU](https://github.com/JuliaGPU/AMDGPU.jl), [OneAPI](https://github.com/JuliaGPU/oneAPI.jl), or [Metal](https://github.com/JuliaGPU/Metal.jl).
14
13
15
-
In this documentation, you will find more information on the interface that you are expected
14
+
This documentation is meant for users who might wish to implement a version of GPUArrays for another GPU backend and will cover the features you will need
16
15
to implement, the functionality you gain by doing so, and the test suite that is available
17
16
to verify your implementation. GPUArrays.jl also provides a reference implementation of
18
17
these interfaces on the CPU: The `JLArray` array type uses Julia's parallel programming
You then need to provide implementations of certain methods that will be executed on the
23
-
device itself:
24
-
25
-
```@docs
26
-
GPUArrays.AbstractDeviceArray
27
-
GPUArrays.LocalMemory
28
-
GPUArrays.synchronize_threads
29
-
GPUArrays.blockidx
30
-
GPUArrays.blockdim
31
-
GPUArrays.threadidx
32
-
GPUArrays.griddim
33
21
```
34
22
23
+
This will allow your defined type (in this case `JLArray`) to use the GPUArrays interface where available.
24
+
To be able to actually use the functionality that is defined for `AbstractGPUArray`s, you need to define the backend, like so:
35
25
36
-
## Host abstractions
37
-
38
-
You should provide an array type that builds on the `AbstractGPUArray` supertype:
39
-
40
-
```@docs
41
-
AbstractGPUArray
42
26
```
43
-
44
-
First of all, you should implement operations that are expected to be defined for any
45
-
`AbstractArray` type. Refer to the Julia manual for more details, or look at the `JLArray`
46
-
reference implementation.
47
-
48
-
To be able to actually use the functionality that is defined for `AbstractGPUArray`s, you
49
-
should provide implementations of the following interfaces:
50
-
51
-
```@docs
52
-
GPUArrays.backend
27
+
import KernelAbstractions: Backend
28
+
struct CustomBackend <: KernelAbstractions.GPU
29
+
KernelAbstractions.get_backend(a::CA) where CA <: CustomArray = CustomBackend()
53
30
```
31
+
32
+
There are numerous examples of potential interfaces for GPUArrays, such as with [JLArrays](https://github.com/JuliaGPU/GPUArrays.jl/blob/master/lib/JLArrays/src/JLArrays.jl), [CuArrays](https://github.com/JuliaGPU/CUDA.jl/blob/master/src/gpuarrays.jl), and [ROCArrays](https://github.com/JuliaGPU/AMDGPU.jl/blob/master/src/gpuarrays.jl).
0 commit comments