Skip to content

Commit fbef0d9

Browse files
make NNlibCUDA an extension (#492)
* make NNlibCUDA an extension * cuDNN extension * update workflows * uncomment when 1.10 is out * cleanup * cleanup * test Project.toml * cleanup * rethink extensions * batchnorm * cleanup
1 parent 23e0611 commit fbef0d9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+180
-300
lines changed

.buildkite/pipeline.yml

Lines changed: 26 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,53 @@
11
steps:
2-
- label: "GPU julia v1.6"
2+
- label: ":julia: Julia {{matrix.julia}} + CUDA GPU"
33
plugins:
44
- JuliaCI/julia#v1:
5-
version: "1.6"
6-
- JuliaCI/julia-test#v1: ~
5+
version: "{{matrix.julia}}"
6+
- JuliaCI/julia-test#v1:
7+
test_args: "--quickfail"
78
- JuliaCI/julia-coverage#v1:
89
codecov: true
910
dirs:
1011
- src
11-
# commands:
12-
# - julia --project=test -e """
13-
# Pkg.develop(url = \"https://github.com/FluxML/NNlibCUDA.jl\")
14-
# Pkg.instantiate()
15-
# Pkg.build()
16-
# Pkg.status()
17-
# Pkg.test()
18-
# Pkg.test(\"NNlibCUDA\")
19-
# """
12+
- ext
2013
agents:
2114
queue: "juliagpu"
2215
cuda: "*"
2316
env:
2417
NNLIB_TEST_CUDA: true
18+
if: build.message !~ /\[skip tests\]/
2519
timeout_in_minutes: 60
20+
matrix:
21+
setup:
22+
julia:
23+
# - "1.9" # uncomment when 1.10 is out
24+
- "1"
25+
- "nightly"
26+
adjustments:
27+
- with:
28+
julia: "nightly"
29+
soft_fail: true
2630

27-
- label: "GPU julia v1"
31+
- label: ":julia: Julia 1 + AMD GPU"
2832
plugins:
2933
- JuliaCI/julia#v1:
3034
version: "1"
31-
- JuliaCI/julia-test#v1: ~
35+
- JuliaCI/julia-test#v1:
3236
- JuliaCI/julia-coverage#v1:
3337
codecov: true
3438
dirs:
3539
- src
40+
- ext
3641
agents:
3742
queue: "juliagpu"
38-
cuda: "*"
39-
env:
40-
NNLIB_TEST_CUDA: true
43+
rocm: "*"
44+
rocmgpu: "*"
4145
timeout_in_minutes: 60
46+
env:
47+
JULIA_AMDGPU_CORE_MUST_LOAD: "1"
48+
JULIA_AMDGPU_HIP_MUST_LOAD: "1"
49+
NNLIB_TEST_AMDGPU: true
50+
4251

4352
- label: "Benchmarks"
4453
plugins:
@@ -55,38 +64,5 @@ steps:
5564
if: build.pull_request.labels includes "benchmark"
5665
timeout_in_minutes: 30
5766

58-
- label: "AMDGPU - Julia 1.9"
59-
plugins:
60-
- JuliaCI/julia#v1:
61-
version: 1.9-nightly
62-
- JuliaCI/julia-test#v1:
63-
- JuliaCI/julia-coverage#v1:
64-
codecov: true
65-
dirs:
66-
- src
67-
- ext
68-
agents:
69-
queue: "juliagpu"
70-
rocm: "*"
71-
rocmgpu: "*"
72-
timeout_in_minutes: 60
73-
env:
74-
JULIA_AMDGPU_CORE_MUST_LOAD: "1"
75-
JULIA_AMDGPU_HIP_MUST_LOAD: "1"
76-
NNLIB_TEST_AMDGPU: true
77-
78-
# - label: "GPU julia nightly"
79-
# plugins:
80-
# - JuliaCI/julia#v1:
81-
# version: "nightly"
82-
# - JuliaCI/julia-test#v1: ~
83-
# - JuliaCI/julia-coverage#v1:
84-
# codecov: true
85-
# dirs:
86-
# - src
87-
# agents:
88-
# queue: "juliagpu"
89-
# cuda: "*"
90-
# timeout_in_minutes: 60
9167
env:
9268
SECRET_CODECOV_TOKEN: "IlEMvDI6RciJQr5eX7qBBpHYFAe8+Svf3lNJh9gZi0MeJZQvMZWzHfW/lVncA9d9K+gDBBTv/zwqF86xOaIFLuACNdcGZiGgHS+NGeXN5CEppjqLnqKuaeHmLgJ43jygxRwgF88LhwTGcHG7pmESIp1Bn3Jd23UUv4t8hJLBDF+KJLZMefzCXnEVzfwJYxhJktnKJPA4dOv59w33Vj1x5uCYZbQlLP54IJPBm8UGdXS+JrUX8Z7lhxbkJUi6c+R6cvVBw27uRjF0pUJY26mt1frx8MzTGTOweXTpi+Kc5JhzlokMlan17j6T/b7qMC13IuKopfqu1GhkSBQD3ZhQqA==;U2FsdGVkX19l7JMB48k4oJHLoaqC7/MmvQWmaiBxRN472ZC6AcQ0uCBRy6Fw8tI0YcjIxKDScaBnJ2v/deOfhg=="

.github/workflows/CompatHelper.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,16 @@ jobs:
1010
CompatHelper:
1111
runs-on: ubuntu-latest
1212
steps:
13+
- name: Check if Julia is already available in the PATH
14+
id: julia_in_path
15+
run: which julia
16+
continue-on-error: true
17+
- name: Install Julia, but only if it is not already available in the PATH
18+
uses: julia-actions/setup-julia@v1
19+
with:
20+
version: '1'
21+
arch: ${{ runner.arch }}
22+
if: steps.julia_in_path.outcome != 'success'
1323
- name: "Add the General registry via Git"
1424
run: |
1525
import Pkg
@@ -32,4 +42,4 @@ jobs:
3242
env:
3343
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3444
COMPATHELPER_PRIV: ${{ secrets.DOCUMENTER_KEY }}
35-
# COMPATHELPER_PRIV: ${{ secrets.COMPATHELPER_PRIV }}
45+
# COMPATHELPER_PRIV: ${{ secrets.COMPATHELPER_PRIV }}

.github/workflows/TagBot.yml

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,33 @@
11
name: TagBot
22
on:
3-
issue_comment: # https://discourse.julialang.org/t/ann-required-updates-to-tagbot-yml/49249
3+
issue_comment:
44
types:
55
- created
6+
workflow_dispatch:
7+
inputs:
8+
lookback:
9+
default: 3
10+
permissions:
11+
actions: read
12+
checks: read
13+
contents: write
14+
deployments: read
15+
issues: read
16+
discussions: read
17+
packages: read
18+
pages: read
19+
pull-requests: read
20+
repository-projects: read
21+
security-events: read
22+
statuses: read
623
jobs:
724
TagBot:
25+
if: github.event_name == 'workflow_dispatch' || github.actor == 'JuliaTagBot'
826
runs-on: ubuntu-latest
927
steps:
1028
- uses: JuliaRegistries/TagBot@v1
1129
with:
1230
token: ${{ secrets.GITHUB_TOKEN }}
31+
# Edit the following line to reflect the actual name of the GitHub Secret containing your private key
1332
ssh: ${{ secrets.DOCUMENTER_KEY }}
33+
# ssh: ${{ secrets.NAME_OF_MY_SSH_PRIVATE_KEY_SECRET }}

.github/workflows/ci.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@ defaults:
1515

1616
jobs:
1717
test:
18-
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.julia-threads }} thread(s) - ${{ github.event_name }}
18+
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.julia-threads }} thread(s)
1919
runs-on: ${{ matrix.os }}
2020
env:
2121
JULIA_NUM_THREADS: ${{ matrix.julia-threads }}
2222
strategy:
2323
fail-fast: false
2424
matrix:
2525
version:
26-
- '1.6'
26+
# - '1.9' # uncomment when julia 1.10 is out
2727
- '1' # automatically expands to the latest stable 1.x release of Julia
2828
- 'nightly'
2929
os:
@@ -69,17 +69,17 @@ jobs:
6969

