Skip to content

Commit 2e6d7f8

Browse files
navidcysimone-silvestriglwagnergiordano
authored
Update CI to Julia version to 1.12.0 (#4836)
* Update CI to Julia version to 1.12.0 * try increasing reactant compact * try without reactant * just run the docs * bugfix * Change grid bottom function to GridFittedBottom * Update warning for Julia version compatibility * take up the changes in #3836 * try without distributed * imports alphabetically * use a local accumulator and reinstate tests * reinstate all tests * white line * reinstate distributed examples * Update KernelAbstractions version to 0.9.39 * Disable doctest temporarily * Update pipeline.yml * separate out reactant and enzyme tests * try like this * don't need to make the new directory * fixing * use a new key * need to create the new folder * mv manifest to new version * Update .buildkite/pipeline.yml Co-authored-by: Mosè Giordano <[email protected]> * [CI] Automatically create version-specific manifests * enzyme on 1.10 * whyt would / not compile? meybe because of / 0? * try removing internal closures * this should do the trick * up to six operands * Update make.jl * Apply suggestion from @simone-silvestri * Apply suggestion from @simone-silvestri * Apply suggestion from @simone-silvestri * another bugfix --------- Co-authored-by: Simone Silvestri <[email protected]> Co-authored-by: Gregory L. Wagner <[email protected]> Co-authored-by: Mosè Giordano <[email protected]>
1 parent 465335b commit 2e6d7f8

File tree

8 files changed

+114
-24
lines changed

8 files changed

+114
-24
lines changed

.buildkite/pipeline.yml

Lines changed: 65 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
env:
2-
JULIA_VERSION: "1.10.10"
2+
JULIA_VERSION: "1.12.1"
3+
JULIA_VERSION_ENZYME: "1.10.10"
34
BUILDKITE_HOME: "/var/lib/buildkite-agent"
45
JULIA_DEPOT_PATH: "$BUILDKITE_HOME/.julia-oceananigans"
56
JULIA_PKG_SERVER_REGISTRY_PREFERENCE: eager
@@ -12,7 +13,7 @@ with:
1213
coverage: false
1314

1415
steps:
15-
- label: "🏕️ initialize environment"
16+
- label: "🏕️ initialize general environment"
1617
key: "init"
1718
agents:
1819
queue: "Oceananigans-nautilus"
@@ -26,6 +27,29 @@ steps:
2627
cd "$OCEANANIGANS_DIR"
2728
2829
julia +$JULIA_VERSION -O0 --color=yes --project -e 'using Pkg; Pkg.test()'
30+
# After we have instantiated the general environment, move manifest to the
31+
# version-specific filename, not to clash with the manifest for Enzyme.
32+
mv -v Manifest.toml Manifest-v$(echo "${JULIA_VERSION}" | cut -d. -f1-2).toml
33+
retry:
34+
automatic:
35+
- exit_status: 1
36+
limit: 1
37+
38+
- label: "🏕️ initialize enzyme environment"
39+
key: "init_enzyme"
40+
depends_on: "init"
41+
agents:
42+
queue: "Oceananigans-nautilus"
43+
env:
44+
TEST_GROUP: "init"
45+
command: |
46+
juliaup add $JULIA_VERSION_ENZYME
47+
cd "$OCEANANIGANS_DIR"
48+
49+
julia +$JULIA_VERSION_ENZYME -O0 --color=yes --project -e 'using Pkg; Pkg.test()'
50+
# After we have instantiated the Enzyme environment, move manifest to the
51+
# version-specific filename, not to clash with the general manifest.
52+
# mv -v Manifest.toml Manifest-v$(echo "${JULIA_VERSION_ENZYME}" | cut -d. -f1-2).toml
2953
retry:
3054
automatic:
3155
- exit_status: 1
@@ -58,12 +82,6 @@ steps:
5882
export TEST_ARCHITECTURE="GPU"
5983
fi
6084
61-
# Force IFRT runtime for Reactant (this can be moved to Project.toml on 1.11)
62-
touch LocalPreferences.toml
63-
echo "[Reactant]" >> LocalPreferences.toml
64-
echo "xla_runtime = \"IFRT\"" >> LocalPreferences.toml
65-
cat LocalPreferences.toml
66-
6785
# Strip emoji for environment variable
6886
group="{{ matrix.group }}"
6987
export TEST_GROUP="\${group#* }"
@@ -80,7 +98,6 @@ steps:
8098
- "GPU"
8199
group:
82100
- "🦖 poisson_solvers_2"
83-
- "🎭 reactant_2"
84101
- "🐇 unit"
85102
- "👻 abstract_operations"
86103
- "🕊 poisson_solvers_1"
@@ -99,14 +116,51 @@ steps:
99116
- "🍂 lagrangian_particles"
100117
- "🧅 multi_region"
101118
- "🦧 scripts"
102-
- "👺 enzyme"
103119
- "🍱 xesmf"
104-
- "👹 reactant_1"
120+
105121
retry:
106122
automatic:
107123
- exit_status: 1
108124
limit: 1
109125

126+
- label: "{{ matrix.architecture }} - {{ matrix.group }} tests"
127+
key: "tests_enzyme_reactant"
128+
depends_on: "init_enzyme"
129+
agents:
130+
queue: "Oceananigans-nautilus"
131+
command: |
132+
# Add matrix-specific environment variables
133+
if [[ "{{ matrix.architecture }}" == "CPU" ]]; then
134+
export CUDA_VISIBLE_DEVICES="-1"
135+
export TEST_ARCHITECTURE="CPU"
136+
else
137+
export CUDA_VISIBLE_DEVICES="0"
138+
export TEST_ARCHITECTURE="GPU"
139+
fi
140+
141+
# Strip emoji for environment variable
142+
group="{{ matrix.group }}"
143+
export TEST_GROUP="\${group#* }"
144+
echo $TEST_GROUP
145+
146+
# Run tests
147+
cd "$OCEANANIGANS_DIR"
148+
julia +$JULIA_VERSION_ENZYME -O0 --color=yes --project -e 'using Pkg; Pkg.test()'
149+
150+
matrix:
151+
setup:
152+
architecture:
153+
- "CPU"
154+
- "GPU"
155+
group:
156+
- "🎭 reactant_2"
157+
- "👺 enzyme"
158+
- "👹 reactant_1"
159+
160+
retry:
161+
automatic:
162+
- exit_status: 1
163+
limit: 1
110164
#####
111165
##### Blocking wait on tests and documentation
112166
#####

Project.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ GPUArraysCore = "0.2"
7777
Glob = "1.3"
7878
InteractiveUtils = "1.9"
7979
JLD2 = "0.4, 0.5, 0.6"
80-
KernelAbstractions = "0.9.21"
80+
KernelAbstractions = "0.9.39"
8181
Krylov = "0.10.0"
8282
KrylovPreconditioners = "0.3.2"
8383
LinearAlgebra = "1.9"
@@ -92,7 +92,7 @@ OffsetArrays = "1.4"
9292
OrderedCollections = "1.1"
9393
Printf = "1.9"
9494
Random = "1.9"
95-
Reactant = "0.2.162"
95+
Reactant = "0.2.169"
9696
ReactantCore = "0.1"
9797
Rotations = "1.0"
9898
SeawaterPolynomials = "0.3.9"

src/AbstractOperations/multiary_operations.jl

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,44 @@ struct MultiaryOperation{LX, LY, LZ, N, O, A, IN, G, T} <: AbstractOperation{LX,
1313
end
1414
end
1515

16+
# NOTE!!! The GPU compiler has trouble inferring this operation which might lead to dynamic evaluations.
1617
@inline Base.getindex::MultiaryOperation{LX, LY, LZ, N}, i, j, k) where {LX, LY, LZ, N} =
1718
Π.op(ntuple-> Π.▶[γ](i, j, k, Π.grid, Π.args[γ]), Val(N))...)
1819

