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)
81 pop_sub(lmpi_translate_rank)
82 end function lmpi_translate_rank
85 subroutine lmpi_destroy_shared_memory_window(window)
86 type(MPI_Win),
intent(inout) :: window
88 push_sub(lmpi_destroy_shared_memory_window)
91 call mpi_win_unlock_all(window)
93 call mpi_win_free(window)
95 pop_sub(lmpi_destroy_shared_memory_window)
96 end subroutine lmpi_destroy_shared_memory_window
99 subroutine lmpi_sync_shared_memory_window(window, intranode_grp)
100 type(MPI_Win),
intent(in) :: window
101 type(mpi_grp_t),
intent(in) :: intranode_grp
103 push_sub(lmpi_sync_shared_memory_window)
105 call mpi_win_sync(window)
106 call intranode_grp%barrier()
108 pop_sub(lmpi_sync_shared_memory_window)
109 end subroutine lmpi_sync_shared_memory_window
111 subroutine create_intranode_communicator(base_grp, intranode_grp, internode_grp)
112 type(mpi_grp_t),
intent(in) :: base_grp
113 type(mpi_grp_t),
intent(out) :: intranode_grp
114 type(mpi_grp_t),
intent(out) :: internode_grp
115 type(MPI_Comm) :: comm
117 push_sub(create_intranode_communicator)
121 call mpi_comm_split_type(base_grp%comm, mpi_comm_type_shared, base_grp%rank, mpi_info_null, comm)
126 call mpi_comm_split(base_grp%comm, intranode_grp%rank, base_grp%rank, comm)
129 pop_sub(create_intranode_communicator)
130 end subroutine create_intranode_communicator
134#include "mpi_lib_inc.F90"
137#include "complex.F90"
138#include "mpi_lib_inc.F90"
141#include "integer.F90"
142#include "mpi_lib_inc.F90"
145#include "integer8.F90"
146#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.