@@ -6,28 +6,16 @@ module mod_parallel
6
6
private
7
7
public :: tile_indices
8
8
9
- contains
10
-
11
- pure function tile_indices (dims )
12
- ! ! Given input global array size, return start and end index
13
- ! ! of a parallel 1-d tile that correspond to this image.
14
- integer (ik), intent (in ) :: dims
15
- integer (ik) :: tile_indices(2 )
16
- integer (ik) :: offset, tile_size
17
-
18
- tile_size = dims / num_images()
19
-
20
- ! ! start and end indices assuming equal tile sizes
21
- tile_indices(1 ) = (this_image() - 1 ) * tile_size + 1
22
- tile_indices(2 ) = tile_indices(1 ) + tile_size - 1
23
-
24
- ! ! if we have any remainder, distribute it to the tiles at the end
25
- offset = num_images() - mod (dims, num_images())
26
- if (this_image() > offset) then
27
- tile_indices(1 ) = tile_indices(1 ) + this_image() - offset - 1
28
- tile_indices(2 ) = tile_indices(2 ) + this_image() - offset
29
- end if
30
-
31
- end function tile_indices
9
+ interface
10
+
11
+ pure module function tile_indices(dims)
12
+ ! ! Given input global array size, return start and end index
13
+ ! ! of a parallel 1-d tile that correspond to this image.
14
+ implicit none
15
+ integer (ik), intent (in ) :: dims
16
+ integer (ik) :: tile_indices(2 )
17
+ end function tile_indices
18
+
19
+ end interface
32
20
33
21
end module mod_parallel
0 commit comments