File: mpivars.F90

package info (click to toggle)
adios2 2.10.2%2Bdfsg1-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 33,764 kB
  • sloc: cpp: 175,964; ansic: 160,510; f90: 14,630; yacc: 12,668; python: 7,275; perl: 7,126; sh: 2,825; lisp: 1,106; xml: 1,049; makefile: 579; lex: 557
file content (30 lines) | stat: -rw-r--r-- 830 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
module mpivars
    implicit none
    include 'mpif.h'

    integer:: app_comm, rank, nproc
    integer:: wrank, wnproc
    integer:: ierr

contains

subroutine init_mpi(color)
    integer, intent(in):: color
    call MPI_Init(ierr)
    ! World comm spans all applications started with the same mpirun command 
    call MPI_Comm_rank(MPI_COMM_WORLD, wrank, ierr)
    call MPI_Comm_size(MPI_COMM_WORLD, wnproc, ierr)

    ! Have to split and create a 'world' communicator for this app only
    ! color must be unique for each application 
    call MPI_Comm_split (MPI_COMM_WORLD, color, wrank, app_comm, ierr)
    call MPI_Comm_rank (app_comm, rank, ierr)
    call MPI_Comm_size (app_comm, nproc , ierr)
end subroutine init_mpi

subroutine finalize_mpi()
    call MPI_Finalize(ierr)
end subroutine finalize_mpi

end module mpivars