Skip to content

Commit

Permalink
Merge pull request #75 from CliMA/gb/move_to_ext
Browse files Browse the repository at this point in the history
Move MPI and CUDA to Julia extensions
  • Loading branch information
Sbozzolo authored Apr 29, 2024
2 parents 13f332d + 53b3b9f commit a22e4ac
Show file tree
Hide file tree
Showing 17 changed files with 882 additions and 1,003 deletions.
18 changes: 0 additions & 18 deletions .buildkite/JuliaProject.toml

This file was deleted.

62 changes: 46 additions & 16 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,23 @@
agents:
queue: central
queue: new-central
slurm_mem: 8G
modules: julia/1.9.3 cuda/12.2 ucx/1.14.1_cuda-12.2 openmpi/4.1.5_cuda-12.2 hdf5/1.12.2-ompi415 nsight-systems/2023.2.1
modules: climacommon/2024_03_18

env:
JULIA_LOAD_PATH: "${JULIA_LOAD_PATH}:${BUILDKITE_BUILD_CHECKOUT_PATH}/.buildkite"
JULIA_CUDA_USE_BINARYBUILDER: false
JULIA_CUDA_MEMORY_POOL: none
OPENBLAS_NUM_THREADS: 1

steps:
- label: "initialize"
key: "initialize"
command:
- echo "--- Instantiate project"
- "julia --project -e 'using Pkg; Pkg.instantiate(;verbose=true); Pkg.precompile(;strict=true)'"
- "julia --project=test -e 'using Pkg; Pkg.develop(;path=\".\"); Pkg.add(\"CUDA\"); Pkg.add(\"MPI\"); Pkg.instantiate(;verbose=true); Pkg.precompile(;strict=true)'"
# force the initialization of the CUDA runtime as it is lazily loaded by default
- "julia --project -e 'using CUDA; CUDA.precompile_runtime()'"
- "julia --project -e 'using Pkg; Pkg.status()'"
- "julia --project=test -e 'using CUDA; CUDA.precompile_runtime()'"
- "julia --project=test -e 'using Pkg; Pkg.status()'"

agents:
slurm_gpus: 1
slurm_cpus_per_task: 8
env:
JULIA_NUM_PRECOMPILE_TASKS: 8
Expand All @@ -29,29 +27,61 @@ steps:
- label: ":computer: tests"
key: "cpu_tests"
command:
- julia --project -e 'using Pkg; Pkg.test()'
- julia --project=test test/runtests.jl
env:
CLIMACOMMS_TEST_DEVICE: CPU

- label: ":computer: tests MPI"
key: "cpu_tests_mpi"
command:
- srun julia --project=test test/runtests.jl
env:
CLIMACOMMS_TEST_DEVICE: CPU
CLIMACOMMS_CONTEXT: MPI
CLIMACOMMS_DEVICE: CPU
agents:
slurm_nodes: 1
slurm_ntasks_per_node: 4
slurm_ntasks: 2

- label: ":computer: threaded tests"
key: "cpu_threaded_tests"
command:
- julia --threads 8 --project -e 'using Pkg; Pkg.test()'
- julia --threads 4 --project=test test/runtests.jl
env:
CLIMACOMMS_TEST_DEVICE: CPU
CLIMACOMMS_DEVICE: CPU
agents:
slurm_cpus_per_task: 8
slurm_cpus_per_task: 4

- label: ":computer: threaded tests MPI"
key: "cpu_threaded_tests_mpi"
command:
- srun julia --threads 4 --project=test test/runtests.jl
env:
CLIMACOMMS_TEST_DEVICE: CPU
CLIMACOMMS_CONTEXT: MPI
CLIMACOMMS_DEVICE: CPU
agents:
slurm_ntasks: 2
slurm_cpus_per_task: 4

- label: ":flower_playing_cards: tests"
key: "gpu_tests"
command:
- julia --project -e 'using Pkg; Pkg.test()'
- julia --project=test test/runtests.jl
env:
CLIMACOMMS_TEST_DEVICE: CUDA
CLIMACOMMS_DEVICE: CUDA
agents:
slurm_gpus: 1

- label: ":flower_playing_cards: tests MPI"
key: "gpu_tests_mpi"
command:
- srun julia --project=test test/runtests.jl
env:
CLIMACOMMS_TEST_DEVICE: CUDA
CLIMACOMMS_CONTEXT: MPI
CLIMACOMMS_DEVICE: CUDA
agents:
slurm_nodes: 1
slurm_ntasks_per_node: 2
slurm_gpus_per_task: 1
slurm_ntasks: 2
24 changes: 24 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
ClimaComms.jl Release Notes
========================

v0.6.0
-------

- ![][badge-💥breaking] `ClimaComms` does no longer try to guess the correct
compute device: the default is now CPU. To control which device to use,
use the `CLIMACOMMS_DEVICE` environment variable.
- ![][badge-💥breaking] `CUDA` and `MPI` are now extensions in `ClimaComms`. To
use `CUDA`/`MPI`, `CUDA.jl`/`MPI.jl` have to be loaded. A convenience macro
`ClimaComms.@import_required_backends` checks what device/context could be
used and conditionally loads `CUDA.jl`/`MPI.jl`. It is recommended to change
```julia
import ClimaComms
```
to
```julia
import ClimaComms
ClimaComms.@import_required_backends
```
This has to be done before calling `ClimaComms.context()`.

[badge-💥breaking]: https://img.shields.io/badge/💥BREAKING-red.svg
10 changes: 7 additions & 3 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,17 @@ authors = [
"Jake Bolewski <[email protected]>",
"Gabriele Bozzola <[email protected]>",
]
version = "0.5.8"
version = "0.6.0"

[deps]
[weakdeps]
CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba"
MPI = "da04e1cc-30fd-572f-bb4f-1f8673147195"

[extensions]
ClimaCommsCUDAExt = "CUDA"
ClimaCommsMPIExt = "MPI"

[compat]
CUDA = "3, 4, 5"
MPI = "0.20.18"
julia = "1.8"
julia = "1.9"
Loading

2 comments on commit a22e4ac

@Sbozzolo
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/105780

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.6.0 -m "<description of version>" a22e4ac25770c08dc714a4600ca5dba453943fbf
git push origin v0.6.0

Please sign in to comment.