From a6bc5814786d82ea11aa9293ecc012655c9bc3d1 Mon Sep 17 00:00:00 2001 From: Charles Kawczynski Date: Mon, 17 Jul 2023 11:47:24 -0700 Subject: [PATCH] Add cuda spaces tests --- .buildkite/pipeline.yml | 8 ++++++++ test/Spaces/spaces.jl | 16 +++++++++++----- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index c46e163ccc..35013be3a6 100755 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -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: diff --git a/test/Spaces/spaces.jl b/test/Spaces/spaces.jl index 1ef252fffe..5faa04ddb7 100644 --- a/test/Spaces/spaces.jl +++ b/test/Spaces/spaces.jl @@ -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), @@ -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), @@ -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 @@ -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π),