Skip to content

Commit ffdad12

Browse files
authored
Merge pull request #229 from JuliaGPU/tb/cleanup
Large clean-up
2 parents 7157545 + 5416376 commit ffdad12

36 files changed

+931
-1087
lines changed

.appveyor.yml

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

.gitlab-ci.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@ julia:nightly:
3838
# that means we have to manually install CuArrays' test dependencies though.
3939

4040
cuarrays:
41-
extends: .julia:1.2
41+
extends:
42+
- .julia:1.3
43+
- .test
4244
tags:
4345
- nvidia
4446
image: nvidia/cuda:10.1-devel
@@ -51,13 +53,13 @@ cuarrays:
5153
- julia --project=$CUARRAYS -e 'using Pkg;
5254
Pkg.instantiate();
5355
Pkg.add(["FFTW", "ForwardDiff", "FillArrays"])'
54-
- JULIA_LOAD_PATH=".:$CUARRAYS::" julia $CUARRAYS/test/runtests.jl
56+
- JULIA_LOAD_PATH=".:$CUARRAYS::" julia --code-coverage $CUARRAYS/test/runtests.jl
5557
allow_failure: true
5658

5759

5860
# other tasks
5961

6062
coverage:
6163
extends:
62-
- .julia:1.2
64+
- .julia:1.3
6365
- .coverage

.travis.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,15 @@ language: julia
33
os:
44
- linux
55
- osx
6+
- windows
67

78
dist: trusty
89

910
julia:
1011
- 1.0
12+
- 1.1
13+
- 1.2
14+
- 1.3
1115
- nightly
1216

1317
matrix:
@@ -20,7 +24,7 @@ notifications:
2024
jobs:
2125
include:
2226
- stage: "Documentation"
23-
julia: 1.0
27+
julia: 1.3
2428
os: linux
2529
script:
2630
- julia --project=docs/ -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd()));

README.md

Lines changed: 18 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -1,104 +1,27 @@
11
# GPUArrays
22

3-
*Abstract GPU Array package for Julia's various GPU backends.*
3+
*Reusable GPU array functionality for Julia's various GPU backends.*
44

