Skip to content

Commit 18db964

Browse files
committed
Register the lazy-composition test in CI and cover the lazy path
Adds CPU and CUDA Buildkite steps for the new test, an assertion using LazyBroadcast.lazy alongside the explicit instantiate, and trims the style-rule comment.
1 parent a1a8145 commit 18db964

3 files changed

Lines changed: 20 additions & 4 deletions

File tree

.buildkite/pipeline.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -705,6 +705,11 @@ steps:
705705
retry: *retry_policy
706706
command: "julia --color=yes --check-bounds=yes --project=.buildkite test/Operators/spectralelement/rectilinear.jl"
707707

708+
- label: "Unit: lazy composition"
709+
key: unit_lazy_composition
710+
retry: *retry_policy
711+
command: "julia --color=yes --check-bounds=yes --project=.buildkite test/Operators/spectralelement/lazy_composition.jl"
712+
708713
- label: "Unit: diffusion2d"
709714
key: unit_diffusion2d
710715
retry: *retry_policy
@@ -926,6 +931,15 @@ steps:
926931
agents:
927932
slurm_gpus: 1
928933

934+
- label: "Unit: lazy composition cuda"
935+
key: unit_lazy_composition_cuda
936+
retry: *retry_policy
937+
command: "julia --color=yes --check-bounds=yes --project=.buildkite test/Operators/spectralelement/lazy_composition.jl"
938+
env:
939+
CLIMACOMMS_DEVICE: "CUDA"
940+
agents:
941+
slurm_gpus: 1
942+
929943
- label: "Unit: operators on levels and extruded spaces"
930944
key: unit_cuda_operators_example
931945
retry: *retry_policy

src/Operators/spectralelement.jl

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -507,10 +507,8 @@ Base.Broadcast.BroadcastStyle(
507507
::Fields.AbstractFieldStyle,
508508
) = style
509509

510-
# The device-resolved style assigned by `instantiate` takes precedence over the
511-
# generic construction-time style, so an instantiated spectral broadcast can be
512-
# used as an argument to a new operator broadcast. See the finite-difference
513-
# analogue for `ColumnStencilStyle` in the CUDA extension.
510+
# The device-resolved style assigned by `instantiate` takes precedence over
511+
# the generic construction-time style.
514512
Base.Broadcast.BroadcastStyle(
515513
::SpectralStyle,
516514
style::AbstractSpectralStyle,

test/Operators/spectralelement/lazy_composition.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import ClimaCore:
1212
Quadratures
1313
import ClimaCore.Operators as O
1414
import Base.Broadcast as BB
15+
import LazyBroadcast: lazy
1516
using LinearAlgebra, IntervalSets
1617

1718
@testset "spectral broadcast style combination" begin
@@ -48,4 +49,7 @@ end
4849
)
4950
out = @. wdiv(K * ∇f)
5051
@test parent(out) 2 .* parent(ref)
52+
∇f_lazy = @. lazy(grad(f) + grad(f))
53+
out_lazy = @. wdiv(K * ∇f_lazy)
54+
@test parent(out_lazy) 2 .* parent(ref)
5155
end

0 commit comments

Comments
 (0)