Skip to content

Commit

Permalink
Merge #1382
Browse files Browse the repository at this point in the history
1382: Add cuda spaces tests r=charleskawczynski a=charleskawczynski

In light of #1381, I thought we ought to add cuda tests for our Spaces unit tests, too.

Co-authored-by: Charles Kawczynski <[email protected]>
  • Loading branch information
bors[bot] and charleskawczynski committed Jul 19, 2023
2 parents 0e7a5f9 + a6bc581 commit 0bb6be8
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
8 changes: 8 additions & 0 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,14 @@ steps:
key: unit_spaces
command: "julia --color=yes --check-bounds=yes --project=test test/Spaces/spaces.jl"

- label: "Unit: spaces cuda"
key: unit_spaces_cuda
command:
- "julia --project -e 'using CUDA; CUDA.versioninfo()'"
- "julia --color=yes --check-bounds=yes --project=test test/Spaces/spaces.jl"
agents:
slurm_gpus: 1

- label: "Unit: distributed cuda spaces"
key: "gpu_distributed_extruded_cuda_spaces"
command:
Expand Down
16 changes: 11 additions & 5 deletions test/Spaces/spaces.jl
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ end

@testset "finite difference space" begin
FT = Float64
context = ClimaComms.SingletonCommsContext(ClimaComms.CPUSingleThreaded())
device = ClimaComms.device()
context = ClimaComms.SingletonCommsContext(device)
domain = Domains.IntervalDomain(
Geometry.ZPoint{FT}(0) .. Geometry.ZPoint{FT}(5),
boundary_names = (:bottom, :top),
Expand Down Expand Up @@ -140,7 +141,8 @@ end

@testset "1×1 domain space" begin
FT = Float32
context = ClimaComms.SingletonCommsContext(ClimaComms.CPUSingleThreaded())
device = ClimaComms.device()
context = ClimaComms.SingletonCommsContext(device)
domain = Domains.RectangleDomain(
Geometry.XPoint{FT}(-3) .. Geometry.XPoint{FT}(5),
Geometry.YPoint{FT}(-2) .. Geometry.YPoint{FT}(8),
Expand Down Expand Up @@ -187,8 +189,11 @@ end
@test length(space.boundary_surface_geometries) == 2
@test keys(space.boundary_surface_geometries) == (:south, :north)
@test sum(parent(space.boundary_surface_geometries.north.sWJ)) 8
@test parent(space.boundary_surface_geometries.north.normal)[1, :, 1]
[0.0, 1.0]
@test Array(parent(space.boundary_surface_geometries.north.normal))[
1,
:,
1,
] [0.0, 1.0]

point_space = Spaces.column(space, 1, 1, 1)
@test point_space isa Spaces.PointSpace
Expand All @@ -197,7 +202,8 @@ end
end

@testset "2D perimeter iterator on 2×2 rectangular mesh" begin
context = ClimaComms.SingletonCommsContext()
device = ClimaComms.device()
context = ClimaComms.SingletonCommsContext(device)
domain = Domains.RectangleDomain(
Domains.IntervalDomain(
Geometry.XPoint(-2π),
Expand Down

0 comments on commit 0bb6be8

Please sign in to comment.