Skip to content

Commit 1d6fa05

Browse files
authored
Merge pull request #59 from milancurcic/function-definitions-in-submodules
Workaround for submodule-related bug in GFortran-9
2 parents 5d65db1 + 91a1ef8 commit 1d6fa05

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ Dependencies:
4545

4646
Compilers tested include:
4747

48-
* gfortran-10.3.0
48+
* gfortran-9.4.0
4949
* ifort-2021.4
5050
* ifx-2021.4
5151

src/mod_parallel_submodule.f90

+6-6
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,22 @@
55

66
contains
77

8-
pure module function tile_indices(dims)
8+
pure module function tile_indices(dims) result(res)
99
integer(ik), intent(in) :: dims
10-
integer(ik) :: tile_indices(2)
10+
integer(ik) :: res(2)
1111
integer(ik) :: offset, tile_size
1212

1313
tile_size = dims / num_images()
1414

1515
!! start and end indices assuming equal tile sizes
16-
tile_indices(1) = (this_image() - 1) * tile_size + 1
17-
tile_indices(2) = tile_indices(1) + tile_size - 1
16+
res(1) = (this_image() - 1) * tile_size + 1
17+
res(2) = res(1) + tile_size - 1
1818

1919
!! if we have any remainder, distribute it to the tiles at the end
2020
offset = num_images() - mod(dims, num_images())
2121
if (this_image() > offset) then
22-
tile_indices(1) = tile_indices(1) + this_image() - offset - 1
23-
tile_indices(2) = tile_indices(2) + this_image() - offset
22+
res(1) = res(1) + this_image() - offset - 1
23+
res(2) = res(2) + this_image() - offset
2424
end if
2525

2626
end function tile_indices

0 commit comments

Comments
 (0)