7070
- name: "Run test without coverage"
7171
uses: julia-actions/julia-runtest@v1
72-
if: ${{ !contains(fromJson('["1", "1.6"]'), matrix.version) || matrix.os != 'ubuntu-latest' }}
72+
if: ${{ !contains(fromJson('["1", "1.9"]'), matrix.version) || matrix.os != 'ubuntu-latest' }}
7373
with:
7474
coverage: false
7575

7676
- name: "Run test with coverage"
7777
uses: julia-actions/julia-runtest@v1
78-
if: contains(fromJson('["1", "1.6"]'), matrix.version) && matrix.os == 'ubuntu-latest'
78+
if: contains(fromJson('["1", "1.9"]'), matrix.version) && matrix.os == 'ubuntu-latest'
7979
- uses: julia-actions/julia-processcoverage@v1
80-
if: contains(fromJson('["1", "1.6"]'), matrix.version) && matrix.os == 'ubuntu-latest'
80+
if: contains(fromJson('["1", "1.9"]'), matrix.version) && matrix.os == 'ubuntu-latest'
8181
- uses: codecov/codecov-action@v3
82-
if: contains(fromJson('["1", "1.6"]'), matrix.version) && matrix.os == 'ubuntu-latest'
82+
if: contains(fromJson('["1", "1.9"]'), matrix.version) && matrix.os == 'ubuntu-latest'
8383
with:
8484
file: lcov.info
8585

