Changes between Version 6 and Version 7 of AdaptParallelization


Ignore:
Timestamp:
Aug 23, 2010, 2:50:50 PM (10 years ago)
Author:
lnerger
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • AdaptParallelization

    v6 v7  
    33Like many numerical models, PDAF uses the MPI standard for the parallelization. In the description below, we assume that the model is parallelized using MPI.
    44
    5 PDAF supports a 2-level parallelization: First, the numerical model can be parallelized and can be executed using several processors. Second, several model tasks can be computed in parallel, i.e. a parallel ensemble integration can be performed. This 2-level parallelization has to be initialized before it can be used. The example in `testsuite/dummymodel_1D/` includes the file `init_parallel_pdaf.F90` that can be used as a template for the initialization. The required variables are defined in `testsuite/main/mod_parallel.F90`, which can also be used as a template. If the numerical model itself is parallelized, this parallelization has to be adapted and modified for the 2-level parallelization of the data assimilation system generated by adding PDAF to the model. The necessary steps are described below.
     5PDAF supports a 2-level parallelization: First, the numerical model can be parallelized and can be executed using several processors. Second, several model tasks can be computed in parallel, i.e. a parallel ensemble integration can be performed. This 2-level parallelization has to be initialized before it can be used. The example in `testsuite/src/dummymodel_1D/` includes the file `init_parallel_pdaf.F90` that can be used as a template for the initialization. The required variables are defined in `testsuite/src/main/mod_parallel.F90`, which can also be used as a template. If the numerical model itself is parallelized, this parallelization has to be adapted and modified for the 2-level parallelization of the data assimilation system generated by adding PDAF to the model. The necessary steps are described below.
    66
    77
     
    2424      CALL MPI_Comm_Size(MPI_COMM_WORLD, size, ierr)
    2525}}}
    26 (The call to `MPI_init` is mandatory, while the second an third line are optional) If the model itself is not parallelized, the MPI-initialization will not be present. Please see the section [#Non-parallelmodels Non-parallel models] below for this case.
     26(The call to `MPI_init` is mandatory, while the second an third line are optional) If the model itself is not parallelized, the MPI-initialization will not be present. Please see the section '[#Non-parallelmodels Non-parallel models]' below for this case.
    2727
    2828Subsequently, one can define `COMM_model` by adding
     
    5353== Non-parallel models ==
    5454
    55 If the numerical model is not parallelized, it still can be used with parallel model tasks. First,
     55If the numerical model is not parallelized (i.e. serial), there are two possibilities: The data assimilation system can be used without parallelization (serial), or parallel model tasks can be used in which each model task uses a single process. Both variants are described below.
     56
     57=== Serial assimilation system ===
     58
     59The data assimilation program can be compiled for serial processing without linking a real MPI library. As in the PDAF code calls to MPI functions are implemented, the file `testsuite/src/main/nullmpi.F90` should be compiled and liked. An example for this gives the case `make.arch/linux_gfortran.h`. `nullmpi.F90` provides the functionality of the MPI functions for the case that only a single process is used and hence no real communication is performed.
     60
     61Even without parallelization, the call to `init_parallel_pdaf` described above is still required. The routine will simple initialize the parallelization variables for a single-process case.
     62
     63=== Adding parallelization to a serial model ===
     64
     65In order to use parallel model tasks with a model that is not parallelized, the procedure is generally as described for the fully parallel case. However, one has to add the general initialization of MPI to the model code (or to `init_parallel_pdaf`). This is the lines
     66{{{
     67      CALL MPI_Init(ierr)
     68      CALL MPI_Comm_Rank(MPI_COMM_WORLD, mype_world, ierr)
     69      CALL MPI_Comm_Size(MPI_COMM_WORLD, npes_world, ierr)
     70      COMM_model = MPI_COMM_WORLD
     71}}}
     72together with the `USE` statement for `mod_parallel` should be added. Subsequently, the call to `init_parallel_pdaf has to be inserted at the beginning of the model code.
     73
     74If the program is run with these extensions using multiple model tasks, the issues discussed in '[#Compilingtheextendedprogram Compiling the extended program]' can occur. This one has to take care about which processes will perform output to the screen or to files.