MODFLOW 6  version 6.5.0.dev2
MODFLOW 6 Code Documentation
mpiworldmodule Module Reference

Data Types

type  mpiworldtype
 

Functions/Subroutines

type(mpiworldtype) function, pointer, public get_mpi_world ()
 
logical(lgp) function mpiw_has_comm (this)
 Returns true when a communicator has been set. More...
 
subroutine mpiw_set_comm (this, comm)
 Sets a communicator on this world, can. More...
 
subroutine mpiw_init (this)
 
subroutine mpiw_begin_order (this)
 
subroutine mpiw_end_order (this)
 
subroutine mpiw_destroy (this)
 
subroutine, public check_mpi (mpi_error_code)
 Check the MPI error code, report, and. More...
 
subroutine, public mpi_stop (status)
 

Variables

type(mpiworldtype), pointer global_mpi_world
 

Function/Subroutine Documentation

◆ check_mpi()

subroutine, public mpiworldmodule::check_mpi ( integer  mpi_error_code)

Definition at line 115 of file MpiWorld.f90.

116  use simmodule, only: store_error
117  integer :: mpi_error_code
118  ! local
119  character(len=1024) :: mpi_err_msg
120  integer :: err_len
121  integer :: ierr
122 
123  if (mpi_error_code /= mpi_success) then
124  call mpi_error_string(mpi_error_code, mpi_err_msg, err_len, ierr)
125  call store_error("Internal error: "//trim(mpi_err_msg), terminate=.true.)
126  end if
127 
This module contains simulation methods.
Definition: Sim.f90:10
subroutine, public store_error(msg, terminate)
Store an error message.
Definition: Sim.f90:92
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_mpi_world()

type(mpiworldtype) function, pointer, public mpiworldmodule::get_mpi_world

Definition at line 31 of file MpiWorld.f90.

32  type(MpiWorldType), pointer :: world
33 
34  if (.not. associated(global_mpi_world)) then
35  allocate (global_mpi_world)
36  end if
37  world => global_mpi_world
38 
Here is the caller graph for this function:

◆ mpi_stop()

subroutine, public mpiworldmodule::mpi_stop ( integer(i4b)  status)

Definition at line 130 of file MpiWorld.f90.

131  integer(I4B) :: status
132  ! local
133  type(MpiWorldType), pointer :: mpi_world
134  integer :: ierr
135 
136  mpi_world => get_mpi_world()
137  write (*, *) "" ! empty line
138  call mpi_abort(mpi_world%comm, status, ierr)
139 
Here is the call graph for this function:
Here is the caller graph for this function:

◆ mpiw_begin_order()

subroutine mpiworldmodule::mpiw_begin_order ( class(mpiworldtype this)
private

Definition at line 74 of file MpiWorld.f90.

75  class(MpiWorldType) :: this
76  ! local
77  integer :: buffer
78  integer :: status(MPI_STATUS_SIZE)
79  integer :: ierr
80 
81  if (this%mpi_rank > 0) then
82  call mpi_recv(buffer, 1, mpi_integer, this%mpi_rank - 1, this%mpi_rank, &
83  this%comm, status, ierr)
84  end if
85 

◆ mpiw_destroy()

subroutine mpiworldmodule::mpiw_destroy ( class(mpiworldtype this)
private

Definition at line 100 of file MpiWorld.f90.

101  class(MpiWorldType) :: this
102 
103  if (associated(this%comm)) then
104  deallocate (this%comm)
105  end if
106 
107  if (associated(global_mpi_world)) then
108  deallocate (global_mpi_world)
109  end if
110 

◆ mpiw_end_order()

subroutine mpiworldmodule::mpiw_end_order ( class(mpiworldtype this)
private

Definition at line 88 of file MpiWorld.f90.

89  class(MpiWorldType) :: this
90  ! local
91  integer :: ierr
92 
93  if (this%mpi_rank < this%world_size - 1) then
94  call mpi_send(this%mpi_rank, 1, mpi_integer, this%mpi_rank + 1, &
95  this%mpi_rank + 1, this%comm, ierr)
96  end if
97 

◆ mpiw_has_comm()

logical(lgp) function mpiworldmodule::mpiw_has_comm ( class(mpiworldtype this)
private

Definition at line 43 of file MpiWorld.f90.

44  class(MpiWorldType) :: this
45  logical(LGP) :: has_comm
46 
47  has_comm = associated(this%comm)
48 

◆ mpiw_init()

subroutine mpiworldmodule::mpiw_init ( class(mpiworldtype this)
private

Definition at line 62 of file MpiWorld.f90.

63  class(MpiWorldType) :: this
64  ! local
65  integer :: ierr
66 
67  call mpi_comm_size(this%comm, this%world_size, ierr)
68  call mpi_comm_rank(this%comm, this%mpi_rank, ierr)
69  nr_procs = this%world_size
70  proc_id = this%mpi_rank
71 

◆ mpiw_set_comm()

subroutine mpiworldmodule::mpiw_set_comm ( class(mpiworldtype this,
integer(i4b)  comm 
)
private

Definition at line 53 of file MpiWorld.f90.

54  class(MpiWorldType) :: this
55  integer(I4B) :: comm
56 
57  allocate (this%comm)
58  this%comm = comm
59 

Variable Documentation

◆ global_mpi_world

type(mpiworldtype), pointer mpiworldmodule::global_mpi_world

Definition at line 27 of file MpiWorld.f90.

27  type(MpiWorldType), pointer :: global_mpi_world