Skip to content

Commit

Permalink
Merge pull request #1867 from CliMA/ck/leaky_tests2
Browse files Browse the repository at this point in the history
Progress towards leaky tests
  • Loading branch information
charleskawczynski authored Jul 3, 2024
2 parents ea976a6 + 82b17e1 commit f9d110a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
5 changes: 3 additions & 2 deletions test/Spaces/ddss1.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ import ClimaCore:

using ClimaComms
ClimaComms.@import_required_backends
const device = ClimaComms.device()
const context = ClimaComms.SingletonCommsContext(device)

function distributed_space(
(n1, n2),
Expand All @@ -30,6 +28,8 @@ function distributed_space(
x2min = -2π,
x2max = 2π,
)
device = ClimaComms.device()
context = ClimaComms.SingletonCommsContext(device)
domain = Domains.RectangleDomain(
Domains.IntervalDomain(
Geometry.XPoint(x1min),
Expand Down Expand Up @@ -124,6 +124,7 @@ end
@testset "4x1 element mesh on 1 process - vector field" begin
Nq = 3
space, comms_ctx = distributed_space((4, 1), (true, true), (Nq, 1, 2))
device = ClimaComms.device(comms_ctx)
y0 = init_state_vector.(Fields.local_geometry_field(space), Ref(nothing))
yx = copy(y0)

Expand Down
13 changes: 9 additions & 4 deletions test/Spaces/sphere.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ using Test
@testset "Sphere" begin
for FT in (Float64, Float32)
context = ClimaComms.SingletonCommsContext()
device = ClimaComms.device(context)
radius = FT(3)
ne = 4
Nq = 4
Expand Down Expand Up @@ -43,13 +44,17 @@ using Test
# total nodes
nn = 6 * ne^2 * Nq^2
# unique nodes
@test length(collect(Spaces.unique_nodes(space))) ==
nn - nn2 - 2 * nn3 - 3 * nn4
if device isa ClimaComms.AbstractCPUDevice
@test length(collect(Spaces.unique_nodes(space))) ==
nn - nn2 - 2 * nn3 - 3 * nn4
end

point_space = column(space, 1, 1, 1)
@test point_space isa Spaces.PointSpace
@test Spaces.coordinates_data(point_space)[] ==
column(Spaces.coordinates_data(space), 1, 1, 1)[]
ClimaComms.allowscalar(device) do
@test Spaces.coordinates_data(point_space)[] ==
column(Spaces.coordinates_data(space), 1, 1, 1)[]
end
end
end

Expand Down
5 changes: 4 additions & 1 deletion test/Topologies/cubedsphere.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ using ClimaComms
using ClimaCore: Geometry, Domains, Meshes, Topologies
using Test

const context = ClimaComms.SingletonCommsContext(ClimaComms.CPUSingleThreaded())

@testset "neighboring element tests" begin
context = ClimaComms.SingletonCommsContext(ClimaComms.CPUSingleThreaded())
@testset "1 element across each panel" begin
topology = Topologies.Topology2D(
context,
Expand Down Expand Up @@ -37,6 +37,7 @@ const context = ClimaComms.SingletonCommsContext(ClimaComms.CPUSingleThreaded())
end

@testset "interior faces iterator" begin
context = ClimaComms.SingletonCommsContext(ClimaComms.CPUSingleThreaded())
@testset "1 element across each panel" begin
topology = Topologies.Topology2D(
context,
Expand All @@ -54,6 +55,7 @@ end
end

@testset "boundaries" begin
context = ClimaComms.SingletonCommsContext(ClimaComms.CPUSingleThreaded())
@testset "1 element across each panel" begin
topology = Topologies.Topology2D(
context,
Expand All @@ -71,6 +73,7 @@ end
end

@testset "boundaries" begin
context = ClimaComms.SingletonCommsContext(ClimaComms.CPUSingleThreaded())
@testset "1 element across each panel" begin
topology = Topologies.Topology2D(
context,
Expand Down

0 comments on commit f9d110a

Please sign in to comment.