From d8ee3949b11d8624f1a35982e240b89ef4b3a2ac Mon Sep 17 00:00:00 2001 From: Simone Silvestri Date: Sun, 12 Jan 2025 22:31:32 -0100 Subject: [PATCH] more allowscalars --- test/test_hydrostatic_free_surface_immersed_boundaries.jl | 8 ++++---- test/test_implicit_free_surface_solver.jl | 2 +- test/test_jld2_output_writer.jl | 2 -- test/test_simulations.jl | 6 +++--- test/test_vertical_vorticity_field.jl | 2 +- 5 files changed, 9 insertions(+), 11 deletions(-) diff --git a/test/test_hydrostatic_free_surface_immersed_boundaries.jl b/test/test_hydrostatic_free_surface_immersed_boundaries.jl index 887c55e3f1..1f6c17c85f 100644 --- a/test/test_hydrostatic_free_surface_immersed_boundaries.jl +++ b/test/test_hydrostatic_free_surface_immersed_boundaries.jl @@ -37,16 +37,16 @@ using Oceananigans.TurbulenceClosures set!(model, u = 1, b = (x, y, z) -> 4z) # Inside the bump - @test b[4, 4, 2] == 0 - @test u[4, 4, 2] == 0 + CUDA.@allowscalar @test b[4, 4, 2] == 0 + CUDA.@allowscalar @test u[4, 4, 2] == 0 simulation = Simulation(model, Δt = 1e-3, stop_iteration=2) run!(simulation) # Inside the bump - @test b[4, 4, 2] == 0 - @test u[4, 4, 2] == 0 + CUDA.@allowscalar @test b[4, 4, 2] == 0 + CUDA.@allowscalar @test u[4, 4, 2] == 0 end end diff --git a/test/test_implicit_free_surface_solver.jl b/test/test_implicit_free_surface_solver.jl index 7aa6f254e7..3fa7a86fa5 100644 --- a/test/test_implicit_free_surface_solver.jl +++ b/test/test_implicit_free_surface_solver.jl @@ -28,7 +28,7 @@ function set_simple_divergent_velocity!(model) # pick a surface cell at the middle of the domain i, j, k = Int(floor(grid.Nx / 2)) + 1, Int(floor(grid.Ny / 2)) + 1, grid.Nz - inactive_cell(i, j, k, grid) && error("The nudged cell at ($i, $j, $k) is inactive.") + CUDA.@allowscalar inactive_cell(i, j, k, grid) && error("The nudged cell at ($i, $j, $k) is inactive.") Δy = CUDA.@allowscalar Δyᶜᶠᶜ(i, j, k, grid) Δz = CUDA.@allowscalar Δzᶜᶠᶜ(i, j, k, grid) diff --git a/test/test_jld2_output_writer.jl b/test/test_jld2_output_writer.jl index 325a1cf994..5a86dfd13a 100644 --- a/test/test_jld2_output_writer.jl +++ b/test/test_jld2_output_writer.jl @@ -386,8 +386,6 @@ for arch in archs filename = "sliced_func_fields_jld2_test", overwrite_existing = true) - - u₀ = CUDA.@allowscalar model.velocities.u[3, 3, 3] v₀ = CUDA.@allowscalar model.velocities.v[3, 3, 3] w₀ = CUDA.@allowscalar model.velocities.w[3, 3, 3] diff --git a/test/test_simulations.jl b/test/test_simulations.jl index 6164153475..d0fe967a25 100644 --- a/test/test_simulations.jl +++ b/test/test_simulations.jl @@ -19,7 +19,7 @@ function wall_time_step_wizard_tests(arch) CFL = 0.45 u₀ = 7 Δt = 2.5 - model.velocities.u[1, 1, 1] = u₀ + CUDA.@allowscalar model.velocities.u[1, 1, 1] = u₀ wizard = TimeStepWizard(cfl=CFL, max_change=Inf, min_change=0) Δt = new_time_step(Δt, wizard, model) @@ -33,7 +33,7 @@ function wall_time_step_wizard_tests(arch) Δt = new_time_step(Δt, wizard, model) @test Δt ≈ 1.99 - model.velocities.u[1, 1, 1] = u₀/100 + CUDA.@allowscalar model.velocities.u[1, 1, 1] = u₀/100 wizard = TimeStepWizard(cfl=CFL, max_change=1.1, min_change=0) Δt = new_time_step(1.0, wizard, model) @@ -192,7 +192,7 @@ function run_nan_checker_test(arch; erroring) grid = RectilinearGrid(arch, size=(4, 2, 1), extent=(1, 1, 1)) model = NonhydrostaticModel(grid=grid) simulation = Simulation(model, Δt=1, stop_iteration=1) - model.velocities.u[1, 1, 1] = NaN + CUDA.@allowscalar model.velocities.u[1, 1, 1] = NaN erroring && erroring_NaNChecker!(simulation) if erroring diff --git a/test/test_vertical_vorticity_field.jl b/test/test_vertical_vorticity_field.jl index 86e990f190..250770d689 100644 --- a/test/test_vertical_vorticity_field.jl +++ b/test/test_vertical_vorticity_field.jl @@ -20,7 +20,7 @@ using Oceananigans.Models.HydrostaticFreeSurfaceModels: VerticalVorticityField, compute!(ζ) - @test all(isfinite.(ζ.data)) + CUDA.@allowscalar @test all(isfinite.(ζ.data)) end end end