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. |
| 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/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. |
55 | | If the numerical model is not parallelized, it still can be used with parallel model tasks. First, |
| 55 | If 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 | |
| 59 | The 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 | |
| 61 | Even 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 | |
| 65 | In 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 | }}} |
| 72 | together 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 | |
| 74 | If 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. |