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_DOUBLE_PRECISION = mpi_datatype(0)
75 type(MPI_Datatype), parameter :: MPI_DOUBLE_COMPLEX = mpi_datatype(0)
76 type(MPI_Datatype), parameter :: MPI_2DOUBLE_PRECISION = mpi_datatype(0)
77 type(MPI_Datatype), parameter :: MPI_CHARACTER = mpi_datatype(0)
78 type(MPI_Datatype), parameter :: MPI_LOGICAL = mpi_datatype(0)
79
80 type(MPI_Op), parameter :: MPI_SUM = mpi_op(0)
81 type(MPI_Op), parameter :: MPI_MINLOC = mpi_op(0)
82 type(MPI_Op), parameter :: MPI_MAXLOC = mpi_op(0)
83 type(MPI_Op), parameter :: MPI_LOR = mpi_op(0)
84 type(MPI_Op), parameter :: MPI_LAND = mpi_op(0)
85 type(MPI_Op), parameter :: MPI_MAX = mpi_op(0)
86 type(MPI_Op), parameter :: MPI_MIN = mpi_op(0)
87 type(MPI_Op), parameter :: MPI_IN_PLACE = mpi_op(0)
88
89 interface operator (.EQ.)
90 module procedure oct_mpi_comm_op_eq
91 module procedure oct_mpi_datatype_op_eq
92 module procedure oct_mpi_errhandler_op_eq
93 module procedure oct_mpi_file_op_eq
94 module procedure oct_mpi_group_op_eq
95 module procedure oct_mpi_info_op_eq
96 module procedure oct_mpi_message_op_eq
97 module procedure oct_mpi_op_op_eq
98 module procedure oct_mpi_request_op_eq
99 module procedure oct_mpi_win_op_eq
100 end interface operator (.EQ.)
101
102 interface operator (.NE.)
103 module procedure oct_mpi_comm_op_ne
104 module procedure oct_mpi_datatype_op_ne
105 module procedure oct_mpi_errhandler_op_ne
106 module procedure oct_mpi_file_op_ne
107 module procedure oct_mpi_group_op_ne
108 module procedure oct_mpi_info_op_ne
109 module procedure oct_mpi_message_op_ne
110 module procedure oct_mpi_op_op_ne
111 module procedure oct_mpi_request_op_ne
112 module procedure oct_mpi_win_op_ne
113 end interface operator (.NE.)
114
115contains
116
117 ! .EQ. operator
118 !-----------------
119 logical function oct_mpi_comm_op_eq(a, b)
120 type(MPI_Comm), intent(in) :: a, b
121 oct_mpi_comm_op_eq = (a%MPI_VAL .EQ. b%MPI_VAL)
122 end function oct_mpi_comm_op_eq
123
124 logical function oct_mpi_datatype_op_eq(a, b)
125 type(MPI_Datatype), intent(in) :: a, b
126 oct_mpi_datatype_op_eq = (a%MPI_VAL .EQ. b%MPI_VAL)
127 end function oct_mpi_datatype_op_eq
128
129 logical function oct_mpi_errhandler_op_eq(a, b)
130 type(MPI_Errhandler), intent(in) :: a, b
131 oct_mpi_errhandler_op_eq = (a%MPI_VAL .EQ. b%MPI_VAL)
132 end function oct_mpi_errhandler_op_eq
133
134 logical function oct_mpi_file_op_eq(a, b)
135 type(MPI_File), intent(in) :: a, b
136 oct_mpi_file_op_eq = (a%MPI_VAL .EQ. b%MPI_VAL)
137 end function oct_mpi_file_op_eq
138
139 logical function oct_mpi_group_op_eq(a, b)
140 type(MPI_Group), intent(in) :: a, b
141 oct_mpi_group_op_eq = (a%MPI_VAL .EQ. b%MPI_VAL)
142 end function oct_mpi_group_op_eq
143
144 logical function oct_mpi_info_op_eq(a, b)
145 type(MPI_Info), intent(in) :: a, b
146 oct_mpi_info_op_eq = (a%MPI_VAL .EQ. b%MPI_VAL)
147 end function oct_mpi_info_op_eq
148
149 logical function oct_mpi_message_op_eq(a, b)
150 type(MPI_Message), intent(in) :: a, b
151 oct_mpi_message_op_eq = (a%MPI_VAL .EQ. b%MPI_VAL)
152 end function oct_mpi_message_op_eq
153
154 logical function oct_mpi_op_op_eq(a, b)
155 type(MPI_Op), intent(in) :: a, b
156 oct_mpi_op_op_eq = (a%MPI_VAL .EQ. b%MPI_VAL)
157 end function oct_mpi_op_op_eq
158
159 logical function oct_mpi_request_op_eq(a, b)
160 type(MPI_Request), intent(in) :: a, b
161 oct_mpi_request_op_eq = (a%MPI_VAL .EQ. b%MPI_VAL)
162 end function oct_mpi_request_op_eq
163
164 logical function oct_mpi_win_op_eq(a, b)
165 type(MPI_Win), intent(in) :: a, b
166 oct_mpi_win_op_eq = (a%MPI_VAL .EQ. b%MPI_VAL)
167 end function oct_mpi_win_op_eq
168
169 ! .NE. operator
170 !-----------------
171 logical function oct_mpi_comm_op_ne(a, b)
172 type(MPI_Comm), intent(in) :: a, b
173 oct_mpi_comm_op_ne = (a%MPI_VAL .NE. b%MPI_VAL)
174 end function oct_mpi_comm_op_ne
175
176 logical function oct_mpi_datatype_op_ne(a, b)
177 type(MPI_Datatype), intent(in) :: a, b
178 oct_mpi_datatype_op_ne = (a%MPI_VAL .NE. b%MPI_VAL)
179 end function oct_mpi_datatype_op_ne
180
181 logical function oct_mpi_errhandler_op_ne(a, b)
182 type(MPI_Errhandler), intent(in) :: a, b
183 oct_mpi_errhandler_op_ne = (a%MPI_VAL .NE. b%MPI_VAL)
184 end function oct_mpi_errhandler_op_ne
185
186 logical function oct_mpi_file_op_ne(a, b)
187 type(MPI_File), intent(in) :: a, b
188 oct_mpi_file_op_ne = (a%MPI_VAL .NE. b%MPI_VAL)
189 end function oct_mpi_file_op_ne
190
191 logical function oct_mpi_group_op_ne(a, b)
192 type(MPI_Group), intent(in) :: a, b
193 oct_mpi_group_op_ne = (a%MPI_VAL .NE. b%MPI_VAL)
194 end function oct_mpi_group_op_ne
195
196 logical function oct_mpi_info_op_ne(a, b)
197 type(MPI_Info), intent(in) :: a, b
198 oct_mpi_info_op_ne = (a%MPI_VAL .NE. b%MPI_VAL)
199 end function oct_mpi_info_op_ne
200
201 logical function oct_mpi_message_op_ne(a, b)
202 type(MPI_Message), intent(in) :: a, b
203 oct_mpi_message_op_ne = (a%MPI_VAL .NE. b%MPI_VAL)
204 end function oct_mpi_message_op_ne
205
206 logical function oct_mpi_op_op_ne(a, b)
207 type(MPI_Op), intent(in) :: a, b
208 oct_mpi_op_op_ne = (a%MPI_VAL .NE. b%MPI_VAL)
209 end function oct_mpi_op_op_ne
210
211 logical function oct_mpi_request_op_ne(a, b)
212 type(MPI_Request), intent(in) :: a, b
213 oct_mpi_request_op_ne = (a%MPI_VAL .NE. b%MPI_VAL)
214 end function oct_mpi_request_op_ne
215
216 logical function oct_mpi_win_op_ne(a, b)
217 type(MPI_Win), intent(in) :: a, b
218 oct_mpi_win_op_ne = (a%MPI_VAL .NE. b%MPI_VAL)
219 end function oct_mpi_win_op_ne
220
221#endif
222
223end module