Changes between Version 33 and Version 34 of AdaptParallelization


Ignore:
Timestamp:
May 20, 2025, 11:06:13 AM (2 weeks ago)
Author:
lnerger
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • AdaptParallelization

    v33 v34  
    2828
    2929
     30== Using COMM_model ==
     31
     32Frequently the parallelization of a model is initialized in the model by the lines:
     33{{{
     34      CALL MPI_Init(ierr)
     35      CALL MPI_Comm_Rank(MPI_COMM_WORLD, rank, ierr)
     36      CALL MPI_Comm_Size(MPI_COMM_WORLD, size, ierr)
     37}}}
     38Here, the call to `MPI_init` is mandatory, while the two other lines are optional, but common. 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.
     39
     40Subsequently, one can define `COMM_model` by
     41{{{
     42      COMM_model = MPI_COMM_WORLD
     43}}}
     44In addition, the variable `COMM_model` has to be declared in a way such that all routines using the communicator can access it. The parallelization variables of the model are frequently held in a Fortran module. In this case, it is easiest to add `COMM_model` as an integer variable here.  (The tutorial declares `COMM_model` and other parallelization-related variables in `mod_parallel.F90`)
     45
     46Having defined the communicator `COMM_model`, the communicator `MPI_COMM_WORLD` has to be replaced by `COMM_model` in all routines that perform MPI communication, except in calls to `MPI_init`, `MPI_finalize`, and `MPI_abort`.
     47The changes described by now must not influence the execution of the model itself. Thus, after these changes, one can run the model to ensure that the model compiles and runs correctly.
     48
     49
    3050== Three communicators ==
    3151
     
    4363[[BR]]'''Figure 1:''' Example of a typical configuration of the communicators using a parallelized model. In this example we have 12 processes over all, which are distributed over 3 model tasks (COMM_model) so that 3 model states can be integrated at the same time. COMM_couple combines each set of 3 communicators of the different model tasks. The filter is executed using COMM_filter which uses the same processes of the first model tasks, i.e. COMM_model 1 (Figure credits: A. Corbin)
    4464
    45 == Using COMM_model ==
    4665
    47 Frequently the parallelization of a model is initialized in the model by the lines:
    48 {{{
    49       CALL MPI_Init(ierr)
    50       CALL MPI_Comm_Rank(MPI_COMM_WORLD, rank, ierr)
    51       CALL MPI_Comm_Size(MPI_COMM_WORLD, size, ierr)
    52 }}}
    53 (The call to `MPI_init` is mandatory, while the two other lines 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.
    54 
    55 Subsequently, one can define `COMM_model` by
    56 {{{
    57       COMM_model = MPI_COMM_WORLD
    58 }}}
    59 In addition, the variable `COMM_model` has to be declared in a way such that all routines using the communicator can access it. The parallelization variables of the model are frequently held in a Fortran module. In this case, it is easiest to add `COMM_model` as an integer variable here.  (The tutorial declares `COMM_model` and other parallelization-related variables in `mod_parallel.F90`)
    60 
    61 Having defined the communicator `COMM_model`, the communicator `MPI_COMM_WORLD` has to be replaced by `COMM_model` in all routines that perform MPI communication, except in calls to `MPI_init`, `MPI_finalize`, and `MPI_abort`.
    62 The changes described by now must not influence the execution of the model itself. Thus, after these changes, one can run the model to ensure that the model compiles and runs correctly.
    6366
    6467== Initializing the communicators ==