diff --git a/tools/MPP_PREP/README.rst b/tools/MPP_PREP/README.rst deleted file mode 100644 index 7e623cf119fa4307ac89b3d0b1d57ba49d5eba44..0000000000000000000000000000000000000000 --- a/tools/MPP_PREP/README.rst +++ /dev/null @@ -1,185 +0,0 @@ -============ -MPP_PREP -============ - -Description -=========== -MPP_PREP proposes possible domain decompositions for a given -bathymetric file, which is particularly intersting when -we want to eliminate land-only domain. -All solution are proposed and written to output file. -The ratio between the effective number of computed -point and the total number of points in the domain is -given and is probably a major criteria for choosing a -domain decomposition. - -Tools mpp_optimiz_zoom_nc.exe as been tested on one eORCA12 and one eORCA025 configuration at trunk@10036 - -Tools mppopt_showproc_nc.exe has not been tested. - -Method -====== -Use mpp_init like code for setting up the decomposition -and evaluate the efficiency of the decomposition. - -How to compile it -================= -MPP_PREP is compiled in the same manner as all the other tools. -The compilation script is maketools and the option are very similar to makenemo. - -Here an example of how to compile MPP_PREP on the MetOffice XC40 HPC: - -.. code-block:: console - - $ ./maketools -n MPP_PREP -m XC40_METO - -Usage -===== - -the MPP_PREP executable is named mpp_optimiz_zoom_nc.exe. The input file needed are: - - * a netcdf file containing a variable with 0 on land and data > 0 on ocean (typically a bathymetry file) - - * a namelist to specify the number of vertical levels, netcdf input file, variable and dimension names (...). - A namelist template is available in the file 'namelist'. Default namelist is set up for input file domain_cfg.nc (output of Domaincfg tool) - and will find decomposition between 100 and 4000 processors. - -.. code-block:: console - - $ ./mpp_optimiz_zoom_nc.exe -h - usage : mpp_optimize [ -h ] [-keep jpni jpnj] [ -o file out ] - [ -modulo val ] [-r ratio] [-minocean procs] -n namelist - - PURPOSE : - This program is build to optimize the domain beakdown into - subdomain for mpp computing. - Once the grid size, and the land/sea mask is known, it looks - for all the possibilities within a range of setting parameters - and determine the optimal. - - Optimization is done with respect to the maximum number of - sea processors and to the maximum numbers of procs (nn_procmax) - - Optional optimization can be performed taking into account - the maximum available processor memory rn_ppmcal. This is - activated if ln_memchk is set true in the namelist - - Additional criteria can be given on the command line to reduce - the amount of possible choices. - - ARGUMENTS : - -n namelist : indicate the name of the namelist to use - - OPTIONS : - -h : print this help message - -keep jpni jpnj : print a file suitable for plotting, - corresponding to the given decomposition - -o output file : give the name of the output file - default is processor.layout - -modulo val : only retain decomposition whose total number - of util processors (sea) are a multiple of val - -r ratio : only retain decomposition with a ratio computed/global - less or equal to the given ratio - -minocean procs : only retain decomposition with a number of - ocean procs greater of equal to procs - - REQUIRED FILES : - A bathymetric file and an ad-hoc namelist are required. - The file name of the bathymetry is specified in the namelist - - OUTPUT : - processor.layout : an ascii file with all found possibilities - - SEE ALSO : - script screen.ksh helps a lot in the analysis of the output file. - - STOP - -Example -======= - -Here is an example of usage of ./mpp_optimiz_zoom_nc.exe on the the eORCA025 bathymetry. We keep in the output only domain decomposition with a ratio (computed/global) lower than 1, using namelist_eORCA025 and output the list of domain decomposition in processor.layout_eORCA025 - -.. code-block:: console - - $ ./mpp_optimiz_zoom_nc.exe -r 1 -n namelist_eORCA025 -o processor.layout_eORCA025 - - ocean/land file used is: domcfg_eORCA025.nc - variable used to find ocean domain is: bottom_level - Dimensions (jpi x jpj) are: 1442 x 1207 - - Loop over all the decompositions (can take a while) ... - - STOP - -The output for one specific decomposition contains this information: - -.. code-block:: console - - iresti= 14 irestj= 9 - --> Total number of domains 1612 - - jpni= 31 jpnj= 52 - jpi= 49 jpj= 26 - Number of ocean processors 1074 - Number of land processors 538 - Mean ocean coverage per domain 0.7542637596508307 - Minimum ocean coverage 7.849293761E-4 - Maximum ocean coverage 1. - nb of proc with coverage < 10 % 68 - nb of proc with coverage 10 < nb < 30 % 99 - nb of proc with coverage 30 < nb < 50 % 59 - Number of computed points 1368276 - Overhead of computed points -372218 - % sup (computed / global) 0.786142349 - -Sorting phase -============= -The processor.layout can be very long and hard to exploit. -To sort out what is the best model decomposition for a specific application, there is a suggestion at the end of the processor.layout file. Otherwise you can use the python script find_layout.py to dig into it. - -.. code-block:: console - - $ python2.7 find_layout.py - usage: find_layout.py [-h] -f layout_file --rmax max_ratio --noce min/max_noce - -Below an example to extract all decomposition with a ratio (computed/global) < 0.8 and a number of ocean domain between 300 and 350. All the decomposition fitting the criterions are listed. At the end, a summary of the one with the smallest ratio, the largest number of ocean domains and the smallest computed domain. - -.. code-block:: console - - $ python2.7 find_layout.py -f processor.layout_eORCA025 --rmax 0.8 --noce 300 350 - Domain decomposition 0 - domain decomposition (jpni, jpnj) = (13, 32) - number of ocean domain = 300 - ratio computed/global = 0.779089153 - domain size (jpi, jpj) = (113, 40) - ... - Domain decomposition 76 - domain decomposition (jpni, jpnj) = (37, 13) - number of ocean domain = 350 - ratio computed/global = 0.783254623 - domain size (jpi, jpj) = (41, 95) - - ===================================================================== - - Among the layouts fitting the constraint on : ratio (computed/global) < 0.8 and 300 <= number of ocean domain <= 350 - - 3 layouts are highlighted : - - Domain decomposition SMALLEST RATIO - domain decomposition (jpni, jpnj) = (24, 18) - number of ocean domain = 310 - ratio computed/global = 0.761956096 - domain size (jpi, jpj) = (62, 69) - - Domain decomposition LARGEST NUMBER OF OCEAN DOMAINS - domain decomposition (jpni, jpnj) = (21, 23) - number of ocean domain = 350 - ratio computed/global = 0.785265565 - domain size (jpi, jpj) = (71, 55) - - Domain decomposition SMALLEST COMPUTED DOMAIN - domain decomposition (jpni, jpnj) = (18, 27) - number of ocean domain = 350 - ratio computed/global = 0.775009871 - domain size (jpi, jpj) = (82, 47) diff --git a/tools/MPP_PREP/find_layout.py b/tools/MPP_PREP/find_layout.py deleted file mode 100644 index 550fbd97c93f8471da0cc8cbccabcdcddf32a4f0..0000000000000000000000000000000000000000 --- a/tools/MPP_PREP/find_layout.py +++ /dev/null @@ -1,220 +0,0 @@ -""" - script to sort and select processor layout from MPP_PREP output - wrote by P. Mathiot 10/2018 -""" - -# import module -from __future__ import print_function -import argparse -import sys - -# define class layout -class layout(object): - """ - Class containing all the information about a specific model layout - - Output: - self.jpnij = (i domain along i dimension, j domain along j dimension, total number of domain (land+ocean)) - self.nproc = (total number of domain (land+ocean), n ocean domain, nland domain) - self.jpij = (dimension along i, dimension along j) of a domain - self.ratio = (total computed point, overhead, ratio computed point / global) - """ - def __init__(self, txtlst): - """ - Initialisation of a layout class object: - - Input: list of string containing 1 layout description - extracted from the processor layout file - """ - self.jpnij = extract_jpnij(txtlst) # (jpni, jpnj, jpnij) - self.nproc = extract_nproc(txtlst) # (ntot, noce, nland) - self.jpij = extract_jpij(txtlst) # (jpi , jpj) - self.ratio = extract_point(txtlst) # (total computed point, overhead, ratio computed point / global) - - def test_criterion(self, rmax, nocemin, nocemax): - """ - function to decide if yes or no a specific layout has to be selected - Input: - float rmax: maximal ratio (computed/global) accepted - int nocemin and nocemax: range of number of ocean processor accepted - - output: logical - """ - if ( nocemin <= self.nproc[1] <= nocemax ) and ( self.ratio[2] <= rmax ): - return True - else: - return False - - def print_layout(self, cidx): - """ - function to print specific information about a specific layout - """ - print( 'Domain decomposition {}'.format(cidx) ) - print( 'domain decomposition (jpni, jpnj) = {}'.format((self.jpnij[0], self.jpnij[1])) ) - print( 'number of ocean domain = {}'.format(self.nproc[1]) ) - print( 'ratio computed/global = {}'.format(self.ratio[2]) ) - print( 'domain size (jpi, jpj) = {}'.format(self.jpij) ) - print('') - -# define sorting function -def noce_proc(elem): - """ - function used as key to sort list of layout - by number of ocean domain in the list sorting algorithm - """ - return elem.nproc[1] - -def ratio_proc(elem): - """ - function used as key to sort list of layout - by ratio (computed/global) in the list sorting algorithm - """ - return elem.ratio[2] - -def jpij_proc(elem): - """ - function used as key to sort list of layout - by domain size in the list sorting algorithm - """ - return elem.jpij[0]*elem.jpij[1] - -# txt extraction function to feed class layout -def extract_jpnij(txtlst): - """ - function to extract total number of domain - for a specific domain layout txt output - - Input: list of string containing 1 layout description - extracted from the processor layout file - - Output: tuple (jpni, jpnj, jpni*jpnj) - """ - jpnij = int(txtlst[1].split()[-1]) - ctmp = txtlst[3].split() - jpni = int(ctmp[1]) - jpnj = int(ctmp[3]) - return (jpni, jpnj, jpnij) - -def extract_nproc(txtlst): - """ - function to extract total number of ocean domain - for a specific domain layout txt output - - Input: list of string containing 1 layout description - extracted from the processor layout file - - Output: tuple (jpni*jpnj, n oce domain, n land domain) - """ - ntot = int(txtlst[1].split()[-1]) - noce = int(txtlst[5].split()[-1]) - nland = int(txtlst[6].split()[-1]) - return (ntot, noce, nland) - -def extract_jpij(txtlst): - """ - function to extract domain dimension - for a specific domain layout txt output - - Input: list of string containing 1 layout description - extracted from the processor layout file - - Output: tuple (jpi, jpj) - """ - ctmp = txtlst[4].split() - jpi = int(ctmp[1]) - jpj = int(ctmp[3]) - return (jpi, jpj) - -def extract_point(txtlst): - """ - function to extract ration (computed/global) - for a specific domain layout txt output - - Input: list of string containing 1 layout description - extracted from the processor layout file - - Output: tuple (total number of point, overhead, ratio (computed/global)) - """ - npoint = int(txtlst[13].split()[-1]) - noverh = int(txtlst[14].split()[-1]) - ratio = float(txtlst[15].split()[-1]) - return (npoint, noverh, ratio) - -# main -def main(): - """ - script to sort and select processor layout from MPP_PREP output based on user constrains - """ - - parser = argparse.ArgumentParser() - parser.add_argument("-f", metavar='layout_file' , help="names of domain layout file to sort", type=str, nargs=1, required=True) - parser.add_argument("--rmax", metavar='max_ratio' , help="max ratio allowed (computed/global)", type=float, nargs=1, required=True) - parser.add_argument("--noce", metavar='min/max_noce' , help="min and max number of ocean domain allowed", type=int, nargs=2, required=True) - - args = parser.parse_args() - - # read file - filein = args.f[0] - fid = open(filein,"r") #opens file with name of "test.txt" - txtdata = [] - for cline in fid: - txtdata.extend([cline]) - - # skip header and tail of file - txtdata = txtdata[4:-20] - - # loop on different domain decomposition - ilinepl = 17 # number of line of a specific decomposition - ilayout = 0 - lst_layout = [] - ratio_min = 9999.0 - noce_min = 9999999 - noce_max = 0 - for iline in range(0, len(txtdata)): - if iline % ilinepl == 0: - # initialise layout - conf_layout = layout( txtdata[iline:iline+ilinepl] ) - ratio_min = min( conf_layout.ratio[2], ratio_min ) - noce_min = min( conf_layout.nproc[1], noce_min ) - noce_max = max( conf_layout.nproc[1], noce_max ) - - # select layout based on condition - if conf_layout.test_criterion(args.rmax[0], args.noce[0], args.noce[1]): - ilayout = ilayout + 1 - lst_layout.extend([conf_layout]) - - if lst_layout == []: - print('') - print( 'E R R O R: constrains are too strong, no domain are found' ) - print('') - if ratio_min > args.rmax[0] : - print( 'min ratio is {} and you ask for a ratio smaller than {}'.format(ratio_min, args.rmax[0]) ) - if noce_min > args.noce[1] : - print( 'min ocean proc is {} and you ask for a number of ocean proc lower than {}'.format(noce_min, args.noce[1]) ) - if noce_max < args.noce[0] : - print( 'max ocean proc is {} and you ask for a number of ocean proc larger than {}'.format(noce_max, args.noce[0]) ) - print('') - sys.exit() - - lst_layout.sort(key=noce_proc) - for idx, ilayout in enumerate(lst_layout): - ilayout.print_layout(str(idx)) - - print( '=====================================================================' ) - print('') - print( 'Among the layouts fitting the constraint on : ratio (computed/global) < {} and {} <= number of ocean domain <= {}' \ - .format(args.rmax[0], args.noce[0], args.noce[1]) ) - print('') - print( ' 3 layouts are highlighted : ' ) - print('') - lst_layout.sort(key=ratio_proc) - lst_layout[0].print_layout('SMALLEST RATIO') -# - lst_layout.sort(key=noce_proc) - lst_layout[-1].print_layout('LARGEST NUMBER OF OCEAN DOMAINS') -# - lst_layout.sort(key=jpij_proc) - lst_layout[0].print_layout('SMALLEST COMPUTED DOMAIN') - -if __name__ == "__main__": - main() diff --git a/tools/MPP_PREP/mpp_nc.pdf b/tools/MPP_PREP/mpp_nc.pdf deleted file mode 100644 index cc64dce0271a88598d9c120ec9e8b0bae7d45c28..0000000000000000000000000000000000000000 Binary files a/tools/MPP_PREP/mpp_nc.pdf and /dev/null differ diff --git a/tools/MPP_PREP/mpp_prep-1.0.tar.gz b/tools/MPP_PREP/mpp_prep-1.0.tar.gz deleted file mode 100644 index f34366f7f5fc39c8fd047bfb4687dbe996483921..0000000000000000000000000000000000000000 Binary files a/tools/MPP_PREP/mpp_prep-1.0.tar.gz and /dev/null differ diff --git a/tools/MPP_PREP/namelist b/tools/MPP_PREP/namelist deleted file mode 100644 index 2f184fabed4c7617c0b6ba74738fe4516eeeae94..0000000000000000000000000000000000000000 --- a/tools/MPP_PREP/namelist +++ /dev/null @@ -1,47 +0,0 @@ -!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> -! MPP_OPTIMIZE namelist template -! ------------------------------- -!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> -! -!''''''''''''''''''''''''''''''''''''''''' -! namspace spatial indexes -!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, -&namspace - nn_jpk = 75 ! number of vertical level - nn_izoom = 1 ! i-index of point (1,1) of the zoomed region/ jpidta - nn_jzoom = 1 ! j-index of point (1,1) of the zoomed region/ jpjdta -/ -!''''''''''''''''''''''''''''''''''''' -! namproc -!'''''''''''''''''''''''''''''''''''' -&namproc - nn_procmax = 4000 ! maximum number of proc to look for - nn_procmin = 100 ! minimum number of proc - ln_memchk = .false. ! optimization of memory -/ -!'''''''''''''''''''''''''''''''''''''' -! namparam -!'''''''''''''''''''''''''''''''''''''' -&namparam - rn_ppmcal = 225000000. ! maximum memory for 1 processor - rn_ppmin = 0.4 ! minimum ratio for filling the available memory - rn_ppmax = 0.9 ! maximum ratio for filling the available memory -/ -!''''''''''''''''''''''''''''''''''''''' -! namfile of filename -!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, -&namfile - cn_fbathy = 'domain_cfg.nc' ! bathy file name - cn_var = 'bottom_level' ! Bathy variable name - cn_x = 'x' ! bathy x dimension name - cn_y = 'y' ! bathy y dimension name - ln_zps = .true. ! partial step flag -/ -! -!'''''''''''''''''''''''''''''''''''''' -! namkeep option -keep. Specify the root name of the overdata file -!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, -&namkeep - cn_fovdta = 'domain_cfg' ! Root for the overdata file name - ! complete name will be {covdta}.{jpni}x{jpnj}_{jpnij} -/ diff --git a/tools/MPP_PREP/src/mpp_optimiz_zoom_nc.f90 b/tools/MPP_PREP/src/mpp_optimiz_zoom_nc.f90 deleted file mode 100644 index 6f01de42730105f5710540aa772cdd222915a5bb..0000000000000000000000000000000000000000 --- a/tools/MPP_PREP/src/mpp_optimiz_zoom_nc.f90 +++ /dev/null @@ -1,535 +0,0 @@ -PROGRAM mpp_optimize - !!====================================================================== - !! *** PROGRAM mpp_optimize *** - !!===================================================================== - !! ** Purpose : Propose possible domain decompositions for a given - !! bathymetric file, which is particularly intersting when - !! we want to eliminate land-only domain. - !! All solution are proposed and written to output file. - !! The ratio between the effective number of computed - !! point and the total number of points in the domain is - !! given and is probably a major criteria for choosing a - !! domain decomposition. - !! - !! ** Method : Use mpp_init like code for seting up the decomposition - !! and evaluate the efficiency of the decomposition. - !! History - !! original : 95-12 (Imbard M) for OPA8.1, CLIPPER - !! f90 : 03-06 (Molines JM), namelist as input - !! : 05-05 (Molines JM), bathy in ncdf - !! : 13-03 (Molines JM), Nemo-like coding and license. - !! : 18-10 (Mathiot P), upgrade the NEMO 4.0 - !!---------------------------------------------------------------------- - !!---------------------------------------------------------------------- - !! routines : description - !!---------------------------------------------------------------------- - - - !!---------------------------------------------------------------------- - !! MPP-PREP, MEOM 2013 - !! $Id: mpp_optimiz_zoom_nc.f90 10335 2018-11-19 14:25:00Z mathiot $ - !! Copyright (c) 2013, J.-M. Molines - !! Software governed by the CeCILL licence (Licence/MPP-PREPCeCILL.txt) - !!---------------------------------------------------------------------- - USE netcdf - - IMPLICIT NONE - - INTEGER, PARAMETER :: jpreci=1 ,jprecj=1 !: overlap between processors - - ! Namelist declaration and definition - ! ----------------------------------- - INTEGER :: nn_procmax =250 !: maximum number of proc. (Read from namelist) - INTEGER :: nn_procmin = 1 !: maximum number of proc. (Read from namelist) - LOGICAL :: ln_memchk = .FALSE. ! add a memory constraint if true (obsolete) - NAMELIST /namproc/ nn_procmax, nn_procmin, ln_memchk - ! - INTEGER :: nn_jpk = 46 !: vertical levels - INTEGER :: nn_izoom = 1 !: I zoom indicator - INTEGER :: nn_jzoom = 1 !: J zoom indicator - NAMELIST /namspace/ nn_jpk, nn_izoom, nn_jzoom - ! - ! Following variables are used only if ln_memchk=.true. - REAL(KIND=4) :: required_memory, rppmpt !: not in namelist working array - REAL(KIND=4) :: rn_ppmcal = 225000000. !: maximum memory of one processor for a - !: given machine (in 8 byte words) - REAL(KIND=4) :: rn_ppmin = 0.4 !: minimum ratio to fill the memory - REAL(KIND=4) :: rn_ppmax = 0.9 !: maximum ratio to fill the memory - NAMELIST /namparam/ rn_ppmcal, rn_ppmin, rn_ppmax - ! - CHARACTER(LEN=80) :: cn_var='none' !: Variable name of the bathymetry - CHARACTER(LEN=80) :: cn_x='x' !: X dimension name - CHARACTER(LEN=80) :: cn_y='y' !: Y dimension name - CHARACTER(LEN=80) :: cn_fbathy !: File name of the netcdf bathymetry (namelist) - LOGICAL :: ln_zps=.FALSE. !: Logical flag for partial cells. - NAMELIST /namfile/ cn_fbathy, cn_var, cn_x, cn_y, ln_zps - ! - CHARACTER(LEN=80) :: cn_fovdta !: root file name for keep output - NAMELIST /namkeep/ cn_fovdta - ! - INTEGER :: numnam = 4 ! logical unit for namelist - INTEGER :: numout = 10 ! logical unit for output - INTEGER :: npiglo, npjglo ! domain size - INTEGER :: npidta, npjdta ! domain size - - INTEGER :: ji, jj, jni, jnj ! dummy loop index - INTEGER :: ii, ij, jjc ! dummy loop index - INTEGER :: narg, iargc, ijarg ! browsing command line - - ! Decomposition related arrays (using same meaning than in NEMO) - INTEGER, DIMENSION(:,:), ALLOCATABLE :: ilci, ilcj ,iimppt, ijmppt - INTEGER, DIMENSION(:) , ALLOCATABLE :: nlei_ocea, nldi_ocea - INTEGER, DIMENSION(:) , ALLOCATABLE :: nlej_ocea, nldj_ocea - INTEGER, DIMENSION(:) , ALLOCATABLE :: nlei_land, nldi_land - INTEGER, DIMENSION(:) , ALLOCATABLE :: nlej_land, nldj_land - INTEGER :: nimpp, njmpp - INTEGER :: nreci, nrecj - INTEGER :: ili, ilj - INTEGER :: jarea, iarea, iarea0 - INTEGER :: iresti, irestj - ! - INTEGER :: ioce, isurf !: number of ocean points cumulated, per_proc - INTEGER :: ioce_opt !: number of ocean points cumulated for optimal case - INTEGER :: nland, nocea, nvalid !: number of land, ocean, memory_valid procs - INTEGER :: nland_opt !: optimal number of land procs - INTEGER :: ii1, ii2, ij1, ij2 !: limit of subdomain in global domain - INTEGER :: jpimax, jpjmax !: size of sub domain - INTEGER :: jpimax_opt, jpjmax_opt !: size of sub domain for optimal case - INTEGER :: inf10, inf30, inf50 !: - INTEGER :: inf10_opt, inf30_opt, inf50_opt !: in optimal case - INTEGER :: npni_opt, npnj_opt !: optimal domain decomposition - - INTEGER :: iminproci, imaxproci !: limits of the processor loop - INTEGER :: iminprocj, imaxprocj !: can be reduded to nkeepi, nkeepj - - ! Saving criteria - REAL(KIND=4) :: ratio_min=99999. !: keep only decomposition with ration less than ratio_min - INTEGER :: nocea_min = 1 !: minimum number of ocean procs for saving - INTEGER :: nmodulo = 1 !: Only keep solution multiple of nmodulo - LOGICAL :: ll_criteria=.TRUE. !: - ! - REAL(KIND=4) :: oce_cover - REAL(KIND=4) :: oce_cover_min, oce_cover_max, ratio - REAL(KIND=4) :: oce_cover_min_opt, oce_cover_max_opt, ratio_opt - REAL(KIND=4), DIMENSION(:,:), ALLOCATABLE :: tmask ! npiglo x npjglo - REAL(KIND=4), DIMENSION(:,:), ALLOCATABLE :: bathy ! npidta x npjdta - - ! CDF stuff - INTEGER :: ncid, istatus, id - LOGICAL :: ll_good = .FALSE. - - CHARACTER(LEN=80) :: cf_namlist='namelist' - CHARACTER(LEN=80) :: cf_out='processor.layout' - CHARACTER(LEN=80) :: cdum ! dummy character variable - - ! Keep stuff - LOGICAL :: ll_keep = .FALSE. - INTEGER :: nkeepi, nkeepj !: for option -keep : the retained decomposition - ! - - !!---------------------------------------------------------------------- - narg=iargc() - ijarg=1 - IF ( narg == 0 ) THEN - PRINT *,' try mpp_optimize -h for instructions !' - STOP - ENDIF - ! - DO WHILE ( ijarg <= narg ) - CALL getarg(ijarg,cdum) ; ijarg=ijarg+1 - SELECT CASE ( cdum ) - CASE ('-h') - PRINT *,' usage : mpp_optimize [ -h ] [-keep jpni jpnj] [ -o file out ] ' - PRINT *,' [ -modulo val ] [-r ratio] [-minocean procs] -n namelist' - PRINT *,' ' - PRINT *,' PURPOSE :' - PRINT *,' This program is build to optimize the domain beakdown into' - PRINT *,' subdomain for mpp computing.' - PRINT *,' Once the grid size, and the land/sea mask is known, it looks' - PRINT *,' for all the possibilities within a range of setting parameters' - PRINT *,' and determine the optimal.' - PRINT *,'' - PRINT *,' Optimization is done with respect to the maximum number of' - PRINT *,' sea processors and to the maximum numbers of procs (nn_procmax)' - PRINT *,' ' - PRINT *,' Optional optimization can be performed taking into account' - PRINT *,' the maximum available processor memory rn_ppmcal. This is' - PRINT *,' activated if ln_memchk is set true in the namelist' - PRINT *,' ' - PRINT *,' Additional criteria can be given on the command line to reduce' - PRINT *,' the amount of possible choices.' - PRINT *,' ' - PRINT *,' ARGUMENTS :' - PRINT *,' -n namelist : indicate the name of the namelist to use' - PRINT *,' ' - PRINT *,' OPTIONS :' - PRINT *,' -h : print this help message' - PRINT *,' -keep jpni jpnj : print a file suitable for plotting,' - PRINT *,' corresponding to the given decomposition' - PRINT *,' -o output file : give the name of the output file' - PRINT *,' default is ',TRIM(cf_out) - PRINT *,' -modulo val : only retain decomposition whose total number' - PRINT *,' of util processors (sea) are a multiple of val' - PRINT *,' -r ratio : only retain decomposition with a ratio computed/global' - PRINT *,' less or equal to the given ratio' - PRINT *,' -minocean procs : only retain decomposition with a number of ' - PRINT *,' ocean procs greater of equal to procs' - PRINT *,' ' - PRINT *,' REQUIRED FILES :' - PRINT *,' A bathymetric file and an ad-hoc namelist are required.' - PRINT *,' The file name of the bathymetry is specified in the namelist' - PRINT *,' ' - PRINT *,' OUTPUT : ' - PRINT *,' ',TRIM(cf_out),' : an ascii file with all found possibilities' - PRINT *,' ' - STOP - CASE ('-n' ) - CALL getarg(ijarg,cf_namlist) ; ijarg=ijarg+1 - CASE ('-o' ) - CALL getarg(ijarg,cf_out) ; ijarg=ijarg+1 - CASE ('-keep' ) - ll_keep=.TRUE. - CALL getarg(ijarg,cdum) ; ijarg=ijarg+1 ; READ( cdum,*) nkeepi - CALL getarg(ijarg,cdum) ; ijarg=ijarg+1 ; READ( cdum,*) nkeepj - CASE ('-modulo' ) - CALL getarg(ijarg,cdum) ; ijarg=ijarg+1 ; READ( cdum,*) nmodulo - CASE ('-r' ) - CALL getarg(ijarg,cdum) ; ijarg=ijarg+1 ; READ( cdum,*) ratio_min - CASE ('-minocean' ) - CALL getarg(ijarg,cdum) ; ijarg=ijarg+1 ; READ( cdum,*) nocea_min - END SELECT - ENDDO - - ! Open and read the namelist - OPEN(numnam,FILE=cf_namlist) - REWIND(numnam) - READ(numnam,namspace) - - REWIND(numnam) - READ(numnam,namfile) - - REWIND(numnam) - READ(numnam,namparam) - - REWIND(numnam) - READ(numnam,namproc) - - REWIND(numnam) - READ(numnam,namkeep) ! only used for -keep option but still ... - CLOSE(numnam) - - ! estimated code size expressed in number of 3D arrays (valid for OPA8.1) to be tuned for OPA9.0/Nemo - rppmpt = 55.+73./nn_jpk - - ! Open bathy file an allocate required memory - INQUIRE( FILE=cn_fbathy, EXIST=ll_good ) - IF( ll_good ) THEN - istatus = NF90_OPEN(cn_fbathy, NF90_NOWRITE, ncid) - istatus = NF90_INQ_DIMID(ncid, cn_x, id) ; istatus = NF90_INQUIRE_DIMENSION(ncid, id, len=npiglo) - istatus = NF90_INQ_DIMID(ncid, cn_y, id) ; istatus = NF90_INQUIRE_DIMENSION(ncid, id, len=npjglo) - npidta = npiglo ; npjdta=npjglo - ELSE - PRINT *,' File missing : ', TRIM(cn_fbathy) - STOP 42 - ENDIF - - ALLOCATE (tmask(npiglo,npjglo), bathy(npidta,npjdta) ) - ALLOCATE (ilci(nn_procmax,nn_procmax), ilcj(nn_procmax,nn_procmax) ) - ALLOCATE (iimppt(nn_procmax,nn_procmax), ijmppt(nn_procmax,nn_procmax) ) - - ! Open output file for results - IF ( ll_keep ) THEN - nn_procmax = nkeepi*nkeepj ! reduce nn_procmax - ! File will be open later - ELSE - OPEN(numout,FILE=cf_out) - WRITE(numout,*) - WRITE(numout,*) ' Domain decomposition optimization ' - WRITE(numout,*) ' ----------------------------------' - WRITE(numout,*) - ENDIF - ! - ALLOCATE ( nlei_ocea(nn_procmax), nldi_ocea(nn_procmax), nlej_ocea(nn_procmax), nldj_ocea(nn_procmax) ) - ALLOCATE ( nlei_land(nn_procmax), nldi_land(nn_procmax), nlej_land(nn_procmax), nldj_land(nn_procmax) ) - ! - ! Read cdf bathy file - IF ( cn_var == 'none' ) THEN ! automatic detection of variable name according to partial step - IF ( ln_zps ) THEN ! partial steps - cn_var = 'Bathymetry' - ELSE - cn_var = 'Bathy_level' ! full steps - ENDIF - ENDIF - PRINT *,'' - PRINT *,' ocean/land file used is: ', TRIM(cn_fbathy) - PRINT *,' variable used to find ocean domain is: ', TRIM(cn_var) - PRINT *,' Dimensions (jpi x jpj) are: ',npiglo,'x',npjglo - PRINT *,'' - - istatus = NF90_INQ_VARID (ncid, cn_var, id) - istatus = NF90_GET_VAR (ncid, id, bathy) - istatus = NF90_CLOSE (ncid) - ! - ! Building the mask ( eventually on a smaller domain than the bathy) - tmask(:,:) = bathy(nn_izoom:nn_izoom+npiglo -1, nn_jzoom:nn_jzoom+npjglo -1) - - WHERE ( tmask > 0 ) - tmask = 1. - ELSEWHERE - tmask = 0. - ENDWHERE - - ! Main loop on processors - ! ------------------------ - ! initialization of working variables - npni_opt=1 ; npnj_opt=1 - jpimax_opt=npiglo ; jpjmax_opt=npjglo - nland_opt=0 - ioce_opt=0 - oce_cover_min_opt=0. ; oce_cover_max_opt=0. - inf10_opt=0 ; inf30_opt=0 ; inf50_opt=0 - ratio_opt=1. - - nvalid=0 ! counter for valid case ( ln_memchk true ) - IF ( ll_keep ) THEN - iminproci = nkeepi ; imaxproci = iminproci - iminprocj = nkeepj ; imaxprocj = iminprocj - ELSE - iminproci = 1 ; imaxproci = MIN( nn_procmax, npiglo ) - iminprocj = 1 ; imaxprocj = MIN( nn_procmax, npjglo ) - ENDIF - - ! loop on all decomposition a priori - PRINT *, 'Loop over all the decomposition (can take a while) ...' - PRINT *, '' - DO jni=iminproci, imaxproci - DO jnj=iminprocj, imaxprocj - ! Limitation of the maxumun number of PE's - IF ( jni*jnj <= nn_procmax .AND. jni*jnj >= nn_procmin ) THEN - ! - ! 1. Dimension arrays for subdomains - ! ----------------------------------- - ! - ! Partition : size of sub-domain - jpimax=(npiglo-2*jpreci + (jni-1))/jni + 2*jpreci - jpjmax=(npjglo-2*jprecj + (jnj-1))/jnj + 2*jprecj - ! - ! Memory optimization ? - IF ( ln_memchk ) THEN - required_memory=rppmpt*jpimax*jpjmax*nn_jpk - IF( required_memory > rn_ppmcal ) EXIT - IF( required_memory > rn_ppmax*rn_ppmcal .OR. required_memory < rn_ppmin*rn_ppmcal) EXIT - ENDIF - nvalid=nvalid+1 - ! - ! Position of each sub domain (jni x jni in total ) - nreci = 2*jpreci ; nrecj = 2*jprecj - iresti = 1 + MOD ( npiglo - nreci - 1 , jni ) ; irestj = 1 + MOD ( npjglo - nrecj - 1 , jnj ) - ! - ! - ilci( 1:iresti, 1:jnj) = jpimax - ilci(iresti+1:jni , 1:jnj) = jpimax-1 - - ilcj(1:jni, 1:irestj) = jpjmax - ilcj(1:jni,irestj+1:jnj ) = jpjmax-1 - - ! 2. Index arrays for subdomains - ! ------------------------------- - iimppt(1:jni, 1:jnj) = 1 - ijmppt(1:jni, 1:jnj) = 1 - IF( jni > 1 ) THEN - DO jj=1,jnj - DO ji=2,jni - iimppt(ji,jj)= iimppt(ji-1,jj) + ilci(ji-1,jj) - nreci - END DO - END DO - ENDIF - - IF( jnj > 1 ) THEN - DO jj=2,jnj - DO ji=1,jni - ijmppt(ji,jj)= ijmppt(ji,jj-1) + ilcj(ji,jj-1) - nrecj - END DO - END DO - ENDIF - ! - ! Loop on each subdomain to look for land proportion - nland = 0 - nocea = 0 - ioce = 0 - oce_cover_min = 1.e+20 - oce_cover_max = -1.e+20 - inf10=0 - inf30=0 - inf50=0 - ! - ! 3. Subdomain description in the Regular Case - ! -------------------------------------------- - ! - DO jarea = 1, jni*jnj - iarea0 = jarea - 1 - ii = 1 + MOD(iarea0,jni) - ij = 1 + iarea0/jni - ili = ilci(ii,ij) - ilj = ilcj(ii,ij) - - isurf = 0 - ! loop on inner point of sub-domain - DO jj=1, ilj - DO ji=1, ili - IF( tmask(ji + iimppt(ii,ij) - 1, jj + ijmppt(ii,ij) - 1) == 1 ) isurf=isurf+1 - END DO - END DO - - nimpp = iimppt(ii,ij) - njmpp = ijmppt(ii,ij) - ii1 = nimpp+jpreci ; ii2 = nimpp+ili-1 -jpreci - ij1 = njmpp+jprecj ; ij2 = njmpp+ilj-1 -jprecj - IF ( isurf == 0 ) THEN - nland = nland+1 - nldi_land(nland) = ii1 - nlei_land(nland) = ii2 - nldj_land(nland) = ij1 - nlej_land(nland) = ij2 - ELSE - nocea = nocea+1 - ioce = ioce + isurf - nldi_ocea(nocea) = ii1 - nlei_ocea(nocea) = ii2 - nldj_ocea(nocea) = ij1 - nlej_ocea(nocea) = ij2 - ENDIF - - ! ratio of wet points over total number of point per proc. - oce_cover = float(isurf)/float(jpimax*jpjmax) - - IF(oce_cover_min > oce_cover .AND. isurf /= 0) oce_cover_min=oce_cover - IF(oce_cover_max < oce_cover .AND. isurf /= 0) oce_cover_max=oce_cover - IF(oce_cover < 0.1 .AND. isurf /= 0) inf10=inf10+1 - IF(oce_cover < 0.3 .AND. isurf /= 0) inf30=inf30+1 - IF(oce_cover < 0.5 .AND. isurf /= 0) inf50=inf50+1 - ! - !END DO ! loop on processors - END DO ! loop on processors - ! - ratio=float(nocea)*float(jpimax*jpjmax)/float(npiglo*npjglo) - - ! criteria for printing results - ll_criteria = ( ( MOD ( nocea, nmodulo ) == 0 ) .AND. & - & ( ratio <= ratio_min ) .AND. & - & ( nocea >= nocea_min ) ) - IF ( ll_keep ) THEN ! the loop in done only once ! - WRITE(cdum,'(a,"-",i3.3,"x",i3.3,"_",i4.4)') TRIM(cn_fovdta), nkeepi, nkeepj, nocea - OPEN(numout, file=cdum ) - WRITE(numout,'("# ocean ",i5)') nocea - DO jjc=1, nocea - WRITE(numout,'("#",i5)') jjc - WRITE(numout,'(2i5)') nldi_ocea(jjc)-1+nn_izoom-1, nldj_ocea(jjc)-1+nn_jzoom -1 - WRITE(numout,'(2i5)') nlei_ocea(jjc)+1+nn_izoom-1, nldj_ocea(jjc)-1+nn_jzoom -1 - WRITE(numout,'(2i5)') nlei_ocea(jjc)+1+nn_izoom-1, nlej_ocea(jjc)+1+nn_jzoom -1 - WRITE(numout,'(2i5)') nldi_ocea(jjc)-1+nn_izoom-1, nlej_ocea(jjc)+1+nn_jzoom -1 - WRITE(numout,'(2i5)') nldi_ocea(jjc)-1+nn_izoom-1, nldj_ocea(jjc)-1+nn_jzoom -1 - WRITE(numout,'(2i5)') 9999, 9999 - ENDDO - ! - WRITE(numout,'("# land ",i5)') nland - DO jjc=1, nland - WRITE(numout,'("# land ",i5)') jjc - WRITE(numout,'(2i5)') nldi_land(jjc)-1+nn_izoom-1, nldj_land(jjc)-1+nn_jzoom -1 - WRITE(numout,'(2i5)') nlei_land(jjc)+1+nn_izoom-1, nldj_land(jjc)-1+nn_jzoom -1 - WRITE(numout,'(2i5)') nlei_land(jjc)+1+nn_izoom-1, nlej_land(jjc)+1+nn_jzoom -1 - WRITE(numout,'(2i5)') nldi_land(jjc)-1+nn_izoom-1, nlej_land(jjc)+1+nn_jzoom -1 - WRITE(numout,'(2i5)') nldi_land(jjc)-1+nn_izoom-1, nldj_land(jjc)-1+nn_jzoom -1 - WRITE(numout,'(2i5)') nlei_land(jjc)+1+nn_izoom-1, nlej_land(jjc)+1+nn_jzoom -1 - WRITE(numout,'(2i5)') nldi_land(jjc)-1+nn_izoom-1, nlej_land(jjc)+1+nn_jzoom -1 - WRITE(numout,'(2i5)') nlei_land(jjc)+1+nn_izoom-1, nldj_land(jjc)-1+nn_jzoom -1 - WRITE(numout,'(2i5)') 9999, 9999 - ENDDO - ! - ELSE - IF ( ll_criteria ) THEN - WRITE(numout,*) ' iresti=',iresti,' irestj=',irestj - WRITE(numout,*) '--> Total number of domains ',jni*jnj - WRITE(numout,*) ' ' - WRITE(numout,*) ' jpni=',jni ,' jpnj=',jnj - WRITE(numout,*) ' jpi= ',jpimax ,' jpj= ',jpjmax - WRITE(numout,*) ' Number of ocean processors ', nocea - WRITE(numout,*) ' Number of land processors ', nland - WRITE(numout,*) ' Mean ocean coverage per domain ', float(ioce)/float(nocea)/float(jpimax*jpjmax) - WRITE(numout,*) ' Minimum ocean coverage ', oce_cover_min - WRITE(numout,*) ' Maximum ocean coverage ', oce_cover_max - WRITE(numout,*) ' nb of proc with coverage < 10 % ', inf10 - WRITE(numout,*) ' nb of proc with coverage 10 < nb < 30 % ', inf30 - inf10 - WRITE(numout,*) ' nb of proc with coverage 30 < nb < 50 % ', inf50 - inf30 - WRITE(numout,*) ' Number of computed points ', nocea*jpimax*jpjmax - WRITE(numout,*) ' Overhead of computed points ', nocea*jpimax*jpjmax-npiglo*npjglo - WRITE(numout,*) ' % sup (computed / global) ', ratio - WRITE(numout,*) - ENDIF ! note that indication of optimum does not take modulo into account (for information) - ! - ! Look for optimum - IF( nland > nland_opt ) THEN - npni_opt = jni - npnj_opt = jnj - jpimax_opt = jpimax - jpjmax_opt = jpjmax - nland_opt = nland - ioce_opt = ioce - oce_cover_min_opt = oce_cover_min - oce_cover_max_opt = oce_cover_max - inf10_opt = inf10 - inf30_opt = inf30 - inf50_opt = inf50 - ratio_opt = ratio - ELSE IF( nland == nland_opt .AND. ratio_opt < ratio) THEN - npni_opt = jni - npnj_opt = jnj - jpimax_opt = jpimax - jpjmax_opt = jpjmax - ioce_opt = ioce - oce_cover_min_opt = oce_cover_min - oce_cover_max_opt = oce_cover_max - inf10_opt = inf10 - inf30_opt = inf30 - inf50_opt = inf50 - ratio_opt = ratio - ENDIF - ENDIF - ENDIF - END DO - END DO - ! - ! print optimal result - IF ( .NOT. ll_keep ) THEN - IF ( nvalid == 0 ) THEN - WRITE(numout,*) ' no possible choice ...' - WRITE(numout,*) - WRITE(numout,*) 'insufficient number of processors for the available memory' - STOP - ENDIF - - WRITE(numout,*) ' Optimal choice' - WRITE(numout,*) ' ==============' - WRITE(numout,*) - WRITE(numout,*) '--> Total number of domains ',npni_opt*npnj_opt - WRITE(numout,*) ' ' - WRITE(numout,*) ' jpni=',npni_opt ,' jpnj=',npnj_opt - WRITE(numout,*) ' jpi= ',jpimax_opt ,' jpj= ',jpjmax_opt - WRITE(numout,*) - WRITE(numout,*) ' Number of ocean processors ', npni_opt*npnj_opt-nland_opt - WRITE(numout,*) ' Number of land processors ', nland_opt - WRITE(numout,*) ' Mean ocean coverage ', float(ioce_opt)/float(npni_opt*npnj_opt-nland_opt)/float(jpimax_opt*jpjmax_opt) - WRITE(numout,*) ' Minimum ocean coverage ', oce_cover_min_opt - WRITE(numout,*) ' Maximum ocean coverage ', oce_cover_max_opt - WRITE(numout,*) ' nb of proc with coverage < 10 % ', inf10_opt - WRITE(numout,*) ' nb of proc with coverage 10 < nb < 30 % ', inf30_opt - inf10_opt - WRITE(numout,*) ' nb of proc with coverage 30 < nb < 50 % ', inf50_opt - inf30_opt - WRITE(numout,*) ' Number of computed points ', (npni_opt*npnj_opt-nland_opt)*jpimax_opt*jpjmax_opt - WRITE(numout,*) ' Overhead of computed points ', (npni_opt*npnj_opt-nland_opt)*jpimax_opt*jpjmax_opt-npiglo*npjglo - WRITE(numout,*) ' % sup (computed / global) ', ratio_opt - WRITE(numout,*) - ENDIF - CLOSE(numout) - ! - STOP -END PROGRAM mpp_optimize diff --git a/tools/MPP_PREP/src/mppopt_showproc_nc.f90 b/tools/MPP_PREP/src/mppopt_showproc_nc.f90 deleted file mode 100644 index dfd38b7c7f0830171102e90468510e131fc7a22b..0000000000000000000000000000000000000000 --- a/tools/MPP_PREP/src/mppopt_showproc_nc.f90 +++ /dev/null @@ -1,452 +0,0 @@ -PROGRAM mppopt_showproc_nc - !!--------------------------------------------------------------------- - !! - !! PROGRAM MPP_showproc_nc - !! *********************** - !! - !! PURPOSE : - !! --------- - !! Build a ascii file (suitable for the overlay function of - !! chart) holding the chosen domain decomposition, formely - !! determined by mpp_opatimize_nc. - !! It takes the same namelist than mpp_optimize_nc, with - !! the jpni, jpnj given in the namelist (NAMKEEP) - !! - !! - !! The output file is called from a root name in the namelist - !! (covdta) with the jpni, jpnj, and jpnij added to the name. - !! MODIFICATIONS: - !! -------------- - !! original : 95-12 (Imbard M) - !! modif pour chart : 98-12 ( J.M. Molines) - !! 26/05/2005 : English documentation (partial ..) JMM - !!---------------------------------------------------------------------- - ! - USE netcdf - IMPLICIT NONE - ! - INTEGER :: jprocx=250 - ! - INTEGER :: jpmem=0 - ! - ! les dimensions du modele - ! - INTEGER :: jpk,jpiglo,jpjglo, jpidta, jpjdta - NAMELIST /namspace/ jpk,jpiglo,jpjglo, jpidta, jpjdta,nizoom,njzoom - NAMELIST /namproc/ jprocx, jpmem - - INTEGER :: jpni,jpnj, jpnij - CHARACTER(LEN=80) :: covdta, cdum - NAMELIST /namkeep/ jpni,jpnj,covdta - - CHARACTER(LEN=80) :: cbathy - LOGICAL :: ln_zps=.false. - NAMELIST /namfile / cbathy, ln_zps - !! - ! quelques parametres - ! - INTEGER :: jpnix,jpnjx - ! - INTEGER,PARAMETER :: jpreci=1,jprecj=1 - ! - ! les dimensions de la memoire du modele et du calculateur (T3E) - ! - REAL(KIND=4) :: ppmpt , & - ppmcal = 1000000000., & - ppmin = 0.4, & - ppmax = 1.0 - ! Aleph - ! PARAMETER(ppmcal=16000000.) - !Brodie - ! PARAMETER(ppmcal=250000000.) - ! Uqbar - ! PARAMETER(ppmcal=3750000000.) - ! Zahir - ! PARAMETER(ppmcal=1000000000.) - NAMELIST /namparam/ ppmcal, ppmin, ppmax - - - ! - INTEGER,PARAMETER :: iumout=8, numnam=4, iumbat=11 - INTEGER :: ji,jj,jn,jni,jnj,jni2,jnj2 - INTEGER :: ifreq,il1,il2 - INTEGER :: ii,iim,ij,ijm,imoy,iost,iresti,irestj,isurf,ivide - INTEGER :: iilb,ijlb,ireci,irecj,in - INTEGER :: ipi,ipj - INTEGER :: inf10,inf30,inf50,iptx,isw - INTEGER :: iii,iij,iiii,iijj,iimoy,iinf10,iinf30,iinf50 - ! - INTEGER,DIMENSION(:,:),ALLOCATABLE :: ibathy ! jpidta -jpjdta - INTEGER,DIMENSION(:,:),ALLOCATABLE :: ippdi, ippdj ,iidom, ijdom - INTEGER,DIMENSION(:) ,ALLOCATABLE :: nlei, nldi,nlej,nldj,ICOUNT - INTEGER,DIMENSION(:) ,ALLOCATABLE :: nleiv, nldiv,nlejv,nldjv - INTEGER :: jjc, nizoom, njzoom - ! - REAL(KIND=4) :: zmin,zmax,zper,zmem - REAL(KIND=4) :: zzmin,zzmax,zperx - REAL(KIND=4),DIMENSION(:,:),ALLOCATABLE :: zmask, zdta, & ! jpiglo -jpjglo - zlamt, zphit - REAL(KIND=4),DIMENSION(:),ALLOCATABLE :: zdept ! jpk - LOGICAL :: llbon, lwp=.true. - CHARACTER(LEN=80) :: clvar - INTEGER :: numout=6, itime, ipk, istep, inum - REAL(KIND=4) :: zdt, zdate0 - ! CDF stuff - INTEGER :: ncid, ivarid, istatus - - ! - ! - ! - ! 0. Initialisation - ! ----------------- - ! - OPEN(numnam,FILE='namelist') - - REWIND(numnam) - READ(numnam,namspace) - ALLOCATE ( ibathy(jpidta,jpjdta), zmask(jpiglo,jpjglo) ,zdta(jpidta,jpjdta)) - ALLOCATE ( zlamt(jpidta,jpjdta), zphit(jpidta,jpjdta)) - - REWIND(numnam) - READ(numnam,namparam) - - REWIND(numnam) - READ(numnam,namproc) - - ppmpt = 55.+73./jpk - jpnix = jprocx ; jpnjx=jprocx - - ALLOCATE (ippdi(jpnix,jpnjx), ippdj(jpnix,jpnjx) ) - ALLOCATE (iidom(jpnix,jpnjx), ijdom(jpnix,jpnjx) ) - ALLOCATE (nlei(jprocx), nldi(jprocx) ) - ALLOCATE (nlej(jprocx), nldj(jprocx) ) -! empty processors - ALLOCATE (nleiv(jprocx), nldiv(jprocx) ) - ALLOCATE (nlejv(jprocx), nldjv(jprocx) ) - ALLOCATE (ICOUNT(jprocx), zdept(jpk) ) - - REWIND(numnam) - READ(numnam,namfile) - - REWIND(numnam) - READ(numnam,namkeep) - - WRITE(iumout,*) - WRITE(iumout,*) ' optimisation de la partition' - WRITE(iumout,*) ' ----------------------------' - WRITE(iumout,*) - - ! - ! Lecture de la bathymetrie - ! - ! open the file - IF ( ln_zps ) THEN - clvar = 'Bathymetry' - - ELSE - clvar = 'Bathy_level' - ENDIF - - INQUIRE( FILE=cbathy, EXIST=llbon ) - IF( llbon ) THEN - istatus=NF90_OPEN(cbathy,NF90_NOWRITE,ncid) - istatus=NF90_INQ_VARID(ncid,clvar,ivarid) - istatus=NF90_GET_VAR(ncid,ivarid,zdta) - istatus=NF90_CLOSE(ncid) - ELSE - WRITE(numout,*)' mppini_2 : unable to read the file', cbathy - ENDIF - - ! land/sea mask over the global/zoom domain - -! imask(:,:)=1 -! WHERE ( zdta(jpizoom:jpiglo+jpizoom-1, jpjzoom:jpjglo+jpjzoom-1) == 0.e0 ) imask = 0 - ibathy(:,:)=zdta(:,:) - - DO jj=1,jpjglo - DO ji=1,jpiglo - zmask(ji,jj) = float(ibathy(ji+nizoom -1,jj+njzoom -1)) - END DO - END DO - DO jj=1,jpjglo - DO ji=1,jpiglo - zmask(ji,jj)= min(REAL(1.,kind=4),max(REAL(0.,kind=4),zmask(ji,jj))) - END DO - END DO - print *,'Nombre de pts mer :', sum(zmask) - ! - ! - ! 1. Boucle sur le nombre de processeurs - ! --------------------------------------- - ! - iii=1 - iij=1 - iiii=jpiglo - iijj=jpjglo - iptx=0 - iimoy=0 - zzmin=0. - zzmax=0. - iinf10=0 - iinf30=0 - iinf50=0 - zperx=1. - in=0 -! Next loop corresponds to just 1 case, which is the one kept from mpp_optimize. - DO jni=jpni,jpni - DO jnj=jpnj,jpnj - ! - ! Limitation nombre de pe - ! - IF(jni*jnj.GT.jprocx) go to 1000 - ! - ! Partition - ! - ipi=(jpiglo-2*jpreci + (jni-1))/jni + 2*jpreci - ipj=(jpjglo-2*jprecj + (jnj-1))/jnj + 2*jprecj - ! - ! Optimisation memoire ? - ! - isw=0 - zmem=ppmpt*ipi*ipj*jpk + jpiglo*jpjglo - IF(zmem.GT.ppmcal) go to 1000 - IF(jpmem.EQ.1) THEN - IF(zmem.GT.ppmax*ppmcal.OR.zmem.LT.ppmin*ppmcal) isw=1 - ENDIF - IF(isw.EQ.1) go to 1000 - in=in+1 - ! - WRITE(iumout,*) '--> nombre de processeurs ',jni*jnj - WRITE(iumout,*) ' ' - WRITE(iumout,*) " jpni=",jni ," jpnj=",jnj - WRITE(iumout,*) " jpi= ",ipi ," jpj= ",ipj - zper=(jni*jnj*ipi*ipj)/float(jpiglo*jpjglo) - WRITE(iumout,*) " rapport jpnij*domain/global domain ",zper - ! - ! Coin en bas a gauche de chaque processeur - ! - iilb=1 - ijlb=1 - ireci=2*jpreci - irecj=2*jprecj - iresti = MOD ( jpiglo - ireci , jni ) - irestj = MOD ( jpjglo - irecj , jnj ) - ! - IF (iresti.EQ.0) iresti = jni - DO jj=1,jnj - DO ji=1,iresti - ippdi(ji,jj) = ipi - END DO - DO ji=iresti+1,jni - ippdi(ji,jj) = ipi -1 - END DO - END DO - IF (irestj.EQ.0) irestj = jnj - DO ji=1,jni - DO jj=1,irestj - ippdj(ji,jj) = ipj - END DO - DO jj=irestj+1,jnj - ippdj(ji,jj) = ipj -1 - END DO - END DO - DO jj=1,jnj - DO ji=1,jni - iidom(ji,jj)=iilb - ijdom(ji,jj)=ijlb - END DO - END DO - ! - ! 2. Boucle sur les processeurs - ! ------------------------------ - ! - ivide=0 - imoy=0 - zmin=1.e+20 - zmax=-1.e+20 - inf10=0 - inf30=0 - inf50=0 - jjc=0 - ! - DO jni2=1,jni - DO jnj2=1,jnj - - IF(jni.GT.1)THEN - DO jj=1,jnj - DO ji=2,jni - iidom(ji,jj)=iidom(ji-1,jj)+ippdi(ji-1,jj)-ireci - END DO - END DO - iilb=iidom(jni2,jnj2) - ENDIF - IF(jnj.GT.1)THEN - DO jj=2,jnj - DO ji=1,jni - ijdom(ji,jj)=ijdom(ji,jj-1)+ippdj(ji,jj-1)-irecj - END DO - END DO - ijlb=ijdom(jni2,jnj2) - ENDIF - - ! Check wet points over the entire domain to preserve the MPI communication stencil - isurf=0 - DO jj=1,ippdj(jni2,jnj2) - DO ji=1,ippdi(jni2,jnj2) - IF(zmask(ji+iilb-1,jj+ijlb-1).EQ.1.) isurf=isurf+1 - END DO - END DO - - IF(isurf.EQ.0) THEN - ivide=ivide+1 - nldiv(ivide)=jpreci+iilb - nleiv(ivide)=iilb+ippdi(jni2,jnj2)-1-jpreci - nldjv(ivide)=jprecj+ijlb - nlejv(ivide)=ijlb+ippdj(jni2,jnj2)-1-jprecj - ELSE - imoy=imoy+isurf - jjc=jjc+1 - icount(jjc)=isurf - nldi(jjc)=jpreci+iilb - nlei(jjc)=iilb+ippdi(jni2,jnj2)-1-jpreci - nldj(jjc)=jprecj+ijlb - nlej(jjc)=ijlb+ippdj(jni2,jnj2)-1-jprecj - ENDIF - zper=float(isurf)/float(ipi*ipj) - IF(zmin.GT.zper.AND.isurf.NE.0) zmin=zper - IF(zmax.LT.zper.AND.isurf.NE.0) zmax=zper - IF(zper.LT.0.1.AND.isurf.NE.0) inf10=inf10+1 - IF(zper.LT.0.3.AND.isurf.NE.0) inf30=inf30+1 - IF(zper.LT.0.5.AND.isurf.NE.0) inf50=inf50+1 - ! - ! - ! 3. Fin de boucle sur les processeurs, impression - ! ------------------------------------------------ - ! - END DO - END DO - WRITE(iumout,*) ' nombre de processeurs ',jni*jnj - WRITE(iumout,*) ' nombre de processeurs mer ',jni*jnj-ivide - WRITE(iumout,*) ' nombre de processeurs terre ',ivide - WRITE(iumout,*) ' moyenne de recouvrement ',float(imoy)/float(jni*jnj-ivide)/float(ipi*ipj) - WRITE(iumout,*) ' minimum de recouvrement ',zmin - WRITE(iumout,*) ' maximum de recouvrement ',zmax - WRITE(iumout,*) ' nb de p recouvrement < 10 % ',inf10 - WRITE(iumout,*) ' nb de p 10 < nb < 30 % ',inf30-inf10 - WRITE(iumout,*) ' nb de p 30 < nb < 50 % ',inf50-inf10-inf30 - WRITE(iumout,*) ' nombre de points integres ',(jni*jnj-ivide)*ipi*ipj - WRITE(iumout,*) ' nbr de pts supplementaires ',(jni*jnj-ivide)*ipi*ipj-jpiglo*jpjglo - zper=float((jni*jnj-ivide))*float(ipi*ipj)/float(jpiglo*jpjglo) - WRITE(iumout,*) ' % sup ',zper - WRITE(iumout,*) - WRITE(iumout,*) ' PROCESSORS WITH LESS THAN 100 WATER POINTS' - - WRITE(cdum,'(a,1h-,i3.3,1hx,i3.3,1h_,i3.3)') TRIM(covdta),jpni,jpnj,jni*jnj -ivide - OPEN (10,file=cdum) - WRITE(10,'(a,i5)')'#',jni*jnj -ivide - DO jjc=1,jni*jnj-ivide - WRITE(10,'(a,i5)')'#',jjc - WRITE(10,'(2i5)')nldi(jjc)-1+nizoom-1,nldj(jjc)-1+njzoom -1 - WRITE(10,'(2i5)')nlei(jjc)+1+nizoom-1,nldj(jjc)-1+njzoom -1 - WRITE(10,'(2i5)')nlei(jjc)+1+nizoom-1,nlej(jjc)+1+njzoom -1 - WRITE(10,'(2i5)')nldi(jjc)-1+nizoom-1,nlej(jjc)+1+njzoom -1 - WRITE(10,'(2i5)')nldi(jjc)-1+nizoom-1,nldj(jjc)-1+njzoom -1 - WRITE(10,'(2i5)') 9999,9999 - IF (icount(jjc).LT.100) THEN - WRITE(iumout,*)' proc ji=',jjc,' water points:', icount(jjc) - WRITE(iumout,*) ' ji from ',nldi(jjc), ' to :',nlei(jjc) - WRITE(iumout,*) ' jj / mask value for all ji' - DO jj=nldj(jjc),nlej(jjc) - WRITE(iumout,900) jj,(INT(zmask(ji,jj)),ji=nldi(jjc),nlei(jjc)) - ENDDO -900 FORMAT(1x,i4,1x,9(10i1,1x)) - ENDIF - ENDDO - WRITE(10,'(a,i5)')'# vides:',ivide - DO jjc=1,ivide - WRITE(10,'(a,i5)')'# vide ',jjc - WRITE(10,'(2i5)')nldiv(jjc)-1+nizoom-1,nldjv(jjc)-1+njzoom -1 - WRITE(10,'(2i5)')nleiv(jjc)+1+nizoom-1,nldjv(jjc)-1+njzoom -1 - WRITE(10,'(2i5)')nleiv(jjc)+1+nizoom-1,nlejv(jjc)+1+njzoom -1 - WRITE(10,'(2i5)')nldiv(jjc)-1+nizoom-1,nlejv(jjc)+1+njzoom -1 - WRITE(10,'(2i5)')nldiv(jjc)-1+nizoom-1,nldjv(jjc)-1+njzoom -1 - WRITE(10,'(2i5)')nleiv(jjc)+1+nizoom-1,nlejv(jjc)+1+njzoom -1 - WRITE(10,'(2i5)')nldiv(jjc)-1+nizoom-1,nlejv(jjc)+1+njzoom -1 - WRITE(10,'(2i5)')nleiv(jjc)+1+nizoom-1,nldjv(jjc)-1+njzoom -1 - WRITE(10,'(2i5)') 9999,9999 - END DO - - ! - ! - ! 4. Recherche de l optimum - ! ------------------------- - ! - IF(ivide.GT.iptx) THEN - iii=jni - iij=jnj - iiii=ipi - iijj=ipj - iptx=ivide - iimoy=imoy - zzmin=zmin - zzmax=zmax - iinf10=inf10 - iinf30=inf30 - iinf50=inf50 - zperx=zper - ELSE IF(ivide.EQ.iptx.AND.zperx.LT.zper) THEN - iii=jni - iij=jnj - iiii=ipi - iijj=ipj - iimoy=imoy - zzmin=zmin - zzmax=zmax - iinf10=inf10 - iinf30=inf30 - iinf50=inf50 - zperx=zper - ENDIF - ! - ! 5. Fin de boucle sur le nombre de processeurs - ! --------------------------------------------- - ! -1000 CONTINUE - END DO - END DO - ! - ! - ! 6. Affichage resultat - ! --------------------- - ! - IF(in.EQ.0) THEN - WRITE(iumout,*) ' le choix n a pas pu etre fait ' - WRITE(iumout,*) - WRITE(iumout,*) 'le nombre de processeurs maximum est insuffisant' - STOP - ENDIF - WRITE(iumout,*) ' choix optimum' - WRITE(iumout,*) ' =============' - WRITE(iumout,*) - WRITE(iumout,*) '--> nombre de processeurs ',iii*iij - WRITE(iumout,*) ' ' - WRITE(iumout,*) " jpni=",iii ," jpnj=",iij - WRITE(iumout,*) " jpi= ",iiii ," jpj= ",iijj - WRITE(iumout,*) - WRITE(iumout,*) ' nombre de processeurs mer ',iii*iij-iptx - WRITE(iumout,*) ' nombre de processeurs terre ',iptx - WRITE(iumout,*) ' moyenne de recouvrement ',float(iimoy)/float(iii*iij-iptx)/float(iiii*iijj) - WRITE(iumout,*) ' minimum de recouvrement ',zzmin - WRITE(iumout,*) ' maximum de recouvrement ',zzmax - WRITE(iumout,*) ' nb de p recouvrement < 10 % ',iinf10 - WRITE(iumout,*) ' nb de p 10 < nb < 30 % ',iinf30-iinf10 - WRITE(iumout,*) ' nb de p 30 < nb < 50 % ',iinf50-iinf10-iinf30 - WRITE(iumout,*) ' nombre de points integres ',(iii*iij-iptx)*iiii*iijj - WRITE(iumout,*) ' nbr de pts supplementaires ',(iii*iij-iptx)*iiii*iijj-jpiglo*jpjglo - WRITE(iumout,*) ' % sup ',zperx - WRITE(iumout,*) - ! - ! - ! - STOP -END PROGRAM mppopt_showproc_nc diff --git a/tools/README.rst b/tools/README.rst index 703a0d688306381c8ee22287f4f2e705924589a2..19b026052ead4cc075c674d7f7394aa48dd36887 100644 --- a/tools/README.rst +++ b/tools/README.rst @@ -56,15 +56,6 @@ MISCELLANEOUS The tool allows to create alternative configurations to the community without having to rely on system team sponsorship and support. -MPP_PREP --------- - -This tool provides the user with information to choose the best domain decomposition. -The tool computes the number of water processors for all possible decompositions, -up to a maximum number of processors -(see :download:`MPP_PREP documentation <../../../tools/MPP_PREP/mpp_nc.pdf>` and -:download:`MPP_PREP archive <../../../tools/MPP_PREP/mpp_prep-1.0.tar.gz>`). - NESTING ------- @@ -88,11 +79,6 @@ REBUILD_NEMO is a tool to rebuild NEMO output files from multiple processors (mesh_mask, restart or XIOS output files) into one file (see :download:`REBUILD_NEMO README <../../../tools/REBUILD_NEMO/README.rst>`). -REBUILD -------- - -It contains the old version of REBUILD_NEMO tool based on the IOIPSL code. - SCOORD_GEN ---------- diff --git a/tools/REBUILD/rebuild b/tools/REBUILD/rebuild deleted file mode 120000 index 0b2a9fa9dfb0de846d0d4070761e7b1e0bc03166..0000000000000000000000000000000000000000 --- a/tools/REBUILD/rebuild +++ /dev/null @@ -1 +0,0 @@ -../../ext/IOIPSL/tools/rebuild \ No newline at end of file diff --git a/tools/REBUILD/src/calendar.f90 b/tools/REBUILD/src/calendar.f90 deleted file mode 120000 index bff4b4c4adcbf139e569ee3221ee33b7c665a523..0000000000000000000000000000000000000000 --- a/tools/REBUILD/src/calendar.f90 +++ /dev/null @@ -1 +0,0 @@ -../../../ext/IOIPSL/src/calendar.f90 \ No newline at end of file diff --git a/tools/REBUILD/src/defprec.f90 b/tools/REBUILD/src/defprec.f90 deleted file mode 120000 index ef6bc88652546176b5156a834e88dfe8b9d091a1..0000000000000000000000000000000000000000 --- a/tools/REBUILD/src/defprec.f90 +++ /dev/null @@ -1 +0,0 @@ -../../../ext/IOIPSL/src/defprec.f90 \ No newline at end of file diff --git a/tools/REBUILD/src/errioipsl.f90 b/tools/REBUILD/src/errioipsl.f90 deleted file mode 120000 index a42fd36e6989261d570032beac196711daf6bff4..0000000000000000000000000000000000000000 --- a/tools/REBUILD/src/errioipsl.f90 +++ /dev/null @@ -1 +0,0 @@ -../../../ext/IOIPSL/src/errioipsl.f90 \ No newline at end of file diff --git a/tools/REBUILD/src/flincom.f90 b/tools/REBUILD/src/flincom.f90 deleted file mode 120000 index 960ad4b27a7e850382df3c46f3af39e6ba0b99c2..0000000000000000000000000000000000000000 --- a/tools/REBUILD/src/flincom.f90 +++ /dev/null @@ -1 +0,0 @@ -../../../ext/IOIPSL/src/flincom.f90 \ No newline at end of file diff --git a/tools/REBUILD/src/flio_rbld.f90 b/tools/REBUILD/src/flio_rbld.f90 deleted file mode 120000 index 19d17cc46fbe2975d583c4dad613e239aa95ca95..0000000000000000000000000000000000000000 --- a/tools/REBUILD/src/flio_rbld.f90 +++ /dev/null @@ -1 +0,0 @@ -../../../ext/IOIPSL/tools/flio_rbld.f90 \ No newline at end of file diff --git a/tools/REBUILD/src/fliocom.f90 b/tools/REBUILD/src/fliocom.f90 deleted file mode 120000 index 8318a48fd3e067aba5a86bfe56f641b02a9233e4..0000000000000000000000000000000000000000 --- a/tools/REBUILD/src/fliocom.f90 +++ /dev/null @@ -1 +0,0 @@ -../../../ext/IOIPSL/src/fliocom.f90 \ No newline at end of file diff --git a/tools/REBUILD/src/getincom.f90 b/tools/REBUILD/src/getincom.f90 deleted file mode 120000 index 06a2079ec770a4a105a262ca96328ff5faf47570..0000000000000000000000000000000000000000 --- a/tools/REBUILD/src/getincom.f90 +++ /dev/null @@ -1 +0,0 @@ -../../../ext/IOIPSL/src/getincom.f90 \ No newline at end of file diff --git a/tools/REBUILD/src/histcom.f90 b/tools/REBUILD/src/histcom.f90 deleted file mode 120000 index 1521441565115d95338e9ad7631edca5831294d7..0000000000000000000000000000000000000000 --- a/tools/REBUILD/src/histcom.f90 +++ /dev/null @@ -1 +0,0 @@ -../../../ext/IOIPSL/src/histcom.f90 \ No newline at end of file diff --git a/tools/REBUILD/src/ioipsl.f90 b/tools/REBUILD/src/ioipsl.f90 deleted file mode 120000 index 3565d9a3754c23306c5e45b8917f6b7f5bf0196a..0000000000000000000000000000000000000000 --- a/tools/REBUILD/src/ioipsl.f90 +++ /dev/null @@ -1 +0,0 @@ -../../../ext/IOIPSL/src/ioipsl.f90 \ No newline at end of file diff --git a/tools/REBUILD/src/mathelp.f90 b/tools/REBUILD/src/mathelp.f90 deleted file mode 120000 index 47b41a38d8f409639bd661f6288e9b3fe938d1d0..0000000000000000000000000000000000000000 --- a/tools/REBUILD/src/mathelp.f90 +++ /dev/null @@ -1 +0,0 @@ -../../../ext/IOIPSL/src/mathelp.f90 \ No newline at end of file diff --git a/tools/REBUILD/src/nc4interface.F90 b/tools/REBUILD/src/nc4interface.F90 deleted file mode 120000 index a8f63cff57ea81100a9620d95e78668774bed116..0000000000000000000000000000000000000000 --- a/tools/REBUILD/src/nc4interface.F90 +++ /dev/null @@ -1 +0,0 @@ -../../../ext/IOIPSL/src/nc4interface.F90 \ No newline at end of file diff --git a/tools/REBUILD/src/ncunderflow.f90 b/tools/REBUILD/src/ncunderflow.f90 deleted file mode 120000 index 483c9647006094a36251c3ac036ddb534cf76cc8..0000000000000000000000000000000000000000 --- a/tools/REBUILD/src/ncunderflow.f90 +++ /dev/null @@ -1 +0,0 @@ -../../../ext/IOIPSL/tools/ncunderflow.f90 \ No newline at end of file diff --git a/tools/REBUILD/src/restcom.f90 b/tools/REBUILD/src/restcom.f90 deleted file mode 120000 index 929002fdd07989fc22030e84c9c46b7270c0f550..0000000000000000000000000000000000000000 --- a/tools/REBUILD/src/restcom.f90 +++ /dev/null @@ -1 +0,0 @@ -../../../ext/IOIPSL/src/restcom.f90 \ No newline at end of file diff --git a/tools/REBUILD/src/stringop.f90 b/tools/REBUILD/src/stringop.f90 deleted file mode 120000 index 580f24326386bde184de92932f0039e59d756e52..0000000000000000000000000000000000000000 --- a/tools/REBUILD/src/stringop.f90 +++ /dev/null @@ -1 +0,0 @@ -../../../ext/IOIPSL/src/stringop.f90 \ No newline at end of file