From 42f8506512e1b5b43982320f5b9d4ca1ca9cbebd Mon Sep 17 00:00:00 2001 From: Alex Huth Date: Thu, 9 May 2024 13:33:56 -0400 Subject: [PATCH] fix: use mpp_gather to improve iceberg restart read times (#1460) --- fms2_io/netcdf_io.F90 | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/fms2_io/netcdf_io.F90 b/fms2_io/netcdf_io.F90 index 07959401c..962076d5a 100644 --- a/fms2_io/netcdf_io.F90 +++ b/fms2_io/netcdf_io.F90 @@ -838,16 +838,9 @@ subroutine register_unlimited_compressed_axis(fileobj, dimension_name, dimension !Gather all local dimension lengths on the I/O root pe. allocate(npes_start(size(fileobj%pelist))) allocate(npes_count(size(fileobj%pelist))) - do i = 1, size(fileobj%pelist) - if (fileobj%pelist(i) .eq. mpp_pe()) then - npes_count(i) = dimension_length - else - call mpp_recv(npes_count(i), fileobj%pelist(i), block=.false.) - call mpp_send(dimension_length, fileobj%pelist(i)) - endif - enddo - call mpp_sync_self(check=event_recv) - call mpp_sync_self(check=event_send) + + call mpp_gather((/dimension_length/),npes_count,pelist=fileobj%pelist) + npes_start(1) = 1 do i = 1, size(fileobj%pelist)-1 npes_start(i+1) = npes_start(i) + npes_count(i)