Skip to content

Commit b2a597f

Browse files
authored
add float types (#4592)
1 parent 1d83f4b commit b2a597f

File tree

1 file changed

+29
-25
lines changed

1 file changed

+29
-25
lines changed

test/test_amdgpu.jl

Lines changed: 29 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -5,29 +5,33 @@ using AMDGPU
55
@testset "AMDGPU extension" begin
66
roc = AMDGPU.ROCBackend()
77
arch = GPU(roc)
8-
grid = RectilinearGrid(arch, size=(4, 8, 16), x=[0, 1, 2, 3, 4], y=(0, 1), z=(0, 16))
9-
10-
@test parent(grid.xᶠᵃᵃ) isa ROCArray
11-
@test parent(grid.xᶜᵃᵃ) isa ROCArray
12-
@test eltype(grid) == Float64
13-
@test architecture(grid) isa GPU
14-
15-
model = HydrostaticFreeSurfaceModel(; grid,
16-
coriolis = FPlane(latitude=45),
17-
buoyancy = BuoyancyTracer(),
18-
tracers = :b,
19-
momentum_advection = WENO(order=5),
20-
tracer_advection = WENO(order=5),
21-
free_surface = SplitExplicitFreeSurface(grid; substeps=60))
22-
23-
@test parent(model.velocities.u) isa ROCArray
24-
@test parent(model.velocities.v) isa ROCArray
25-
@test parent(model.velocities.w) isa ROCArray
26-
@test parent(model.tracers.b) isa ROCArray
27-
28-
simulation = Simulation(model, Δt=1minute, stop_iteration=3)
29-
run!(simulation)
30-
31-
@test iteration(simulation) == 3
32-
@test time(simulation) == 3minutes
8+
9+
for FT in float_types
10+
@info " Testing on $arch with $FT"
11+
12+
grid = RectilinearGrid(arch, FT, size=(4, 8, 16), x=[0, 1, 2, 3, 4], y=(0, 1), z=(0, 16))
13+
14+
@test parent(grid.xᶠᵃᵃ) isa ROCArray
15+
@test parent(grid.xᶜᵃᵃ) isa ROCArray
16+
@test eltype(grid) == FT
17+
@test architecture(grid) isa GPU
18+
19+
model = HydrostaticFreeSurfaceModel(; grid,
20+
coriolis = FPlane(latitude=45),
21+
buoyancy = BuoyancyTracer(),
22+
tracers = :b,
23+
momentum_advection = WENO(order=5),
24+
tracer_advection = WENO(order=5),
25+
free_surface = SplitExplicitFreeSurface(grid; substeps=60))
26+
27+
for field in merge(model.velocities, model.tracers)
28+
@test parent(field) isa ROCArray
29+
end
30+
31+
simulation = Simulation(model, Δt=1minute, stop_iteration=3)
32+
run!(simulation)
33+
34+
@test iteration(simulation) == 3
35+
@test time(simulation) == 3minutes
36+
end
3337
end

0 commit comments

Comments
 (0)