Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 7 additions & 10 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,6 @@ steps:
agents:
slurm_gpus: 1

- group: "Unit: RecursiveApply"
steps:

- label: "Unit: RecursiveApply"
key: unit_recursive_apply
command: "julia --color=yes --check-bounds=yes --project=.buildkite test/RecursiveApply/unit_recursive_apply.jl"

- group: "Unit: CUDA utils"
steps:

Expand Down Expand Up @@ -93,6 +86,10 @@ steps:
key: unit_plushalf
command: "julia --color=yes --check-bounds=yes --project=.buildkite test/Utilities/unit_plushalf.jl"

- label: "Unit: auto_broadcaster"
key: unit_auto_broadcaster
command: "julia --color=yes --check-bounds=yes --project=.buildkite test/Utilities/unit_auto_broadcaster.jl"

- group: "Unit: DataLayouts"
steps:

Expand Down Expand Up @@ -227,9 +224,9 @@ steps:
key: unit_axistensors
command: "julia --color=yes --check-bounds=yes --project=.buildkite test/Geometry/axistensors.jl"

- label: "Unit: rmul_with_projection"
key: unit_rmul_with_projection
command: "julia --color=yes --check-bounds=yes --project=.buildkite test/Geometry/rmul_with_projection.jl"
- label: "Unit: mul_with_projection"
key: unit_mul_with_projection
command: "julia --color=yes --check-bounds=yes --project=.buildkite test/Geometry/mul_with_projection.jl"

- group: "Unit: Meshes"
steps:
Expand Down
6 changes: 1 addition & 5 deletions benchmarks/3d/se_kernels.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ import ClimaCore:
Spaces,
Quadratures,
Topologies,
DataLayouts,
RecursiveApply

DataLayouts
const C1 = ClimaCore.Geometry.Covariant1Vector
const C2 = ClimaCore.Geometry.Covariant2Vector
const C3 = ClimaCore.Geometry.Covariant3Vector
Expand All @@ -25,8 +23,6 @@ const CT123 = Geometry.Contravariant123Vector
const ᶜinterp = Operators.InterpolateF2C()
const ᶠinterp = Operators.InterpolateC2F()

const ⊞ = RecursiveApply.radd

init_uθ(ϕ, z, R) = 1.0 / R
init_vθ(ϕ, z, R) = 1.0 / R
init_w(ϕ, z) = 1.0
Expand Down
7 changes: 2 additions & 5 deletions benchmarks/bickleyjet/bickleyjet_dg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ import ClimaCore.Operators
using ClimaCore.Geometry
import ClimaCore.Geometry: Abstract2DPoint

using ClimaCore.RecursiveApply


const parameters = (
ϵ = 0.1, # perturbation size for initial condition
l = 0.5, # Gaussian width
Expand Down Expand Up @@ -60,7 +57,7 @@ roe_average(ρ⁻, ρ⁺, var⁻, var⁺) =
(sqrt(ρ⁻) * var⁻ + sqrt(ρ⁺) * var⁺) / (sqrt(ρ⁻) + sqrt(ρ⁺))

function roeflux(n, (y⁻, parameters⁻), (y⁺, parameters⁺))
Favg = RecursiveApply.rdiv(flux(y⁻, parameters⁻) flux(y⁺, parameters⁺), 2)
Favg = (flux(y⁻, parameters⁻) + flux(y⁺, parameters⁺)) / 2

λ = sqrt(parameters⁻.g)

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

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

function volume!(dydt, y, (parameters,), t)
Expand Down
6 changes: 2 additions & 4 deletions benchmarks/bickleyjet/core_vs_ref.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ for Nq in Nqs
volume!(dydt, y0, (parameters,), 0.0)
# TODO: move this to volume!
dydt_data = Fields.field_values(dydt)
dydt_data .=
RecursiveApply.rdiv.(dydt_data, Spaces.local_geometry_data(space).WJ)
dydt_data ./= Spaces.local_geometry_data(space).WJ

# setup reference
X = coordinates(Val(Nq), n1, n2)
Expand Down Expand Up @@ -84,8 +83,7 @@ for Nq in Nqs
add_face!(dydt, y0, (parameters,), 0.0)
# TODO: move this to volume!
dydt_data = Fields.field_values(dydt)
dydt_data .=
RecursiveApply.rdiv.(dydt_data, Spaces.local_geometry_data(space).WJ)
dydt_data ./= Spaces.local_geometry_data(space).WJ

fill!(dydt_ref, 0.0)
add_face_ref!(dydt_ref, y0_ref, (n1, n2, parameters, Val(Nq)), 0.0)
Expand Down
1 change: 0 additions & 1 deletion docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ withenv("GKSwstype" => "nul") do
"Limiters" => "APIs/limiters_api.md",
"InputOutput" => "APIs/input_output_api.md",
"Remapping" => "APIs/remapping_api.md",
"RecursiveApply" => "APIs/recursive_apply_api.md",
"Devices" => "APIs/devices_api.md",
"DebugOnly" => "APIs/debug_only_api.md",
],
Expand Down
1 change: 1 addition & 0 deletions docs/src/APIs/geometry_api.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Geometry.LocalGeometry

```@docs
Geometry.Δz_metric_component
Geometry.:⊗
```

## Coordinates
Expand Down
9 changes: 0 additions & 9 deletions docs/src/APIs/recursive_apply_api.md

This file was deleted.

