Skip to content

Commit 08ca81f

Browse files
Fix adapt for new limiters, test on gpu
1 parent 6040306 commit 08ca81f

File tree

3 files changed

+32
-16
lines changed

3 files changed

+32
-16
lines changed

.buildkite/pipeline.yml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1454,21 +1454,32 @@ steps:
14541454
- "julia --color=yes --project=.buildkite examples/column/fct_advection.jl"
14551455
artifact_paths:
14561456
- "examples/column/output/fct_advection/*"
1457-
1457+
14581458
- label: ":computer: Column TVD Slope-limited Advection Eq"
14591459
key: "cpu_tvd_column_advect"
14601460
command:
14611461
- "julia --color=yes --project=.buildkite examples/column/tvd_advection.jl"
14621462
artifact_paths:
14631463
- "examples/column/output/tvd_advection/*"
1464-
1464+
14651465
- label: ":computer: Column Lin vanLeer Limiter Advection Eq"
14661466
key: "cpu_lvl_column_advect"
14671467
command:
14681468
- "julia --color=yes --project=.buildkite examples/column/vanleer_advection.jl"
14691469
artifact_paths:
14701470
- "examples/column/output/vanleer_advection/*"
14711471

1472+
- label: ":computer: Column Lin vanLeer Limiter Advection Eq cuda"
1473+
key: "gpu_lvl_column_advect"
1474+
command:
1475+
- "julia --color=yes --project=.buildkite examples/column/vanleer_advection.jl"
1476+
artifact_paths:
1477+
- "examples/column/output/vanleer_advection/*"
1478+
env:
1479+
CLIMACOMMS_DEVICE: "CUDA"
1480+
agents:
1481+
slurm_gpus: 1
1482+
14721483
- label: ":computer: Column BB FCT Advection Eq"
14731484
key: "cpu_bb_fct_column_advect"
14741485
command:

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "ClimaCore"
22
uuid = "d414da3d-4745-48bb-8d80-42e94e092884"
33
authors = ["CliMA Contributors <[email protected]>"]
4-
version = "0.14.21"
4+
version = "0.14.22"
55

66
[deps]
77
Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"

src/Operators/finitedifference.jl

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3061,19 +3061,24 @@ function Adapt.adapt_structure(to, bc::AbstractBoundaryCondition)
30613061
end
30623062

30633063
# Extend `adapt_structure` for all operator types with boundary conditions.
3064-
function Adapt.adapt_structure(to, op::FiniteDifferenceOperator)
3065-
if hasfield(typeof(op), :bcs)
3066-
bcs_adapted = NamedTuple{keys(op.bcs)}(
3067-
UnrolledFunctions.unrolled_map(
3068-
bc -> Adapt.adapt_structure(to, bc),
3069-
values(op.bcs),
3070-
),
3071-
)
3072-
return unionall_type(typeof(op))(bcs_adapted)
3073-
else
3074-
return op
3075-
end
3076-
end
3064+
Adapt.adapt_structure(to, op::FiniteDifferenceOperator) =
3065+
hasfield(typeof(op), :bcs) ? adapt_fd_operator(to, op, op.bcs) : op
3066+
3067+
@inline adapt_fd_operator(to, op::LinVanLeerC2F, bcs) =
3068+
LinVanLeerC2F(adapt_bcs(to, bcs), Adapt.adapt_structure(to, op.constraint))
3069+
3070+
@inline adapt_fd_operator(to, op::TVDLimitedFluxC2F, bcs) =
3071+
TVDLimitedFluxC2F(adapt_bcs(to, bcs), Adapt.adapt_structure(to, op.method))
3072+
3073+
@inline adapt_fd_operator(to, op, bcs) =
3074+
unionall_type(typeof(op))(adapt_bcs(to, bcs))
3075+
3076+
@inline adapt_bcs(to, bcs) = NamedTuple{keys(bcs)}(
3077+
UnrolledFunctions.unrolled_map(
3078+
bc -> Adapt.adapt_structure(to, bc),
3079+
values(bcs),
3080+
),
3081+
)
30773082

30783083
"""
30793084
D = DivergenceC2F(;boundaryname=boundarycondition...)

0 commit comments

Comments
 (0)