Skip to content

Commit 5a61dc6

Browse files
committed
Replace RecursiveApply functions with AutoBroadcaster wrappers
1 parent 3c150fa commit 5a61dc6

74 files changed

Lines changed: 1600 additions & 1855 deletions

File tree

Some content is hidden

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

.buildkite/pipeline.yml

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,16 +48,13 @@ steps:
4848
agents:
4949
slurm_gpus: 1
5050

51-
- group: "Unit: RecursiveApply"
52-
steps:
53-
54-
- label: "Unit: RecursiveApply"
55-
key: unit_recursive_apply
56-
command: "julia --color=yes --check-bounds=yes --project=.buildkite test/RecursiveApply/unit_recursive_apply.jl"
57-
5851
- group: "Unit: Utilities"
5952
steps:
6053

54+
- label: "Unit: AutoBroadcaster"
55+
key: unit_auto_broadcaster
56+
command: "julia --color=yes --check-bounds=yes --project=.buildkite test/Utilities/unit_auto_broadcaster.jl"
57+
6158
- label: "Unit: plushalf"
6259
key: unit_plushalf
6360
command: "julia --color=yes --check-bounds=yes --project=.buildkite test/Utilities/unit_plushalf.jl"
@@ -194,9 +191,9 @@ steps:
194191
key: unit_axistensors
195192
command: "julia --color=yes --check-bounds=yes --project=.buildkite test/Geometry/axistensors.jl"
196193

197-
- label: "Unit: rmul_with_projection"
198-
key: unit_rmul_with_projection
199-
command: "julia --color=yes --check-bounds=yes --project=.buildkite test/Geometry/rmul_with_projection.jl"
194+
- label: "Unit: mul_with_projection"
195+
key: unit_mul_with_projection
196+
command: "julia --color=yes --check-bounds=yes --project=.buildkite test/Geometry/mul_with_projection.jl"
200197

201198
- group: "Unit: Meshes"
202199
steps:

benchmarks/3d/se_kernels.jl

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@ import ClimaCore:
1313
Spaces,
1414
Quadratures,
1515
Topologies,
16-
DataLayouts,
17-
RecursiveApply
18-
16+
DataLayouts
1917
const C1 = ClimaCore.Geometry.Covariant1Vector
2018
const C2 = ClimaCore.Geometry.Covariant2Vector
2119
const C3 = ClimaCore.Geometry.Covariant3Vector
@@ -25,8 +23,6 @@ const CT123 = Geometry.Contravariant123Vector
2523
const ᶜinterp = Operators.InterpolateF2C()
2624
const ᶠinterp = Operators.InterpolateC2F()
2725

28-
const = RecursiveApply.radd
29-
3026
init_uθ(ϕ, z, R) = 1.0 / R
3127
init_vθ(ϕ, z, R) = 1.0 / R
3228
init_w(ϕ, z) = 1.0

benchmarks/bickleyjet/bickleyjet_dg.jl

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@ import ClimaCore.Operators
77
using ClimaCore.Geometry
88
import ClimaCore.Geometry: Abstract2DPoint
99

