13 integer(I4B) :: mpi_rank
14 integer(I4B) :: world_size
15 integer(I4B),
pointer :: comm => null()
45 logical(LGP) :: has_comm
47 has_comm =
associated(this%comm)
67 call mpi_comm_size(this%comm, this%world_size, ierr)
68 call mpi_comm_rank(this%comm, this%mpi_rank, ierr)
78 integer :: status(MPI_STATUS_SIZE)
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)
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)
103 if (
associated(this%comm))
then
104 deallocate (this%comm)
117 integer :: mpi_error_code
119 character(len=1024) :: mpi_err_msg
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.)
131 integer(I4B) :: status
138 call mpi_abort(mpi_world%comm, status, ierr)
This module defines variable data types.
type(mpiworldtype) function, pointer, public get_mpi_world()
subroutine mpiw_end_order(this)
logical(lgp) function mpiw_has_comm(this)
Returns true when a communicator has been set.
subroutine mpiw_set_comm(this, comm)
Sets a communicator on this world, can.
subroutine, public mpi_stop(status)
subroutine mpiw_begin_order(this)
type(mpiworldtype), pointer global_mpi_world
subroutine mpiw_init(this)
subroutine, public check_mpi(mpi_error_code)
Check the MPI error code, report, and.
subroutine mpiw_destroy(this)
This module contains simulation methods.
subroutine, public store_error(msg, terminate)
Store an error message.
This module contains simulation variables.