Changes between Version 1 and Version 2 of 2020WP/KERNEL-02_Coward_Do Loop Macros_part1


Ignore:
Timestamp:
2020-09-08T11:54:23+02:00 (6 months ago)
Author:
acc
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • 2020WP/KERNEL-02_Coward_Do Loop Macros_part1

    v1 v2  
    2525=== Implementation 
    2626 
    27 {{{#!box width=35em help 
    28 Describe flow chart of the changes in the code. \\ 
    29 List the Fortran modules and subroutines to be created/edited/deleted. \\ 
    30 Detailed list of new variables to be defined (including namelists), \\ 
    31 give for each the chosen name and description wrt coding rules. 
    32 }}} 
     27The do loop macros were introduced into the 2019 merge branch before this was merged back onto the trunk. Full details are given here: 
    3328 
    34 ''...'' 
     29https://forge.ipsl.jussieu.fr/nemo/changeset/12340 
    3530 
     31The merge back to the trunk happened at changeset:12377 and the macros have been available in all developments started since then 
     32 
     33Following the mid-year merge in June 2020. The Do-loop macros were rewritten according to Italo's design to a simpler, functional form which is more flexible and better supports the extra halo options. This change occurred at changeset:13295  
    3634=== Documentation updates 
    3735 
    38 {{{#!box width=55em help 
    39 Using previous parts, define the main changes to be done in the NEMO literature  
    40 (manuals, guide, web pages, …). 
     36{{{ 
     37The primary aim of these macros is to assist in future applications of tiling 
     38to improve performance. This is expected to be achieved by alternative versions of these macros in selected 
     39locations. The initial introduction of these macros simply replaced all identifiable nested 2D- and 3D-loops 
     40with single line statements (and adjusts indenting accordingly). Do loops were identifiable if they comformed 
     41to either: 
     42                                      DO jk = .... 
     43  DO jj = ....                           DO jj = ... 
     44     DO ji = ....                           DO ji = ... 
     45        .                   OR                 .  
     46        .                                      . 
     47    END DO                                  END DO 
     48  END DO                                 END DO 
     49                                      END DO 
     50 and white-space variants thereof. 
     51 
     52 Additionally, only loops with recognised jj and ji loops limits were treated; these were: 
     53 Lower limits of 1, 2 or fs_2 
     54 Upper limits of jpi, jpim1 or fs_jpim1 (for ji) or jpj, jpjm1 or fs_jpjm1 (for jj) 
     55 
     56 The macro naming convention takes the form: DO_2D( B, T, L, R) where: 
     57   B is the Bottom offset from the PE's inner domain; 
     58   T is the Top    offset from the PE's inner domain; 
     59   L is the Left   offset from the PE's inner domain; 
     60   R is the Right  offset from the PE's inner domain 
     61 
     62 So, given an inner domain of 2,jpim1 and 2,jpjm1, a typical example would replace: 
     63 
     64   DO jj = 2, jpj 
     65      DO ji = 1, jpim1 
     66         . 
     67         . 
     68      END DO 
     69   END DO 
     70 
     71 with: 
     72 
     73   DO_2D( 0, 1, 1, 0 ) 
     74      . 
     75      . 
     76   END_2D 
     77 
     78 similar conventions apply to the 3D loops macros. jk loop limits are retained through macro arguments 
     79 and are not restricted. This includes the possibility of strides for which an extra set of DO_3DS 
     80 macros are defined. 
     81 
     82 In the following definitions the inner PE domain is defined by start indices of (Nis0, Njs0) and end 
     83 indices of (Nie0, Nje0) where: 
     84 
     85 Nis0 =   1 + nn_hls     Njs0 =   1 + nn_hls 
     86 Nie0 = jpi - nn_hls     Nje0 = jpj - nn_hls 
     87 
     88#endif 
     89#define DO_2D(B, T, L, R) DO jj = Njs0-(B), Nje0+(T)   ;   DO ji = Nis0-(L), Nie0+(R) 
     90#define DO_3D(B, T, L, R, ks, ke) DO jk = ks, ke   ;   DO_2D(B, T, L, R) 
     91#define DO_3DS(B, T, L, R, ks, ke, ki) DO jk = ks, ke, ki   ;   DO_2D(B, T, L, R) 
     92#define END_2D   END DO   ;   END DO 
     93#define END_3D   END DO   ;   END DO   ;   END DO 
    4194}}} 
    4295 
     
    53106== Tests 
    54107 
    55 {{{#!box width=50em info 
    56 [[Include(wiki:Developers/DevProcess#tests)]] 
    57 }}} 
     108The Do loop macros change code and layout but not function. Results before and after introduction of the macros should be identical. This has been verified at each stage by full SETTE testing. 
    58109 
    59 ''...'' 
    60110 
    61111== Review