20+
# Try to improve inferrability by hardcoding methods for small N
21+
@inline Base.getindex::MultiaryOperation{LX, LY, LZ, 1}, i, j, k) where {LX, LY, LZ} =
22+
Π.op(Π.▶[1](i, j, k, Π.grid, Π.args[1]))
23+
24+
@inline Base.getindex::MultiaryOperation{LX, LY, LZ, 2}, i, j, k) where {LX, LY, LZ} =
25+
Π.op(Π.▶[1](i, j, k, Π.grid, Π.args[1]),
26+
Π.▶[2](i, j, k, Π.grid, Π.args[2]))
27+
28+
@inline Base.getindex::MultiaryOperation{LX, LY, LZ, 3}, i, j, k) where {LX, LY, LZ} =
29+
Π.op(Π.▶[1](i, j, k, Π.grid, Π.args[1]),
30+
Π.▶[2](i, j, k, Π.grid, Π.args[2]),
31+
Π.▶[3](i, j, k, Π.grid, Π.args[3]))
32+
33+
@inline Base.getindex::MultiaryOperation{LX, LY, LZ, 4}, i, j, k) where {LX, LY, LZ} =
34+
Π.op(Π.▶[1](i, j, k, Π.grid, Π.args[1]),
35+
Π.▶[2](i, j, k, Π.grid, Π.args[2]),
36+
Π.▶[3](i, j, k, Π.grid, Π.args[3]),
37+
Π.▶[4](i, j, k, Π.grid, Π.args[4]))
38+
39+
@inline Base.getindex::MultiaryOperation{LX, LY, LZ, 5}, i, j, k) where {LX, LY, LZ} =
40+
Π.op(Π.▶[1](i, j, k, Π.grid, Π.args[1]),
41+
Π.▶[2](i, j, k, Π.grid, Π.args[2]),
42+
Π.▶[3](i, j, k, Π.grid, Π.args[3]),
43+
Π.▶[4](i, j, k, Π.grid, Π.args[4]),
44+
Π.▶[5](i, j, k, Π.grid, Π.args[5]))
45+
46+
@inline Base.getindex::MultiaryOperation{LX, LY, LZ, 6}, i, j, k) where {LX, LY, LZ} =
47+
Π.op(Π.▶[1](i, j, k, Π.grid, Π.args[1]),
48+
Π.▶[2](i, j, k, Π.grid, Π.args[2]),
49+
Π.▶[3](i, j, k, Π.grid, Π.args[3]),
50+
Π.▶[4](i, j, k, Π.grid, Π.args[4]),
51+
Π.▶[5](i, j, k, Π.grid, Π.args[5]),
52+
Π.▶[6](i, j, k, Π.grid, Π.args[6]))
53+
1954
#####
2055
##### MultiaryOperation construction
2156
#####

