Skip to content

Commit 0c3e037

Browse files
committed
Document all public symbols [skip tests]
1 parent 3d9bb2a commit 0c3e037

File tree

13 files changed

+408
-74
lines changed

13 files changed

+408
-74
lines changed

.github/workflows/Test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ jobs:
125125
- uses: actions/checkout@v5
126126
- uses: julia-actions/setup-julia@v2
127127
with:
128-
version: '1.10'
128+
version: '1.11'
129129
- name: Develop packages
130130
run: |
131131
julia -e "

docs/Project.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
[deps]
22
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
3+
GPUArrays = "0c68f7d7-f131-5f86-a1c3-88cf8149b2d7"
4+
GPUArraysCore = "46192b85-c4d5-4398-a991-12ede77f4527"
5+
JLArrays = "27aeb0d3-9eb9-45fb-866b-73c2ecf80fcb"
36

47
[compact]
58
Documenter = "1.8"
9+
10+
[sources]
11+
GPUArrays = {path = ".."}
12+
GPUArraysCore = {path = "../lib/GPUArraysCore"}
13+
JLArrays = {path = "../lib/JLArrays"}

docs/make.jl

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
using Documenter, GPUArrays
1+
using Documenter, GPUArrays, GPUArraysCore, JLArrays
22

33
function main()
44
makedocs(
5-
modules = [GPUArrays],
5+
modules = [GPUArrays, GPUArraysCore, JLArrays],
66
format = Documenter.HTML(
77
# Use clean URLs on CI
88
prettyurls = get(ENV, "CI", nothing) == "true",
@@ -11,19 +11,15 @@ function main()
1111
),
1212
sitename = "GPUArrays.jl",
1313
pages = [
14-
"Home" => "index.md",
15-
"Interface" => "interface.md",
16-
"Functionality" => [
17-
"functionality/host.md",
18-
"functionality/device.md",
19-
],
20-
"Test suite" => "testsuite.md",
14+
"Home" => "index.md",
15+
"interface.md",
16+
"api.md",
2117
],
2218
doctest = true,
2319
warnonly = [:missing_docs],
2420
)
2521

26-
deploydocs(
22+
return deploydocs(
2723
repo = "github.com/JuliaGPU/GPUArrays.jl.git"
2824
)
2925
end

docs/src/api.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# API Reference
2+
3+
## GPUArrays
4+
5+
### Public
6+
7+
```@autodocs
8+
Modules = [GPUArrays]
9+
Private = false
10+
```
11+
12+
### Internals
13+
14+
```@autodocs
15+
Modules = [GPUArrays]
16+
Public = false
17+
```
18+
19+
## GPUArraysCore
20+
21+
### Public
22+
23+
```@autodocs
24+
Modules = [GPUArraysCore]
25+
Private = false
26+
```
27+
28+
### Internals
29+
30+
```@autodocs
31+
Modules = [GPUArraysCore]
32+
Public = false
33+
```
34+
35+
## JLArrays
36+
37+
### Public
38+
39+
```@autodocs
40+
Modules = [JLArrays]
41+
Private = false
42+
```
43+
44+
### Internals
45+
46+
```@autodocs
47+
Modules = [JLArrays]
48+
Public = false
49+
```

docs/src/functionality/device.md

Lines changed: 0 additions & 3 deletions
This file was deleted.

docs/src/functionality/host.md

Lines changed: 0 additions & 3 deletions
This file was deleted.

docs/src/interface.md

Lines changed: 41 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Interface
22

3-
To extend the above functionality to a new array type, you should use the types and
3+
To extend the GPUArrays functionality to a new array type, you should use the types and
44
implement the interfaces listed on this page. GPUArrays is designed around having two
55
different array types to represent a GPU array: one that exists only on the host, and
66
one that actually can be instantiated on the device (i.e. in kernels).
@@ -31,9 +31,45 @@ KernelAbstractions.get_backend(a::CA) where CA <: CustomArray = CustomBackend()
3131

3232
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).
3333

34-
## Caching Allocator
34+
## Device abstractions
3535

