Skip to content

Workaround for submodule-related bug in GFortran-9 #59

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Dependencies:

Compilers tested include:

* gfortran-10.3.0
* gfortran-9.4.0
* ifort-2021.4
* ifx-2021.4

Expand Down
12 changes: 6 additions & 6 deletions src/mod_parallel_submodule.f90
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down