src/Models/HydrostaticFreeSurfaceModels/update_hydrostatic_free_surface_model_state.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,9 @@ function mask_immersed_model_fields!(model, grid)
6161
η = displacement(model.free_surface)
6262
fields_to_mask = merge(model.auxiliary_fields, prognostic_fields(model))
6363

64-
foreach(fields_to_mask) do field
65-
if field !== η
66-
mask_immersed_field!(field)
64+
foreach(keys(fields_to_mask)) do key
65+
if key != :η
66+
@inbounds mask_immersed_field!(fields_to_mask[key])
6767
end
6868
end
6969
mask_immersed_field_xy!(η, k=size(grid, 3)+1)

src/Models/NonhydrostaticModels/update_hydrostatic_pressure.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,12 @@ the `buoyancy_perturbationᶜᶜᶜ` downwards:
1212
@kernel function _update_hydrostatic_pressure!(pHY′, grid, buoyancy, C)
1313
i, j = @index(Global, NTuple)
1414

15-
@inbounds pHY′[i, j, grid.Nz] = - z_dot_g_bᶜᶜᶠ(i, j, grid.Nz+1, grid, buoyancy, C) * Δzᶜᶜᶠ(i, j, grid.Nz+1, grid)
15+
pᵏ = - z_dot_g_bᶜᶜᶠ(i, j, grid.Nz+1, grid, buoyancy, C) * Δzᶜᶜᶠ(i, j, grid.Nz+1, grid)
16+
@inbounds pHY′[i, j, grid.Nz] = pᵏ
1617

1718
for k in grid.Nz-1 : -1 : 1
18-
@inbounds pHY′[i, j, k] = pHY′[i, j, k+1] - z_dot_g_bᶜᶜᶠ(i, j, k+1, grid, buoyancy, C) * Δzᶜᶜᶠ(i, j, k+1, grid)
19+
pᵏ -= z_dot_g_bᶜᶜᶠ(i, j, k+1, grid, buoyancy, C) * Δzᶜᶜᶠ(i, j, k+1, grid)
20+
@inbounds pHY′[i, j, k] = pᵏ
1921
end
2022
end
2123

src/MultiRegion/multi_region_field.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ using Oceananigans.OutputWriters: output_indices
66

77
using Base: @propagate_inbounds
88

9-
import Oceananigans.BoundaryConditions: regularize_field_boundary_conditions
9+
import Oceananigans.BoundaryConditions: regularize_field_boundary_conditions, FieldBoundaryConditions
1010
import Oceananigans.Diagnostics: hasnan
1111
import Oceananigans.DistributedComputations: reconstruct_global_field, CommunicationBuffers
1212
import Oceananigans.Fields: set!, compute!, compute_at!, interior, communication_buffers,

src/Oceananigans.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,10 @@ using DocStringExtensions
119119
using FFTW
120120

121121
function __init__()
122-
if VERSION >= v"1.11.0"
123-
@warn """You are using Julia v1.11 or later!"
124-
Oceananigans is currently tested on Julia v1.10."
125-
If you find issues with Julia v1.11 or later,"
122+
if VERSION >= v"1.13.0"
123+
@warn """You are using Julia v1.13 or later!"
124+
Oceananigans is currently tested on Julia v1.12."
125+
If you find issues with Julia v1.13 or later,"
126126
please report at https://github.com/CliMA/Oceananigans.jl/issues/new"""
127127

128128
end

test/test_init.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
using Enzyme
21
using CUDA
32
using Metal
43
using AMDGPU

0 commit comments

Comments
 (0)