From 91a1ef8d525caee6ac9a4854668ff021d0b0e628 Mon Sep 17 00:00:00 2001 From: Milan Curcic Date: Tue, 3 May 2022 17:15:12 -0400 Subject: [PATCH] Workaround for submodule-related bug in GFortran-9; now supports GFortran-9.4.0 --- README.md | 2 +- src/mod_parallel_submodule.f90 | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 1233bf5e..27d943b0 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ Dependencies: Compilers tested include: -* gfortran-10.3.0 +* gfortran-9.4.0 * ifort-2021.4 * ifx-2021.4 diff --git a/src/mod_parallel_submodule.f90 b/src/mod_parallel_submodule.f90 index 9f7cb9ce..3b6e1d44 100644 --- a/src/mod_parallel_submodule.f90 +++ b/src/mod_parallel_submodule.f90 @@ -5,22 +5,22 @@ contains - pure module function tile_indices(dims) + pure module function tile_indices(dims) result(res) integer(ik), intent(in) :: dims - integer(ik) :: tile_indices(2) + integer(ik) :: res(2) integer(ik) :: offset, tile_size tile_size = dims / num_images() !! start and end indices assuming equal tile sizes - tile_indices(1) = (this_image() - 1) * tile_size + 1 - tile_indices(2) = tile_indices(1) + tile_size - 1 + res(1) = (this_image() - 1) * tile_size + 1 + res(2) = res(1) + tile_size - 1 !! if we have any remainder, distribute it to the tiles at the end offset = num_images() - mod(dims, num_images()) if (this_image() > offset) then - tile_indices(1) = tile_indices(1) + this_image() - offset - 1 - tile_indices(2) = tile_indices(2) + this_image() - offset + res(1) = res(1) + this_image() - offset - 1 + res(2) = res(2) + this_image() - offset end if end function tile_indices