@@ -90,7 +90,7 @@ jobs:
9090
- uses: actions/checkout@v3
9191
- uses: julia-actions/setup-julia@v1
9292
with:
93-
version: '1.6'
93+
version: '1.9'
9494
- run: |
9595
julia --project=docs -e '
9696
using Pkg

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ deps.jl
1212
*.log
1313
.vscode/
1414
/Manifest.toml
15-
lib/NNlibCUDA/Manifest.toml
15+
test/Manifest.toml
1616
benchmark/Manifest.toml
1717
benchmark/*.json
1818
benchmark/report.md

Project.toml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "NNlib"
22
uuid = "872c559c-99b0-510c-b3b7-b6c96a88d5cd"
3-
version = "0.8.20"
3+
version = "0.9.0"
44

55
[deps]
66
Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"
@@ -16,19 +16,22 @@ Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
1616

1717
[weakdeps]
1818
AMDGPU = "21141c5a-9bdb-4563-92ae-f87d6854732e"
19+
cuDNN = "02a925ec-e4fe-4b08-9a7e-0d78e3d38ccd"
20+
CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba"
1921

2022
[extensions]
2123
NNlibAMDGPUExt = "AMDGPU"
24+
NNlibCUDAExt = "CUDA"
25+
NNlibCUDACUDNNExt = ["CUDA", "cuDNN"]
2226

2327
[compat]
2428
AMDGPU = "0.4.8"
25-
Adapt = "2, 3.2"
29+
Adapt = "3.2"
2630
Atomix = "0.1"
2731
ChainRulesCore = "1.13"
32+
CUDA = "4"
33+
cuDNN = "1"
2834
GPUArraysCore = "0.1"
2935
KernelAbstractions = "0.9.2"
30-
Requires = "0.5, 1.0"
31-
julia = "1.6"
32-
33-
[extras]
34-
AMDGPU = "21141c5a-9bdb-4563-92ae-f87d6854732e"
36+
Requires = "1.0"
37+
julia = "1.9"

README.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,13 @@ This package provides a library of functions useful for neural networks, such as
1616

1717
For use with automatic differentiation, this package defines gradients using [ChainRules.jl](https://github.com/JuliaDiff/ChainRules.jl). These will be seen by various packages including [Zygote.jl](https://github.com/FluxML/Zygote.jl).
1818

19-
To use these functions with [CUDA.jl](https://github.com/JuliaGPU/CUDA.jl) you will need [NNlibCUDA.jl](https://github.com/FluxML/NNlibCUDA.jl) as well.
19+
GPU support is provided as package extensions (see the `ext/` folder). In order to load the extensions, use the imports
20+
```julia
21+
using NNlib, CUDA, cuDNN
22+
```
23+
for CUDA support, or
24+
```julia
25+
using NNlib, AMDGPU
26+
```
27+
for AMDGPU support.
28+

docs/src/index.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,12 @@
44

55
For use with automatic differentiation, this package defines gradients using [ChainRules.jl](https://github.com/JuliaDiff/ChainRules.jl). These will be seen by various packages including [Zygote.jl](https://github.com/FluxML/Zygote.jl).
66

7-
To use these functions with [CUDA.jl](https://github.com/JuliaGPU/CUDA.jl) you will need [NNlibCUDA.jl](https://github.com/FluxML/NNlibCUDA.jl) as well.
8-
For [AMDGPU.jl](https://github.com/JuliaGPU/AMDGPU.jl) you will need to load it and NNlib in the same Julia session.
7+
GPU support is provided as package extensions. In order to load the extensions, use the imports
8+
```julia
9+
using NNlib, CUDA, cuDNN
10+
```
11+
for CUDA support, or
12+
```julia
13+
using NNlib, AMDGPU
14+
```
15+
for AMDGPU support.

ext/NNlibCUDA/.buildkite/pipeline.yml

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

ext/NNlibCUDA/.github/workflows/compathelper.yml

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

ext/NNlibCUDA/.github/workflows/tagbot.yml

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

ext/NNlibCUDA/.gitignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

ext/NNlibCUDA/LICENSE.md

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

0 commit comments

Comments
 (0)