36-
```@docs
37-
GPUArrays.@cached
38-
GPUArrays.@uncached
36+
!!! warning
37+
Work in progress.
38+
39+
## Test suite
40+
41+
GPUArrays provides an extensive test suite that covers all of the functionality that should
42+
be available after implementing the required interfaces. This test suite is part of this
43+
package, but for dependency reasons it is not available when importing the package. Instead,
44+
you should include the code from your `runtests.jl` as follows:
45+
46+
```julia
47+
import GPUArrays
48+
gpuarrays = pathof(GPUArrays)
49+
gpuarrays_root = dirname(dirname(gpuarrays))
50+
include(joinpath(gpuarrays_root, "test", "testsuite.jl"))
51+
```
52+
53+
With this set-up, you can run the test suite like this:
54+
55+
```julia
56+
TestSuite.test(MyGPUArrayType)
57+
```
58+
59+
If you don't want to run the whole suite, you can also run parts of it:
60+
61+
```julia
62+
T = JLArray
63+
GPUArrays.allowscalar(false) # fail tests when slow indexing path into Array type is used.
64+
65+
TestSuite.test_gpuinterface(T) # interface functions like gpu_call, threadidx, etc
66+
TestSuite.test_base(T) # basic functionality like launching a kernel on the GPU and Base operations
67+
TestSuite.test_blas(T) # tests the blas interface
68+
TestSuite.test_broadcasting(T) # tests the broadcasting implementation
69+
TestSuite.test_construction(T) # tests all kinds of different ways of constructing the array
70+
TestSuite.test_linalg(T) # linalg function tests
71+
TestSuite.test_mapreduce(T) # mapreduce sum, etc
72+
TestSuite.test_indexing(T) # indexing tests
73+
TestSuite.test_random(T) # randomly constructed arrays
74+
TestSuite.test_io(T)
3975
```

docs/src/testsuite.md

Lines changed: 0 additions & 37 deletions
This file was deleted.

lib/GPUArraysCore/src/GPUArraysCore.jl

Lines changed: 45 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,26 +13,69 @@ export AbstractGPUArray, AbstractGPUVector, AbstractGPUMatrix, AbstractGPUVecOrM
1313
AbstractGPUArray{T, N} <: DenseArray{T, N}
1414
1515
Supertype for `N`-dimensional GPU arrays (or array-like types) with elements of type `T`.
16-
Instances of this type are expected to live on the host, see [`AbstractDeviceArray`](@ref)
16+
Instances of this type are expected to live on the host, see `AbstractDeviceArray`
1717
for device-side objects.
1818
"""
1919
abstract type AbstractGPUArray{T, N} <: DenseArray{T, N} end
2020

21+
"""
22+
AbstractGPUVector{T}
23+
24+
Shortcut for `AbstractGPUArray{T, 1}`.
25+
"""
2126
const AbstractGPUVector{T} = AbstractGPUArray{T, 1}
27+
28+
"""
29+
AbstractGPUMatrixT}
30+
31+
Shortcut for `AbstractGPUArray{T, 2}`.
32+
"""
2233
const AbstractGPUMatrix{T} = AbstractGPUArray{T, 2}
34+
35+
"""
36+
AbstractGPUVecOrMat{T}
37+
38+
Shortcut for `Union{AbstractGPUArray{T, 1}, AbstractGPUArray{T, 2}}`.
39+
"""
2340
const AbstractGPUVecOrMat{T} = Union{AbstractGPUArray{T, 1}, AbstractGPUArray{T, 2}}
2441

2542
# convenience aliases for working with wrapped arrays
43+
44+
"""
45+
WrappedGPUArray{T, N}
46+
47+
Convenience alias for working with wrapped arrays from [Adapt.jl](https://github.com/JuliaGPU/Adapt.jl).
48+
"""
2649
const WrappedGPUArray{T,N} = WrappedArray{T,N,AbstractGPUArray,AbstractGPUArray{T,N}}
50+
51+
"""
52+
AnyGPUArray{T, N}
53+
54+
Shortcut for `Union{AbstractGPUArray{T,N}, WrappedGPUArray{T,N}}`.
55+
"""
2756
const AnyGPUArray{T,N} = Union{AbstractGPUArray{T,N}, WrappedGPUArray{T,N}}
57+
58+
"""
59+
AnyGPUVector{T}
60+
61+
Shortcut for `AnyGPUArray{T, 1}`.
62+
"""
2863
const AnyGPUVector{T} = AnyGPUArray{T, 1}
64+
65+
"""
66+
AnyGPUMatrix{T}
67+
68+
Shortcut for `AnyGPUArray{T, 2}`.
69+
"""
2970
const AnyGPUMatrix{T} = AnyGPUArray{T, 2}
3071

3172

3273
## broadcasting
3374

3475
"""
35-
Abstract supertype for GPU array styles. The `N` parameter is the dimensionality.
76+
AbstractGPUArrayStyle{N} <: Base.Broadcast.AbstractArrayStyle{N}
77+
78+
Abstract supertype for GPU array broadcasting styles. The `N` parameter is the dimensionality.
3679
3780
Downstream implementations should provide a concrete array style type that inherits from
3881
this supertype.

0 commit comments

Comments
 (0)