Octopus
mpi_serial_stub.F90
Go to the documentation of this file.
1! Stubs for MPI datatypes when compiling without MPI
2! Adapted from https://github.com/open-mpi/ompi/blob/v3.0.0/ompi/mpi/fortran/use-mpi-f08/mod/mpi-f08-types.F90
3
4#include "global.h"
5
7 implicit none
8
9#ifndef HAVE_MPI
10
11 type, bind(c) :: MPI_Status
12 integer :: MPI_SOURCE
13 integer :: MPI_TAG
14 integer :: MPI_ERROR
15 end type mpi_status
16
17 type, bind(c) :: MPI_Comm
18 integer :: MPI_VAL
19 end type mpi_comm
20
21 type, bind(c) :: MPI_Datatype
22 integer :: MPI_VAL
23 end type mpi_datatype
24
25 type, bind(c) :: MPI_Errhandler
26 integer :: MPI_VAL
27 end type mpi_errhandler
28
29 type, bind(c) :: MPI_File
30 integer :: MPI_VAL
31 end type mpi_file
32
33 type, bind(c) :: MPI_Group
34 integer :: MPI_VAL
35 end type mpi_group
36
37 type, bind(c) :: MPI_Info
38 integer :: MPI_VAL
39 end type mpi_info
40
41 type, bind(c) :: MPI_Message
42 integer :: MPI_VAL
43 end type mpi_message
44
45 type, bind(c) :: MPI_Op
46 integer :: MPI_VAL
47 end type mpi_op
48
49 type, bind(c) :: MPI_Request
50 integer :: MPI_VAL
51 end type mpi_request
52
53 type, bind(c) :: MPI_Session
54 integer :: MPI_VAL
55 end type mpi_session
56
57 type, bind(c) :: MPI_Win
58 integer :: MPI_VAL
59 end type mpi_win
60
61 type(MPI_Comm), parameter :: MPI_COMM_NULL = mpi_comm(0)
62 type(MPI_Datatype), parameter :: MPI_DATATYPE_NULL = mpi_datatype(0)
63 type(MPI_Errhandler), parameter :: MPI_ERRHANDLER_NULL = mpi_errhandler(0)
64 type(MPI_File), parameter :: MPI_FILE_NULL = mpi_file(0)
65 type(MPI_Group), parameter :: MPI_GROUP_NULL = mpi_group(0)
66 type(MPI_Info), parameter :: MPI_INFO_NULL = mpi_info(0)
67 type(MPI_Message), parameter :: MPI_MESSAGE_NULL = mpi_message(0)
68 type(MPI_Op), parameter :: MPI_OP_NULL = mpi_op(0)
69 type(MPI_Request), parameter :: MPI_REQUEST_NULL = mpi_request(0)
70 type(MPI_Win), parameter :: MPI_WIN_NULL = mpi_win(0)
71
72 type(MPI_Datatype), parameter :: MPI_INTEGER = mpi_datatype(0)
73 type(MPI_Datatype), parameter :: MPI_INTEGER8 = mpi_datatype(0)
74 type(MPI_Datatype), parameter :: MPI_REAL = mpi_datatype(0)
75 type(MPI_Datatype), parameter :: MPI_COMPLEX = mpi_datatype(0)
76 type(MPI_Datatype), parameter :: MPI_DOUBLE_PRECISION = mpi_datatype(0)
77 type(MPI_Datatype), parameter :: MPI_DOUBLE_COMPLEX = mpi_datatype(0)
78 type(MPI_Datatype), parameter :: MPI_2DOUBLE_PRECISION = mpi_datatype(0)
79 type(MPI_Datatype), parameter :: MPI_CHARACTER = mpi_datatype(0)
80 type(MPI_Datatype), parameter :: MPI_LOGICAL = mpi_datatype(0)
81
82 type(MPI_Op), parameter :: MPI_SUM = mpi_op(0)
83 type(MPI_Op), parameter :: MPI_MINLOC = mpi_op(0)
84 type(MPI_Op), parameter :: MPI_MAXLOC = mpi_op(0)
85 type(MPI_Op), parameter :: MPI_LOR = mpi_op(0)
86 type(MPI_Op), parameter :: MPI_LAND = mpi_op(0)
87 type(MPI_Op), parameter :: MPI_MAX = mpi_op(0)
88 type(MPI_Op), parameter :: MPI_MIN = mpi_op(0)
89 type(MPI_Op), parameter :: MPI_IN_PLACE = mpi_op(0)
90
91 interface operator (.EQ.)
92 module procedure oct_mpi_comm_op_eq
93 module procedure oct_mpi_datatype_op_eq
94 module procedure oct_mpi_errhandler_op_eq
95 module procedure oct_mpi_file_op_eq
96 module procedure oct_mpi_group_op_eq
97 module procedure oct_mpi_info_op_eq
98 module procedure oct_mpi_message_op_eq
99 module procedure oct_mpi_op_op_eq
100 module procedure oct_mpi_request_op_eq
101 module procedure oct_mpi_win_op_eq
102 end interface operator (.EQ.)
103
104 interface operator (.NE.)
105 module procedure oct_mpi_comm_op_ne
106 module procedure oct_mpi_datatype_op_ne
108 module procedure oct_mpi_file_op_ne
109 module procedure oct_mpi_group_op_ne
110 module procedure oct_mpi_info_op_ne
111 module procedure oct_mpi_message_op_ne
112 module procedure oct_mpi_op_op_ne
113 module procedure oct_mpi_request_op_ne
114 module procedure oct_mpi_win_op_ne
115 end interface operator (.NE.)
117contains
118
119 ! .EQ. operator
120 !-----------------
121 logical function oct_mpi_comm_op_eq(a, b)
122 type(mpi_comm), intent(in) :: a, b
123 oct_mpi_comm_op_eq = (a%MPI_VAL .EQ. b%MPI_VAL)
126 logical function oct_mpi_datatype_op_eq(a, b)
127 type(mpi_datatype), intent(in) :: a, b
128 oct_mpi_datatype_op_eq = (a%MPI_VAL .EQ. b%MPI_VAL)
130
131 logical function oct_mpi_errhandler_op_eq(a, b)
132 type(MPI_Errhandler), intent(in) :: a, b
133 oct_mpi_errhandler_op_eq = (a%MPI_VAL .EQ. b%MPI_VAL)
134 end function oct_mpi_errhandler_op_eq
135
136 logical function oct_mpi_file_op_eq(a, b)
137 type(mpi_file), intent(in) :: a, b
138 oct_mpi_file_op_eq = (a%MPI_VAL .EQ. b%MPI_VAL)
139 end function oct_mpi_file_op_eq
141 logical function oct_mpi_group_op_eq(a, b)
142 type(mpi_group), intent(in) :: a, b
143 oct_mpi_group_op_eq = (a%MPI_VAL .EQ. b%MPI_VAL)
146 logical function oct_mpi_info_op_eq(a, b)
147 type(mpi_info), intent(in) :: a, b
148 oct_mpi_info_op_eq = (a%MPI_VAL .EQ. b%MPI_VAL)
150
151 logical function oct_mpi_message_op_eq(a, b)
152 type(MPI_Message), intent(in) :: a, b
153 oct_mpi_message_op_eq = (a%MPI_VAL .EQ. b%MPI_VAL)
154 end function oct_mpi_message_op_eq
155
156 logical function oct_mpi_op_op_eq(a, b)
157 type(mpi_op), intent(in) :: a, b
158 oct_mpi_op_op_eq = (a%MPI_VAL .EQ. b%MPI_VAL)
159 end function oct_mpi_op_op_eq
161 logical function oct_mpi_request_op_eq(a, b)
162 type(mpi_request), intent(in) :: a, b
163 oct_mpi_request_op_eq = (a%MPI_VAL .EQ. b%MPI_VAL)
166 logical function oct_mpi_win_op_eq(a, b)
167 type(mpi_win), intent(in) :: a, b
168 oct_mpi_win_op_eq = (a%MPI_VAL .EQ. b%MPI_VAL)
169 end function oct_mpi_win_op_eq
171 ! .NE. operator
172 !-----------------
173 logical function oct_mpi_comm_op_ne(a, b)
174 type(mpi_comm), intent(in) :: a, b
175 oct_mpi_comm_op_ne = (a%MPI_VAL .NE. b%MPI_VAL)
176 end function oct_mpi_comm_op_ne
178 logical function oct_mpi_datatype_op_ne(a, b)
179 type(mpi_datatype), intent(in) :: a, b
180 oct_mpi_datatype_op_ne = (a%MPI_VAL .NE. b%MPI_VAL)
183 logical function oct_mpi_errhandler_op_ne(a, b)
184 type(mpi_errhandler), intent(in) :: a, b
185 oct_mpi_errhandler_op_ne = (a%MPI_VAL .NE. b%MPI_VAL)
187
188 logical function oct_mpi_file_op_ne(a, b)
189 type(MPI_File), intent(in) :: a, b
190 oct_mpi_file_op_ne = (a%MPI_VAL .NE. b%MPI_VAL)
191 end function oct_mpi_file_op_ne
192
193 logical function oct_mpi_group_op_ne(a, b)
194 type(MPI_Group), intent(in) :: a, b
195 oct_mpi_group_op_ne = (a%MPI_VAL .NE. b%MPI_VAL)
196 end function oct_mpi_group_op_ne
197
198 logical function oct_mpi_info_op_ne(a, b)
199 type(MPI_Info), intent(in) :: a, b
200 oct_mpi_info_op_ne = (a%MPI_VAL .NE. b%MPI_VAL)
201 end function oct_mpi_info_op_ne
202
203 logical function oct_mpi_message_op_ne(a, b)
204 type(MPI_Message), intent(in) :: a, b
205 oct_mpi_message_op_ne = (a%MPI_VAL .NE. b%MPI_VAL)
206 end function oct_mpi_message_op_ne
207
208 logical function oct_mpi_op_op_ne(a, b)
209 type(MPI_Op), intent(in) :: a, b
210 oct_mpi_op_op_ne = (a%MPI_VAL .NE. b%MPI_VAL)
211 end function oct_mpi_op_op_ne
212
213 logical function oct_mpi_request_op_ne(a, b)
214 type(MPI_Request), intent(in) :: a, b
215 oct_mpi_request_op_ne = (a%MPI_VAL .NE. b%MPI_VAL)
217
218 logical function oct_mpi_win_op_ne(a, b)
219 type(mpi_win), intent(in) :: a, b
220 oct_mpi_win_op_ne = (a%MPI_VAL .NE. b%MPI_VAL)
221 end function oct_mpi_win_op_ne
222
223#endif
224
225end module
logical function oct_mpi_datatype_op_eq(a, b)
logical function oct_mpi_request_op_eq(a, b)
logical function oct_mpi_op_op_eq(a, b)
logical function oct_mpi_group_op_eq(a, b)
logical function oct_mpi_comm_op_ne(a, b)
logical function oct_mpi_datatype_op_ne(a, b)
logical function oct_mpi_info_op_eq(a, b)
logical function oct_mpi_comm_op_eq(a, b)
logical function oct_mpi_file_op_ne(a, b)
logical function oct_mpi_info_op_ne(a, b)
logical function oct_mpi_op_op_ne(a, b)
logical function oct_mpi_errhandler_op_ne(a, b)
logical function oct_mpi_request_op_ne(a, b)
logical function oct_mpi_file_op_eq(a, b)
logical function oct_mpi_errhandler_op_eq(a, b)
logical function oct_mpi_message_op_ne(a, b)
logical function oct_mpi_win_op_ne(a, b)
logical function oct_mpi_group_op_ne(a, b)
logical function oct_mpi_win_op_eq(a, b)
logical function oct_mpi_message_op_eq(a, b)