36 integer,
public :: mpi_lib_dummy
39 create_intranode_communicator, &
40 lmpi_create_shared_memory_window, &
41 lmpi_destroy_shared_memory_window, &
42 lmpi_sync_shared_memory_window, &
43 lmpi_gen_allgatherv, &
46 interface lmpi_create_shared_memory_window
47 module procedure dlmpi_create_shared_memory_window, zlmpi_create_shared_memory_window
48 module procedure ilmpi_create_shared_memory_window, llmpi_create_shared_memory_window
49 end interface lmpi_create_shared_memory_window
51 interface lmpi_gen_allgatherv
52 module procedure dlmpi_gen_allgatherv, zlmpi_gen_allgatherv
53 module procedure ilmpi_gen_allgatherv, llmpi_gen_allgatherv
54 end interface lmpi_gen_allgatherv
63 integer function lmpi_translate_rank(from_comm, to_comm, rank)
64 type(MPI_Comm),
intent(in) :: from_comm
65 type(MPI_Comm),
intent(in) :: to_comm
66 integer,
intent(in) :: rank
68 type(MPI_Group) :: from_group, to_group
69 integer :: from_rank(1), to_rank(1)
71 push_sub(lmpi_translate_rank)
73 call mpi_comm_group(from_comm, from_group)
74 call mpi_comm_group(to_comm, to_group)
77 call mpi_group_translate_ranks(from_group, 1, from_rank, to_group, to_rank)
79 lmpi_translate_rank = to_rank(1)
82 call mpi_group_free(from_group)
83 call mpi_group_free(to_group)
85 pop_sub(lmpi_translate_rank)
86 end function lmpi_translate_rank
89 subroutine lmpi_destroy_shared_memory_window(window)
90 type(MPI_Win),
intent(inout) :: window
92 push_sub(lmpi_destroy_shared_memory_window)
95 call mpi_win_unlock_all(window)
97 call mpi_win_free(window)
99 pop_sub(lmpi_destroy_shared_memory_window)
100 end subroutine lmpi_destroy_shared_memory_window
103 subroutine lmpi_sync_shared_memory_window(window, intranode_grp)
104 type(MPI_Win),
intent(in) :: window
105 type(mpi_grp_t),
intent(in) :: intranode_grp
107 push_sub(lmpi_sync_shared_memory_window)
109 call mpi_win_sync(window)
110 call intranode_grp%barrier()
112 pop_sub(lmpi_sync_shared_memory_window)
113 end subroutine lmpi_sync_shared_memory_window
115 subroutine create_intranode_communicator(base_grp, intranode_grp, internode_grp)
116 type(mpi_grp_t),
intent(in) :: base_grp
117 type(mpi_grp_t),
intent(out) :: intranode_grp
118 type(mpi_grp_t),
intent(out) :: internode_grp
119 type(MPI_Comm) :: comm
121 push_sub(create_intranode_communicator)
125 call mpi_comm_split_type(base_grp%comm, mpi_comm_type_shared, base_grp%rank, mpi_info_null, comm)
130 call mpi_comm_split(base_grp%comm, intranode_grp%rank, base_grp%rank, comm)
133 pop_sub(create_intranode_communicator)
134 end subroutine create_intranode_communicator
138#include "mpi_lib_inc.F90"
141#include "complex.F90"
142#include "mpi_lib_inc.F90"
145#include "integer.F90"
146#include "mpi_lib_inc.F90"
149#include "integer8.F90"
150#include "mpi_lib_inc.F90"
This module contains some common usage patterns of MPI routines.
subroutine mpi_grp_init(grp, comm)
Initialize MPI group instance.