1 | module def_parallel_decomposition |
---|
2 | ! |
---|
3 | ! The global grid is split in npes rectangle partitions with local extent in x = global extent |
---|
4 | ! |
---|
5 | contains |
---|
6 | SUBROUTINE def_local_partition (nlon, nlat, npes, mype, & |
---|
7 | il_extentx, il_extenty, il_size, il_offsetx, il_offsety, il_offset) |
---|
8 | IMPLICIT NONE |
---|
9 | INTEGER, INTENT(in) :: nlon, nlat, npes, mype |
---|
10 | INTEGER, INTENT(out) :: il_extentx, il_extenty, il_size, il_offsetx, il_offsety, il_offset |
---|
11 | ! |
---|
12 | il_extentx = nlon |
---|
13 | il_extenty = nlat/npes ; IF (mype == npes-1) il_extenty = nlat - (nlat/npes * mype) |
---|
14 | il_size = il_extentx * il_extenty |
---|
15 | il_offsetx = 0 |
---|
16 | il_offsety = (nlat/npes * mype) |
---|
17 | il_offset = nlon * il_offsety |
---|
18 | ! |
---|
19 | END SUBROUTINE def_local_partition |
---|
20 | ! |
---|
21 | SUBROUTINE def_paral_size (il_paral_size) |
---|
22 | IMPLICIT NONE |
---|
23 | INTEGER, INTENT(out) :: il_paral_size |
---|
24 | #ifdef DECOMP_APPLE |
---|
25 | il_paral_size = 3 |
---|
26 | #elif defined DECOMP_BOX |
---|
27 | il_paral_size = 5 |
---|
28 | #endif |
---|
29 | ! |
---|
30 | END SUBROUTINE def_paral_size |
---|
31 | ! |
---|
32 | SUBROUTINE def_paral(il_offset, il_size, il_extentx, il_extenty, nlon, il_paral_size, il_paral) |
---|
33 | IMPLICIT NONE |
---|
34 | INTEGER, INTENT(IN) :: il_offset, il_size, il_extentx, il_extenty, nlon, il_paral_size |
---|
35 | INTEGER, INTENT(OUT) :: il_paral(il_paral_size) |
---|
36 | #ifdef DECOMP_APPLE |
---|
37 | il_paral(1) = 1 |
---|
38 | il_paral(2) = il_offset |
---|
39 | il_paral(3) = il_size |
---|
40 | #elif defined DECOMP_BOX |
---|
41 | il_paral(1) = 2 |
---|
42 | il_paral(2) = il_offset |
---|
43 | il_paral(3) = il_extentx |
---|
44 | il_paral(4) = il_extenty |
---|
45 | il_paral(5) = nlon |
---|
46 | #endif |
---|
47 | ! |
---|
48 | END SUBROUTINE def_paral |
---|
49 | ! |
---|
50 | end module def_parallel_decomposition |
---|