1 | module def_parallel_decomposition |
---|
2 | ! |
---|
3 | ! For LR grids, the global grid is split in npes rectangle partitions with local extent in x = global extent |
---|
4 | ! For U or D grids, the first dimension is split in npes segments |
---|
5 | ! |
---|
6 | contains |
---|
7 | SUBROUTINE def_local_partition (nlon, nlat, npes, mype, cl_type_src, & |
---|
8 | il_extentx, il_extenty, il_size, il_offsetx, il_offsety, il_offset) |
---|
9 | IMPLICIT NONE |
---|
10 | INTEGER, INTENT(in) :: nlon, nlat, npes, mype |
---|
11 | CHARACTER(len=2), INTENT(in) :: cl_type_src |
---|
12 | INTEGER, INTENT(out) :: il_extentx, il_extenty, il_size, il_offsetx, il_offsety, il_offset |
---|
13 | ! |
---|
14 | if (cl_type_src == 'LR') then |
---|
15 | il_extentx = nlon |
---|
16 | il_extenty = nlat/npes ; IF (mype == npes-1) il_extenty = nlat - (nlat/npes * mype) |
---|
17 | il_size = il_extentx * il_extenty |
---|
18 | il_offsetx = 0 |
---|
19 | il_offsety = (nlat/npes * mype) |
---|
20 | il_offset = nlon * il_offsety |
---|
21 | else if (cl_type_src == 'U' .or. cl_type_src == 'D') then |
---|
22 | il_extentx = nlon/npes ; IF (mype == npes-1) il_extentx = nlon - (nlon/npes * mype) |
---|
23 | il_extenty = nlat |
---|
24 | il_size = il_extentx * il_extenty |
---|
25 | il_offsetx = (nlon/npes * mype) |
---|
26 | il_offsety = 0 |
---|
27 | il_offset = nlat * il_offsetx |
---|
28 | endif |
---|
29 | ! |
---|
30 | END SUBROUTINE def_local_partition |
---|
31 | ! |
---|
32 | end module def_parallel_decomposition |
---|