23 changes: 21 additions & 2 deletions docs/src/APIs/utilities_api.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,30 @@ CurrentModule = ClimaCore
```

```@docs
Utilities.PlusHalf
Utilities.half
Utilities.unionall_type
Utilities.replace_type_parameter
Utilities.fieldtype_vals
Utilities.new
Utilities.unsafe_eltype
Utilities.safe_eltype
```

## Utilities.PlusHalf

```@docs
Utilities.PlusHalf
Utilities.half
```

## Utilities.AutoBroadcaster

```@docs
Utilities.AutoBroadcaster
Utilities.is_auto_broadcastable
Utilities.add_auto_broadcasters
Utilities.drop_auto_broadcasters
Utilities.auto_broadcasted
Utilities.nested_broadcast
```

## Utilities.Cache
Expand Down
2 changes: 0 additions & 2 deletions docs/src/geometry.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,5 @@ CurrentModule = ClimaCore.Geometry

```@docs
mul_with_projection
rmul_with_projection
mul_return_type
rmul_return_type
```
14 changes: 5 additions & 9 deletions docs/src/matrix_fields.md
Original file line number Diff line number Diff line change
Expand Up @@ -210,15 +210,11 @@ J = MatrixFields.FieldMatrix((@name(f), @name(g))=> ∂f_∂g)

## Optimizations

Each entry of a `FieldMatrix` can be a `ColumnwiseBandMatrixField`, a `DiagonalMatrixRow`, or an
`UniformScaling`.

A `ColumnwiseBandMatrixField` is a `Field` with a `BandMatrixRow` at each point. It is intended
to represent a collection of banded matrices, where there is one band matrix for each column
of the space the `Field` is on. Beyond only storing the diagonals of the band matrix, an `entry`
can be optimized to use less memory. Each optimized representation can be indexed equivalently to
non optimized representations, and used in addition, subtraction, matrix-vector multiplication,
Matrix-matrix multiplication, `RecursiveApply`, and `FieldMatrixSolver`.
Each entry of a `FieldMatrix` can be a `ColumnwiseBandMatrixField`, a `DiagonalMatrixRow`, or a
`UniformScaling`. A `ColumnwiseBandMatrixField` is a `Field` with a `BandMatrixRow` at each point.
It represents a collection of banded matrices, with each column of the `Field` corresponding to a
specific matrix. If all columns correspond a constant multiple of the identity matrix, the `Field`
may be replaced with a `ScalingFieldMatrixEntry` (i.e., a `DiagonalMatrixRow` or `UniformScaling`).

For the following sections, `space` is a column space with $N_v$ levels. A column space is
used for simplicity in this example, but the optimizations work with any space with columns.
Expand Down
2 changes: 0 additions & 2 deletions docs/src/operators.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,6 @@ column_accumulate!
## Internal APIs

```@docs
getidx_return_type
stencil_return_type
return_eltype
return_space
stencil_interior_width
Expand Down
15 changes: 6 additions & 9 deletions examples/bickleyjet/bickleyjet_dg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,10 @@ import ClimaCore:
Geometry,
Meshes,
Operators,
RecursiveApply,
Spaces,
Quadratures,
Topologies
import ClimaCore.Geometry: ⊗
import ClimaCore.RecursiveApply: ⊞, rdiv, rmap

using OrdinaryDiffEqSSPRK: ODEProblem, solve, SSPRK33

Expand Down Expand Up @@ -106,8 +104,6 @@ roe_average(ρ⁻, ρ⁺, var⁻, var⁺) =
(sqrt(ρ⁻) * var⁻ + sqrt(ρ⁺) * var⁺) / (sqrt(ρ⁻) + sqrt(ρ⁺))

function roeflux(n, (y⁻, parameters⁻), (y⁺, parameters⁺))
Favg = rdiv(flux(y⁻, parameters⁻) ⊞ flux(y⁺, parameters⁺), 2)

λ = sqrt(parameters⁻.g)

ρ⁻, ρu⁻, ρθ⁻ = y⁻.ρ, y⁻.ρu, y⁻.ρθ
Expand Down Expand Up @@ -159,9 +155,11 @@ function roeflux(n, (y⁻, parameters⁻), (y⁺, parameters⁺))
(w1 * (u - c * n) + w2 * (u + c * n) + w3 * u + w4 * (Δu - Δuₙ * n)) *
0.5
fluxᵀn_ρθ = ((w1 + w2) * θ + w5) * 0.5

Δf = (ρ = -fluxᵀn_ρ, ρu = -fluxᵀn_ρu, ρθ = -fluxᵀn_ρθ)
rmap(f -> f' * n, Favg) ⊞ Δf

return map(flux(y⁻, parameters⁻), flux(y⁺, parameters⁺), Δf) do F⁻, F⁺, Δf
((F⁻ + F⁺) / 2)' * n + Δf
end
end


Expand Down Expand Up @@ -205,9 +203,8 @@ function rhs!(dydt, y, (parameters, numflux), t)
end

# 6. Solve for final result
dydt_data = Fields.field_values(dydt)
dydt_data .=
RecursiveApply.rdiv.(dydt_data, Spaces.local_geometry_data(space).WJ)
dydt_data =
Fields.field_values(dydt) ./ Spaces.local_geometry_data(space).WJ
M = Quadratures.cutoff_filter_matrix(
Float64,
Spaces.quadrature_style(space),
Expand Down
Loading
Loading