From 9c45d90a29e1dc3b2a12fd3e681eff0ebb6d26c5 Mon Sep 17 00:00:00 2001 From: Gabriele Bozzola Date: Tue, 12 Mar 2024 11:56:23 -0700 Subject: [PATCH] Force allocation for interpolate on CPU MPI.reduce does not always allocate a new array. As a result, the remapper in interpolate calls may retain ownership of the output array --- NEWS.md | 6 ++++++ src/Remapping/distributed_remapping.jl | 17 ----------------- 2 files changed, 6 insertions(+), 17 deletions(-) diff --git a/NEWS.md b/NEWS.md index 3f43bee299..9c0b57f38e 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,6 +1,12 @@ ClimaCore.jl Release Notes ======================== +v0.13.2 +------- + +- ![][badge-🐛bugfix] fixed array allocation for interpolation on CPU. + PR [#1643](https://github.com/CliMA/ClimaCore.jl/pull/1643). + v0.13.1 ------- diff --git a/src/Remapping/distributed_remapping.jl b/src/Remapping/distributed_remapping.jl index 0db4b1e907..c399a424a3 100644 --- a/src/Remapping/distributed_remapping.jl +++ b/src/Remapping/distributed_remapping.jl @@ -679,23 +679,6 @@ interpolated data. `_collect_and_return_interpolated_values!` is type-unstable and allocates new return arrays. """ function _collect_and_return_interpolated_values!(remapper::Remapper) - return _collect_and_return_interpolated_values!( - remapper::Remapper, - ClimaComms.device(remapper.comms_ctx), - ) -end - -function _collect_and_return_interpolated_values!( - remapper::Remapper, - ::ClimaComms.AbstractCPUDevice, -) - ClimaComms.reduce(remapper.comms_ctx, remapper._interpolated_values, +) -end - -function _collect_and_return_interpolated_values!( - remapper::Remapper, - ::ClimaComms.CUDADevice, -) ClimaComms.reduce!(remapper.comms_ctx, remapper._interpolated_values, +) return ClimaComms.iamroot(remapper.comms_ctx) ? Array(remapper._interpolated_values) : nothing