1 | #if defined show_comments |
---|
2 | ! These comments are not intended to be retained during preprocessing; i.e. do not define "show_comments" |
---|
3 | !!---------------------------------------------------------------------- |
---|
4 | !! NEMO/OCE 4.x , NEMO Consortium (2020) |
---|
5 | !! Software governed by the CeCILL license (see ./LICENSE) |
---|
6 | !!---------------------------------------------------------------------- |
---|
7 | ! This header file contains preprocessor definitions and macros used in the do-loop substitutions introduced |
---|
8 | ! between version 4.0 and 4.2. The primary aim of these macros is to assist in future applications of tiling |
---|
9 | ! to improve performance. This is expected to be achieved by alternative versions of these macros in selected |
---|
10 | ! locations. The initial introduction of these macros simply replaced all identifiable nested 2D- and 3D-loops |
---|
11 | ! with single line statements (and adjusts indenting accordingly). Do loops were identifiable if they comformed |
---|
12 | ! to either: |
---|
13 | ! DO jk = .... |
---|
14 | ! DO jj = .... DO jj = ... |
---|
15 | ! DO ji = .... DO ji = ... |
---|
16 | ! . OR . |
---|
17 | ! . . |
---|
18 | ! END DO END DO |
---|
19 | ! END DO END DO |
---|
20 | ! END DO |
---|
21 | ! and white-space variants thereof. |
---|
22 | ! |
---|
23 | ! Additionally, only loops with recognised jj and ji loops limits were treated; these were: |
---|
24 | ! Lower limits of 1, 2 or fs_2 |
---|
25 | ! Upper limits of jpi, jpim1 or fs_jpim1 (for ji) or jpj, jpjm1 or fs_jpjm1 (for jj) |
---|
26 | ! |
---|
27 | ! The macro naming convention takes the form: DO_2D( L, R, B, T) where: |
---|
28 | ! L is the Left offset from the PE's inner domain; |
---|
29 | ! R is the Right offset from the PE's inner domain |
---|
30 | ! B is the Bottom offset from the PE's inner domain; |
---|
31 | ! T is the Top offset from the PE's inner domain; |
---|
32 | ! |
---|
33 | ! So, given an inner domain of 2,jpim1 and 2,jpjm1, a typical example would replace: |
---|
34 | ! |
---|
35 | ! DO jj = 2, jpj |
---|
36 | ! DO ji = 1, jpim1 |
---|
37 | ! . |
---|
38 | ! . |
---|
39 | ! END DO |
---|
40 | ! END DO |
---|
41 | ! |
---|
42 | ! with: |
---|
43 | ! |
---|
44 | ! DO_2D( 1, 0, 0, 1 ) |
---|
45 | ! . |
---|
46 | ! . |
---|
47 | ! END_2D |
---|
48 | ! |
---|
49 | ! similar conventions apply to the 3D loops macros. jk loop limits are retained through macro arguments |
---|
50 | ! and are not restricted. This includes the possibility of strides for which an extra set of DO_3DS |
---|
51 | ! macros are defined. |
---|
52 | ! |
---|
53 | ! In the following definitions the inner PE domain is defined by start indices of (Nis0, Njs0) and end |
---|
54 | ! indices of (Nie0, Nje0) where: |
---|
55 | ! |
---|
56 | ! Nis0 = 1 + nn_hls Njs0 = 1 + nn_hls |
---|
57 | ! Nie0 = jpi - nn_hls Nje0 = jpj - nn_hls |
---|
58 | ! |
---|
59 | #endif |
---|
60 | |
---|
61 | #define DO_2D(L, R, B, T) DO jj = ntsj-(B), ntej+(T) ; DO ji = ntsi-(L), ntei+(R) |
---|
62 | #define DO_2D_OVR(L, R, B, T) DO_2D(L-(L+R)*nthl, R-(R+L)*nthr, B-(B+T)*nthb, T-(T+B)*ntht) |
---|
63 | #define A1Di(H) ntsi-(H):ntei+(H) |
---|
64 | #define A1Dj(H) ntsj-(H):ntej+(H) |
---|
65 | #define A2D(H) A1Di(H),A1Dj(H) |
---|
66 | #define A1Di_T(T) (ntsi-nn_hls-1)*T+1: |
---|
67 | #define A1Dj_T(T) (ntsj-nn_hls-1)*T+1: |
---|
68 | #define A2D_T(T) A1Di_T(T),A1Dj_T(T) |
---|
69 | #define JPK : |
---|
70 | #define JPTS : |
---|
71 | #define KJPT : |
---|
72 | |
---|
73 | #define DO_3D(L, R, B, T, ks, ke) DO jk = ks, ke ; DO_2D(L, R, B, T) |
---|
74 | #define DO_3D_OVR(L, R, B, T, ks, ke) DO jk = ks, ke ; DO_2D_OVR(L, R, B, T) |
---|
75 | |
---|
76 | #define DO_3DS(L, R, B, T, ks, ke, ki) DO jk = ks, ke, ki ; DO_2D(L, R, B, T) |
---|
77 | #define DO_3DS_OVR(L, R, B, T, ks, ke, ki) DO jk = ks, ke, ki ; DO_2D_OVR(L, R, B, T) |
---|
78 | |
---|
79 | #define END_2D END DO ; END DO |
---|
80 | #define END_3D END DO ; END DO ; END DO |
---|