5-
[![][docs-stable-img]][docs-stable-url] [![][docs-dev-img]][docs-dev-url] [![codecov](https://codecov.io/gh/JuliaGPU/GPUArrays.jl/branch/master/graph/badge.svg)](https://codecov.io/gh/JuliaGPU/GPUArrays.jl)
5+
| **Documentation** | **Build Status** |
6+
|:-------------------------------------------------------------------------:|:-------------------------------------------------------------------------------------------:|
7+
| [![][docs-stable-img]][docs-stable-url] [![][docs-dev-img]][docs-dev-url] | [![][gitlab-img]][gitlab-url] [![][travis-img]][travis-url] [![][codecov-img]][codecov-url] |
68

7-
[docs-stable-img]: https://img.shields.io/badge/docs-stable-blue.svg
8-
[docs-stable-url]: http://JuliaGPU.github.io/GPUArrays.jl/stable/
9-
[docs-dev-img]: https://img.shields.io/badge/docs-dev-blue.svg
10-
[docs-dev-url]: http://JuliaGPU.github.io/GPUArrays.jl/dev/
11-
12-
13-
[Benchmarks](https://github.com/JuliaGPU/GPUBenchmarks.jl/blob/master/results/results.md)
14-
15-
This package is the counterpart of Julia's `Base.AbstractArray` interface, but
16-
for GPU array types. Currently, you either need to install
17-
[CLArrays](https://github.com/JuliaGPU/CLArrays.jl) or
18-
[CuArrays](https://github.com/JuliaGPU/CuArrays.jl) for a concrete
19-
implementation.
20-
21-
22-
# Why another GPU array package in yet another language?
23-
24-
Julia offers great advantages for programming the GPU.
25-
This [blog post](http://mikeinnes.github.io/2017/08/24/cudanative.html) outlines a few of those.
26-
27-
E.g., we can use Julia's JIT to generate optimized kernels for map/broadcast operations.
28-
29-
This works even for things like complex arithmetic, since we can compile what's already in Julia Base.
30-
This isn't restricted to Julia Base, GPUArrays works with all kind of user defined types and functions!
31-
32-
GPUArrays relies heavily on Julia's dot broadcasting.
33-
The great thing about dot broadcasting in Julia is, that it
34-
[actually fuses operations syntactically](http://julialang.org/blog/2017/01/moredots), which is vital for performance on the GPU.
35-
E.g.:
36-
37-
```Julia
38-
out .= a .+ b ./ c .+ 1
39-
#turns into this one broadcast (map):
40-
broadcast!(out, a, b, c) do a, b, c
41-
a + b / c + 1
42-
end
43-
```
44-
45-
Will result in one GPU kernel call to a function that combines the operations without any extra allocations.
46-
This allows GPUArrays to offer a lot of functionality with minimal code.
47-
48-
Also, when compiling Julia for the GPU, we can use all the cool features from Julia, e.g.
49-
higher order functions, multiple dispatch, meta programming and generated functions.
50-
Checkout the examples, to see how this can be used to emit specialized code while not losing flexibility:
51-
52-
[<img src="https://raw.githubusercontent.com/JuliaGPU/GPUBenchmarks.jl/master/results/plots/juliaset_result.png" height="150">](https://github.com/JuliaGPU/GPUBenchmarks.jl/blob/master/results/results.md)
53-
[<img src="https://user-images.githubusercontent.com/1010467/40832645-12ca1f50-658c-11e8-9fb4-170871db2499.png" height="150">](https://juliagpu.github.io/GPUShowcases.jl/latest/)
54-
55-
In theory, we could go as far as inspecting user defined callbacks (we can get the complete AST), count operations and estimate register usage and use those numbers to optimize our kernels!
9+
[gitlab-img]: https://gitlab.com/JuliaGPU/CuArrays.jl/badges/master/pipeline.svg
10+
[gitlab-url]: https://gitlab.com/JuliaGPU/CuArrays.jl/commits/master
5611

12+
[travis-img]: https://api.travis-ci.org/JuliaGPU/GPUArrays.jl.svg?branch=master
13+
[travis-url]: https://travis-ci.org/JuliaGPU/GPUArrays.jl
5714

58-
# Scope
59-
60-
Interface offered for all backends:
61-
62-
```Julia
63-
map(f, ::GPUArray...)
64-
map!(f, dest::GPUArray, ::GPUArray...)
65-
66-
broadcast(f, ::GPUArray...)
67-
broadcast!(f, dest::GPUArray, ::GPUArray...)
68-
69-
mapreduce(f, op, ::GPUArray...) # so support for sum/mean/minimum etc comes for free
70-
71-
getindex, setindex!, push!, append!, splice!, append!, copy!, reinterpret, convert
72-
73-
From (CL/CU)FFT
74-
fft!/fft/ifft/ifft! and the matching plan_fft functions.
75-
From (CL/CU)BLAS
76-
gemm!, scal!, gemv! and the high level functions that are implemented with these, like A * B, A_mul_B!, etc.
77-
```
78-
79-
# Currently supported subset of Julia Code
80-
81-
Working with immutable isbits (not containing pointers) type should be completely supported
82-
with non-allocating code (so no constructs like `x = [1, 2, 3]`). Note that tuples are isbits, so this works x = (1, 2, 3).
83-
Transpiler/OpenCL has problems with putting GPU arrays on the gpu into a struct - so no views and actually no multidimensional indexing. For that `size` is needed which would need to be part of the array struct. A fix for that is in sight, though.
84-
85-
# JLArray
86-
87-
The `JLArray` is a `GPUArray` which doesn't run on the GPU and rather uses Julia's async constructs as its backend. It serves as a fallback for testing compatibility with `GPUArray`s in cases where a GPU does not exist and as a reference implementation. It is constructed as follows:
88-
89-
```julia
90-
gA = JLArray(A)
91-
```
92-
93-
# TODO / up for grabs
94-
95-
* stencil operations, convolutions
96-
* more tests and benchmarks
97-
* tests, that only switch the backend but use the same code
98-
* performance improvements!!
99-
* interop between OpenCL, CUDA and OpenGL is there as a protype, but needs proper hooking up via `Base.copy!` / `convert`
15+
[codecov-img]: https://codecov.io/gh/JuliaGPU/CuArrays.jl/branch/master/graph/badge.svg
16+
[codecov-url]: https://codecov.io/gh/JuliaGPU/CuArrays.jl
10017

18+
[docs-stable-img]: https://img.shields.io/badge/docs-stable-blue.svg
19+
[docs-stable-url]: http://JuliaGPU.github.io/GPUArrays.jl/stable/
10120

102-
# Installation
21+
[docs-dev-img]: https://img.shields.io/badge/docs-dev-blue.svg
22+
[docs-dev-url]: http://JuliaGPU.github.io/GPUArrays.jl/dev/
10323

104-
See CuArrays or CLArrays for installation instructions.
24+
This package is the counterpart of Julia's `AbstractArray` interface, but for GPU array
25+
types: It provides functionality and tooling to speed-up development of new GPU array types.
26+
**This package is not intended for end users!** Instead, you should use one of the packages
27+
that builds on GPUArrays.jl, such as [CuArrays](https://github.com/JuliaGPU/CuArrays.jl).

docs/Manifest.toml

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# This file is machine-generated - editing it directly is not advised
2+
3+
[[Base64]]
4+
uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
5+
6+
[[Dates]]
7+
deps = ["Printf"]
8+
uuid = "ade2ca70-3891-5945-98fb-dc099432e06a"
9+
10+
[[Distributed]]
11+
deps = ["Random", "Serialization", "Sockets"]
12+
uuid = "8ba89e20-285c-5b6f-9357-94700520ee1b"
13+
14+
[[DocStringExtensions]]
15+
deps = ["LibGit2", "Markdown", "Pkg", "Test"]
16+
git-tree-sha1 = "88bb0edb352b16608036faadcc071adda068582a"
17+
uuid = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
18+
version = "0.8.1"
19+
20+
[[Documenter]]
21+
deps = ["Base64", "Dates", "DocStringExtensions", "InteractiveUtils", "JSON", "LibGit2", "Logging", "Markdown", "REPL", "Test", "Unicode"]
22+
git-tree-sha1 = "51f0c7df46abb9c07d80e529718951e634670afb"
23+
uuid = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
24+
version = "0.24.4"
25+
26+
[[InteractiveUtils]]
27+
deps = ["Markdown"]
28+
uuid = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
29+
30+
[[JSON]]
31+
deps = ["Dates", "Mmap", "Parsers", "Unicode"]
32+
git-tree-sha1 = "b34d7cef7b337321e97d22242c3c2b91f476748e"
33+
uuid = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
34+
version = "0.21.0"
35+
36+
[[LibGit2]]
37+
uuid = "76f85450-5226-5b5a-8eaa-529ad045b433"
38+
39+
[[Libdl]]
40+
uuid = "8f399da3-3557-5675-b5ff-fb832c97cbdb"
41+
42+
[[Logging]]
43+
uuid = "56ddb016-857b-54e1-b83d-db4d58db5568"
44+
45+
[[Markdown]]
46+
deps = ["Base64"]
47+
uuid = "d6f4376e-aef5-505a-96c1-9c027394607a"
48+
49+
[[Mmap]]
50+
uuid = "a63ad114-7e13-5084-954f-fe012c677804"
51+
52+
[[Parsers]]
53+
deps = ["Dates", "Test"]
54+
git-tree-sha1 = "0139ba59ce9bc680e2925aec5b7db79065d60556"
55+
uuid = "69de0a69-1ddd-5017-9359-2bf0b02dc9f0"
56+
version = "0.3.10"
57+
58+
[[Pkg]]
59+
deps = ["Dates", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "REPL", "Random", "SHA", "Test", "UUIDs"]
60+
uuid = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
61+
62+
[[Printf]]
63+
deps = ["Unicode"]
64+
uuid = "de0858da-6303-5e67-8744-51eddeeeb8d7"
65+
66+
[[REPL]]
67+
deps = ["InteractiveUtils", "Markdown", "Sockets"]
68+
uuid = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb"
69+
70+
[[Random]]
71+
deps = ["Serialization"]
72+
uuid = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
73+
74+
[[SHA]]
75+
uuid = "ea8e919c-243c-51af-8825-aaa63cd721ce"
76+
77+
[[Serialization]]
78+
uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b"
79+
80+
[[Sockets]]
81+
uuid = "6462fe0b-24de-5631-8697-dd941f90decc"
82+
83+
[[Test]]
84+
deps = ["Distributed", "InteractiveUtils", "Logging", "Random"]
85+
uuid = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
86+
87+
[[UUIDs]]
88+
deps = ["Random", "SHA"]
89+
uuid = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"
90+
91+
[[Unicode]]
92+
uuid = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5"

docs/make.jl

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,30 @@
11
using Documenter, GPUArrays
22

3-
makedocs(
4-
modules = [GPUArrays],
5-
format = Documenter.HTML(prettyurls = get(ENV, "CI", nothing) == "true"),
6-
sitename = "GPUArrays.jl",
7-
pages = [
8-
"Home" => "index.md",
9-
],
10-
doctest = true
11-
)
3+
function main()
4+
makedocs(
5+
modules = [GPUArrays],
6+
format = Documenter.HTML(
7+
# Use clean URLs on CI
8+
prettyurls = get(ENV, "CI", nothing) == "true",
9+
assets = ["assets/favicon.ico"],
10+
analytics = "UA-154489943-6",
11+
),
12+
sitename = "GPUArrays.jl",
13+
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",
21+
],
22+
doctest = true,
23+
)
1224

13-
deploydocs(
14-
repo = "github.com/JuliaGPU/GPUArrays.jl.git"
15-
)
25+
deploydocs(
26+
repo = "github.com/JuliaGPU/GPUArrays.jl.git"
27+
)
28+
end
29+
30+
isinteractive() || main()

docs/src/assets/favicon.ico

15 KB
Binary file not shown.

docs/src/assets/logo.png

74.1 KB
Loading

docs/src/functionality/device.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# `AbstractDeviceArray`
2+
3+
TODO: describe functionality

docs/src/functionality/host.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# `AbstractGPUArray`
2+
3+
TODO: describe functionality

0 commit comments

Comments
 (0)