From 6bac83d68809ef6e42ce27b702e9600b3b06977d Mon Sep 17 00:00:00 2001 From: Simone Silvestri <33547697+simone-silvestri@users.noreply.github.com> Date: Fri, 1 Mar 2024 15:49:48 -0500 Subject: [PATCH 1/2] bugfix --- test/test_distributed_hydrostatic_model.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_distributed_hydrostatic_model.jl b/test/test_distributed_hydrostatic_model.jl index 8511a4c8ad..dc2b7b5d6e 100644 --- a/test/test_distributed_hydrostatic_model.jl +++ b/test/test_distributed_hydrostatic_model.jl @@ -79,7 +79,7 @@ Ny = 32 for arch in archs @testset "Testing distributed solid body rotation" begin grid = LatitudeLongitudeGrid(arch, size = (Nx, Ny, 1), - halo = (3, 3, 3), + halo = (4, 4, 4), latitude = (-80, 80), longitude = (-160, 160), z = (-1, 0), From fa524cbb45c7e7ce8d5efa490c6ea632d4130c63 Mon Sep 17 00:00:00 2001 From: Simone Silvestri <33547697+simone-silvestri@users.noreply.github.com> Date: Wed, 6 Mar 2024 11:12:45 -0500 Subject: [PATCH 2/2] allow interpolation on Distributed --- src/Fields/interpolate.jl | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Fields/interpolate.jl b/src/Fields/interpolate.jl index 67b828e975..05f62a1406 100644 --- a/src/Fields/interpolate.jl +++ b/src/Fields/interpolate.jl @@ -7,6 +7,8 @@ using Oceananigans.Grids: topology, node, ZRegOrthogonalSphericalShellGrid, RectilinearGrid, LatitudeLongitudeGrid +using Oceananigans.Architectures: child_architecture + # GPU-compatile middle point calculation @inline middle_point(l, h) = Base.unsafe_trunc(Int, (l + h) / 2) @@ -313,6 +315,12 @@ function interpolate!(to_field::Field, from_field::AbstractField) to_arch = architecture(to_field) from_arch = architecture(from_field) + + # In case architectures are `Distributed` we + # verify that the fields are on the same child architecture + to_arch = child_architecture(to_arch) + from_arch = child_architecture(from_arch) + if !isnothing(from_arch) && to_arch != from_arch msg = "Cannot interpolate! because from_field is on $from_arch while to_field is on $to_arch." throw(ArgumentError(msg))