Skip to content

Commit 94435cf

Browse files
Break up Fields unit tests
1 parent b9714ab commit 94435cf

File tree

5 files changed

+423
-349
lines changed

5 files changed

+423
-349
lines changed

.buildkite/pipeline.yml

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -486,18 +486,18 @@ steps:
486486
key: unit_field
487487
command:
488488
- "julia --color=yes --check-bounds=yes --project=.buildkite test/Fields/unit_field.jl"
489-
- "julia --color=yes --check-bounds=yes --project=.buildkite test/Fields/benchmark_field_multi_broadcast_fusion.jl"
489+
- "julia --color=yes --check-bounds=yes --project=.buildkite test/Fields/unit_fieldvector.jl"
490+
- "julia --color=yes --check-bounds=yes --project=.buildkite test/Fields/unit_field_multi_broadcast_fusion.jl"
490491
- "julia --color=yes --check-bounds=yes --project=.buildkite test/Fields/convergence_field_integrals.jl"
491-
- "julia --color=yes --check-bounds=yes --project=.buildkite test/Fields/inference_repro.jl"
492492

493493
- label: "Unit: field cuda"
494494
key: unit_field_cuda
495495
command:
496496
- "julia --project=.buildkite -e 'using CUDA; CUDA.versioninfo()'"
497497
- "julia --color=yes --check-bounds=yes --project=.buildkite test/Fields/unit_field.jl"
498-
- "julia --color=yes --check-bounds=yes --project=.buildkite test/Fields/benchmark_field_multi_broadcast_fusion.jl"
498+
- "julia --color=yes --check-bounds=yes --project=.buildkite test/Fields/unit_fieldvector.jl"
499+
- "julia --color=yes --check-bounds=yes --project=.buildkite test/Fields/unit_field_multi_broadcast_fusion.jl"
499500
- "julia --color=yes --check-bounds=yes --project=.buildkite test/Fields/convergence_field_integrals.jl"
500-
- "julia --color=yes --check-bounds=yes --project=.buildkite test/Fields/inference_repro.jl"
501501
env:
502502
CLIMACOMMS_DEVICE: "CUDA"
503503
agents:
@@ -1257,9 +1257,26 @@ steps:
12571257
- group: "Perf: Fields"
12581258
steps:
12591259

1260-
- label: "Perf: Field broadcast"
1261-
key: "cpu_field_perf"
1262-
command: "julia --color=yes --project=.buildkite test/Fields/field_opt.jl"
1260+
- label: "Perf: Field"
1261+
key: cpu_field_perf
1262+
command:
1263+
- "julia --color=yes --project=.buildkite test/Fields/field_opt.jl"
1264+
- "julia --color=yes --project=.buildkite test/Fields/benchmark_field_multi_broadcast_fusion.jl"
1265+
- "julia --color=yes --project=.buildkite test/Fields/inference_repro.jl"
1266+
agents:
1267+
slurm_mem: 20GB
1268+
1269+
- label: "GPU Perf: Field"
1270+
key: gpu_field_perf
1271+
command:
1272+
- "julia --color=yes --project=.buildkite test/Fields/field_opt.jl"
1273+
- "julia --color=yes --project=.buildkite test/Fields/benchmark_field_multi_broadcast_fusion.jl"
1274+
- "julia --color=yes --project=.buildkite test/Fields/inference_repro.jl"
1275+
env:
1276+
CLIMACOMMS_DEVICE: "CUDA"
1277+
agents:
1278+
slurm_mem: 20GB
1279+
slurm_gpus: 1
12631280

12641281
- group: "Perf: Benchmark scripts"
12651282
steps:

test/Fields/field_opt.jl

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -393,49 +393,4 @@ using JET
393393
@test_opt ifelsekernel!(S, ρ)
394394
end
395395

396-
@testset "dss of FieldVectors" begin
397-
function field_vec(center_space, face_space)
398-
Y = Fields.FieldVector(
399-
c = map(Fields.coordinate_field(center_space)) do coord
400-
FT = Spaces.undertype(center_space)
401-
(;
402-
ρ = FT(coord.lat + coord.long),
403-
uₕ = Geometry.Covariant12Vector(
404-
FT(coord.lat),
405-
FT(coord.long),
406-
),
407-
)
408-
end,
409-
f = map(Fields.coordinate_field(face_space)) do coord
410-
FT = Spaces.undertype(face_space)
411-
(; w = Geometry.Covariant3Vector(FT(coord.lat + coord.long)))
412-
end,
413-
)
414-
return Y
415-
end
416-
417-
fv = field_vec(toy_sphere(Float64)...)
418-
419-
c_copy = copy(getproperty(fv, :c))
420-
f_copy = copy(getproperty(fv, :f))
421-
422-
# Test that dss_buffer is created and has the correct keys
423-
dss_buffer = Spaces.create_dss_buffer(fv)
424-
@test haskey(dss_buffer, :c)
425-
@test haskey(dss_buffer, :f)
426-
427-
# Test weighted_dss! with and without preallocated buffer
428-
Spaces.weighted_dss!(fv, dss_buffer)
429-
@test getproperty(fv, :c) Spaces.weighted_dss!(c_copy)
430-
@test getproperty(fv, :f) Spaces.weighted_dss!(f_copy)
431-
432-
fv = field_vec(toy_sphere(Float64)...)
433-
c_copy = copy(getproperty(fv, :c))
434-
f_copy = copy(getproperty(fv, :f))
435-
436-
Spaces.weighted_dss!(fv)
437-
@test getproperty(fv, :c) Spaces.weighted_dss!(c_copy)
438-
@test getproperty(fv, :f) Spaces.weighted_dss!(f_copy)
439-
end
440-
441396
nothing

0 commit comments

Comments
 (0)