Skip to content

Commit

Permalink
Refactored CUDA and Metal backends into extensions. (#42)
Browse files Browse the repository at this point in the history
Co-authored-by: Valentin Churavy <[email protected]>
  • Loading branch information
anicusan and vchuravy authored Nov 23, 2024
1 parent 25d9da2 commit b027bdd
Show file tree
Hide file tree
Showing 38 changed files with 333 additions and 466 deletions.
9 changes: 5 additions & 4 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ steps:
julia -e 'using Pkg
println("--- :julia: Instantiating environment")
Pkg.activate("lib/AtomixCUDA")
Pkg.add("CUDA")
Pkg.develop(PackageSpec(name="Atomix", path="."))
println("+++ :julia: Running tests")
Pkg.test()'
Pkg.test("Atomix", test_args=["--CUDA"])'
agents:
queue: "juliagpu"
cuda: "*"
Expand All @@ -26,14 +26,15 @@ steps:
julia -e 'using Pkg
println("--- :julia: Instantiating environment")
Pkg.activate("lib/AtomixMetal")
Pkg.add("Metal")
Pkg.develop(PackageSpec(name="Atomix", path="."))
println("+++ :julia: Running tests")
Pkg.test()'
Pkg.test("Atomix", test_args=["--Metal"])'
agents:
queue: "juliaecosystem"
os: "macos"
arch: "aarch64"
if: build.message !~ /\[skip tests\]/
timeout_in_minutes: 15

30 changes: 3 additions & 27 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ jobs:
matrix:
julia-version:
- '1'
- '1.6'
- 'lts'
- 'pre'
fail-fast: false
name: Test Julia ${{ matrix.julia-version }}
steps:
Expand All @@ -33,24 +34,6 @@ jobs:
flags: Pkg.test
name: codecov-umbrella

aqua:
runs-on: ubuntu-latest
strategy:
matrix:
julia-version:
- '1'
- '1.6'
fail-fast: false
steps:
- uses: actions/checkout@v4

- uses: julia-actions/setup-julia@v2
with:
version: ${{ matrix.julia-version }}
- uses: julia-actions/cache@v2

- uses: tkf/julia-aqua@v1

documenter:
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -78,17 +61,10 @@ jobs:
if: steps.build-and-deploy.outcome == 'skipped'
run: julia -e 'using Run; Run.docs()'

# https://github.com/tkf/julia-code-style-suggesters
code-style:
if: always() && github.event.pull_request
runs-on: ubuntu-latest
steps:
- uses: tkf/julia-code-style-suggesters@v1

# A job that succeeds if and only if all jobs succeed.
all-success:
if: always() && github.event.pull_request
needs: [test, aqua, documenter, code-style]
needs: [test, documenter]
runs-on: ubuntu-latest
steps:
# https://github.com/tkf/merge-conclusions-action
Expand Down
14 changes: 12 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
name = "Atomix"
uuid = "a9b6321e-bd34-4604-b9c9-b65b8de01458"
authors = ["Takafumi Arakaki <[email protected]> and contributors"]
version = "1.0"
version = "0.2.0"

[deps]
UnsafeAtomics = "013be700-e6cd-48c3-b4a1-df204f14c38f"

[compat]
CUDA = "5"
Metal = "1"
UnsafeAtomics = "0.1, 0.2"
julia = "1.6"
julia = "1.10"

[extensions]
AtomixCUDAExt = "CUDA"
AtomixMetalExt = "Metal"

[weakdeps]
CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba"
Metal = "dde4c033-4e86-420c-a63e-0dd931031962"
3 changes: 2 additions & 1 deletion docs/Project.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[deps]
Atomix = "a9b6321e-bd34-4604-b9c9-b65b8de01458"
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"

[compat]
Documenter = "1.7"
Documenter = "1"
18 changes: 11 additions & 7 deletions docs/make.jl
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
using Documenter
using Atomix

makedocs(
sitename = "Atomix",
modules = [Atomix],
warnonly = :missing_docs
makedocs(;
sitename="Atomix",
modules=[Atomix],
format=Documenter.HTML(;
# Only create web pretty-URLs on the CI
prettyurls=get(ENV, "CI", nothing) == "true",
),
warnonly=:missing_docs,
)

deploydocs(
repo = "github.com/JuliaConcurrent/Atomix.jl",
devbranch = "main",
push_preview = true,
repo="github.com/JuliaConcurrent/Atomix.jl",
devbranch="main",
push_preview=true,
)
5 changes: 5 additions & 0 deletions docs/make_local.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Activate docs environment and use ("develop") local library
using Pkg
Pkg.activate(@__DIR__)
Pkg.develop(path=joinpath(@__DIR__, ".."))
include("make.jl")
4 changes: 2 additions & 2 deletions lib/AtomixCUDA/src/AtomixCUDA.jl → ext/AtomixCUDAExt.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# TODO: respect ordering
module AtomixCUDA
module AtomixCUDAExt

using Atomix: Atomix, IndexableRef
using CUDA: CUDA, CuDeviceArray
Expand Down Expand Up @@ -55,4 +55,4 @@ end
return old => op(old, x)
end

end # module AtomixCUDA
end # module AtomixCUDAExt
4 changes: 2 additions & 2 deletions lib/AtomixMetal/src/AtomixMetal.jl → ext/AtomixMetalExt.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# TODO: respect ordering
module AtomixMetal
module AtomixMetalExt

using Atomix: Atomix, IndexableRef
using Metal: Metal, MtlDeviceArray
Expand Down Expand Up @@ -55,4 +55,4 @@ end
return old => op(old, x)
end

end # module AtomixMetal
end # module AtomixMetalExt
2 changes: 0 additions & 2 deletions lib/AtomixCUDA/.gitignore

This file was deleted.

21 changes: 0 additions & 21 deletions lib/AtomixCUDA/LICENSE

This file was deleted.

13 changes: 0 additions & 13 deletions lib/AtomixCUDA/Project.toml

This file was deleted.

1 change: 0 additions & 1 deletion lib/AtomixCUDA/README.md

This file was deleted.

13 changes: 0 additions & 13 deletions lib/AtomixCUDA/test/AtomixCUDATests/Project.toml

This file was deleted.

7 changes: 0 additions & 7 deletions lib/AtomixCUDA/test/AtomixCUDATests/src/AtomixCUDATests.jl

This file was deleted.

36 changes: 0 additions & 36 deletions lib/AtomixCUDA/test/AtomixCUDATests/src/test_sugar.jl

This file was deleted.

13 changes: 0 additions & 13 deletions lib/AtomixCUDA/test/AtomixCUDATests/src/utils.jl

This file was deleted.

6 changes: 0 additions & 6 deletions lib/AtomixCUDA/test/Project.toml

This file was deleted.

2 changes: 0 additions & 2 deletions lib/AtomixCUDA/test/runtests.jl

This file was deleted.

21 changes: 0 additions & 21 deletions lib/AtomixMetal/LICENSE

This file was deleted.

13 changes: 0 additions & 13 deletions lib/AtomixMetal/Project.toml

This file was deleted.

1 change: 0 additions & 1 deletion lib/AtomixMetal/README.md

This file was deleted.

13 changes: 0 additions & 13 deletions lib/AtomixMetal/test/AtomixMetalTests/Project.toml

This file was deleted.

7 changes: 0 additions & 7 deletions lib/AtomixMetal/test/AtomixMetalTests/src/AtomixMetalTests.jl

This file was deleted.

36 changes: 0 additions & 36 deletions lib/AtomixMetal/test/AtomixMetalTests/src/test_sugar.jl

This file was deleted.

Loading

0 comments on commit b027bdd

Please sign in to comment.