1). Optimization and MPI parallelisation of the PGD and PREP steps.

1. 1). Optimization and parallelization of the PGD step:

  • We use the mechanics already developed for the OFFLINE step (splitting of the user’s grid with the routine INIT_INDEX_MPI).
  • NB: the options YALG="TILL" and YALG="TILA" (NAM_IO_OFFLINE) can’t be used in the PGD step, as we don’t ever know the user’s grid at its beginning.
  • Optimization and parallelization of the reading of the physiographic maps (TREAT_FIELD, AVERAGE1_..., AVERAGE2_...):
    • For the binary files with direct access (FILETYPE = "DIRECT"), the reading is now done from top to bottom of the file (increasing record numbers) and no longer from bottom to top: it’s quite quicker.
    • The reading itself is parallelized with MPI:
      • In the "DIRECT" case, each MPI task reads only a part of the map, but fills arrays corresponding to the whole domain of the user (because inputs points can be located in the whole user’s grid). In the other filetypes cases, only the NPIO task reads the input file.
      • The gathering of informations coming from all MPI tasks in done by each MPI task in TREAT_FIELD for the points assigned to this task.
  • Parallelization of the interpolation routine (INTERPOL_NPTS):
    • The default NHALO (NAM_IO_OFFLINE) is set to 0 because it’s the cheapest value.
    • NB: as the default value was 2 before, it can give different results than before. In such case, the new results would be more correct because the whole grid is investigated with NHALO=0.
    • Each MPI task interpolates the grid points assigned to it, but uses the whole grid to do this interpolation: it sweeps all the coordinates and then sends/receives needed values from other tasks.
  • The output writing part is parallelized with MPI using I/O routines already developed for the parallelization of the OFFLINE step.

2. Optimization and parallelization of the PREP step:

  • Optimization for the initialization of prognostics fields from an external PREP file (FILETYPE="EXTERN"):
    • the new key LWRITE_EXTERN is added in NAM_PREP_SURF_ATM. When writting the external PREP to be then read, it allows to write the fields DG from ISBA, D_ROOF, R_WALL, D_ROAD and D_FLOOR from TEB. This way, when the second PREP reads this input file, it doesn’t need to read covers from the PGD file (very expensive) and to calcule these depths (expensive too), but only to read them directly in the input PREP.
  • Parallelization of the PREP step:
    • The reading of the input initialization fields is done only by one task.
    • The interpolation is done by each task for its output points. As in the PGD step, it uses the whole user’s grid coordinates and sends/receives only needed values.
    • The extrapolation is parallelized with the help of the NHALO_PREP key (NAM_PREP_SURF_ATM). If NHALO_PREP=0, we use the whole grid for extrapolation, what is to avoid in case of big grids.
      NB: the halo is rectangular, so the results of extrapolation can vary with the value of the halo, because the nearest points in the halo are kept => it’s better not to use a too narrow halo, to be sure we get the nearest points.
  • changes for the reading in case of EXTERN prep:
    • The option HDIR="E" is added for reading:
      • HDIR = "A": the main task gets the read field and doesn’t pack it on the tile
      • HDIR="-" : the field is broadcast to all tasks, but not packed
      • HDIR = "H": the field is packed and the useful part of the field is sent to each task (fields = grid points)
      • HDIR = "E": the field in packed but not sent to other tasks, only the main task knows it.