10-
using ClimaCore.RecursiveApply
11-
12-
1310
const parameters = (
1411
ϵ = 0.1, # perturbation size for initial condition
1512
l = 0.5, # Gaussian width
@@ -60,7 +57,7 @@ roe_average(ρ⁻, ρ⁺, var⁻, var⁺) =
6057
(sqrt(ρ⁻) * var⁻ + sqrt(ρ⁺) * var⁺) / (sqrt(ρ⁻) + sqrt(ρ⁺))
6158

6259
function roeflux(n, (y⁻, parameters⁻), (y⁺, parameters⁺))
63-
Favg = RecursiveApply.rdiv(flux(y⁻, parameters⁻) flux(y⁺, parameters⁺), 2)
60+
Favg = (flux(y⁻, parameters⁻) + flux(y⁺, parameters⁺)) / 2
6461

6562
λ = sqrt(parameters⁻.g)
6663

@@ -115,7 +112,7 @@ function roeflux(n, (y⁻, parameters⁻), (y⁺, parameters⁺))
115112
fluxᵀn_ρθ = ((w1 + w2) * θ + w5) * 0.5
116113

117114
Δf == -fluxᵀn_ρ, ρu = -fluxᵀn_ρu, ρθ = -fluxᵀn_ρθ)
118-
RecursiveApply.rmap(f -> f' * n, Favg) Δf
115+
return Favg' * n + Δf
119116
end
120117

121118
function volume!(dydt, y, (parameters,), t)

benchmarks/bickleyjet/core_vs_ref.jl

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ for Nq in Nqs
3030
volume!(dydt, y0, (parameters,), 0.0)
3131
# TODO: move this to volume!
3232
dydt_data = Fields.field_values(dydt)
33-
dydt_data .=
34-
RecursiveApply.rdiv.(dydt_data, Spaces.local_geometry_data(space).WJ)
33+
dydt_data ./= Spaces.local_geometry_data(space).WJ
3534

3635
# setup reference
3736
X = coordinates(Val(Nq), n1, n2)
@@ -84,8 +83,7 @@ for Nq in Nqs
8483
add_face!(dydt, y0, (parameters,), 0.0)
8584
# TODO: move this to volume!
8685
dydt_data = Fields.field_values(dydt)
87-
dydt_data .=
88-
RecursiveApply.rdiv.(dydt_data, Spaces.local_geometry_data(space).WJ)
86+
dydt_data ./= Spaces.local_geometry_data(space).WJ
8987

9088
fill!(dydt_ref, 0.0)
9189
add_face_ref!(dydt_ref, y0_ref, (n1, n2, parameters, Val(Nq)), 0.0)

docs/make.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@ withenv("GKSwstype" => "nul") do
9999
"Limiters" => "APIs/limiters_api.md",
100100
"InputOutput" => "APIs/input_output_api.md",
101101
"Remapping" => "APIs/remapping_api.md",
102-
"RecursiveApply" => "APIs/recursive_apply_api.md",
103102
"Devices" => "APIs/devices_api.md",
104103
"DebugOnly" => "APIs/debug_only_api.md",
105104
],

docs/src/APIs/geometry_api.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ Geometry.LocalGeometry
2121

2222
```@docs
2323
Geometry.Δz_metric_component
24+
Geometry.:⊗
2425
```
2526

2627
## Coordinates

docs/src/APIs/recursive_apply_api.md

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

docs/src/APIs/utilities_api.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,27 @@
44
CurrentModule = ClimaCore
55
```
66

7+
## Type Functions
8+
9+
```@docs
10+
Utilities.unionall_type
11+
Utilities.inferred_type
12+
Utilities.inferred_const
13+
```
14+
15+
## Utilities.AutoBroadcaster
16+
17+
```@docs
18+
Utilities.AutoBroadcaster
19+
Utilities.is_auto_broadcastable
20+
Utilities.enable_auto_broadcasting
21+
Utilities.disable_auto_broadcasting
22+
Utilities.auto_broadcast
23+
Utilities.@auto_broadcaster_args
24+
```
25+
26+
## Utilities.PlusHalf
27+
728
```@docs
829
Utilities.PlusHalf
930
Utilities.half

docs/src/geometry.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,5 @@ CurrentModule = ClimaCore.Geometry
66

77
```@docs
88
mul_with_projection
9-
rmul_with_projection
109
mul_return_type
11-
rmul_return_type
1210
```

docs/src/matrix_fields.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ to represent a collection of banded matrices, where there is one band matrix for
218218
of the space the `Field` is on. Beyond only storing the diagonals of the band matrix, an `entry`
219219
can be optimized to use less memory. Each optimized representation can be indexed equivalently to
220220
non optimized representations, and used in addition, subtraction, matrix-vector multiplication,
221-
Matrix-matrix multiplication, `RecursiveApply`, and `FieldMatrixSolver`.
221+
matrix-matrix multiplication, and solving linear systems via `FieldMatrixSolver`.
222222

223223
For the following sections, `space` is a column space with $N_v$ levels. A column space is
224224
used for simplicity in this example, but the optimizations work with any space with columns.

0 commit comments

Comments
 (0)