source: CPL/oasis3-mct/branches/OASIS3-MCT_2.0_branch/lib/mct/mpi-serial/mpi.h

Last change on this file was 4775, checked in by aclsce, 5 years ago
  • Imported oasis3-mct from Cerfacs svn server (not suppotred anymore).

The version has been extracted from https://oasis3mct.cerfacs.fr/svn/branches/OASIS3-MCT_2.0_branch/oasis3-mct@1818

File size: 10.5 KB
Line 
1
2#ifndef _MPI_H_
3#define _MPI_H_
4
5
6typedef int MPI_Comm;
7typedef int MPI_Request;
8
9
10#define MPI_COMM_WORLD (1)
11#define MPI_COMM_NULL (0)      /* handle 0 maps to NULL */
12
13
14typedef int MPI_Group;
15
16/* MPI_GROUP_EMPTY and MPI_GROUP_NULL must not conflict with MPI_GROUP_ONE */
17#define MPI_GROUP_EMPTY (-1) 
18#define MPI_GROUP_NULL  (0)
19
20
21/*
22 * Return codes
23 *   On error, mpi-serial aborts so the values don't really matter
24 *   as long as they are different than MPI_SUCCESS
25 *
26 */
27
28#define MPI_SUCCESS        (0)
29#define MPI_ERR_BUFFER     (-1)
30#define MPI_ERR_COUNT      (-1)
31#define MPI_ERR_TYPE       (-1)
32#define MPI_ERR_TAG        (-1)
33#define MPI_ERR_COMM       (-1)
34#define MPI_ERR_RANK       (-1)
35#define MPI_ERR_REQUEST    (-1)
36#define MPI_ERR_ROOT       (-1)
37#define MPI_ERR_GROUP      (-1)
38#define MPI_ERR_OP         (-1)
39#define MPI_ERR_TOPOLOGY   (-1)
40#define MPI_ERR_DIMS       (-1)
41#define MPI_ERR_ARG        (-1)
42#define MPI_ERR_UNKNOWN    (-1)
43#define MPI_ERR_TRUNCATE   (-1)
44#define MPI_ERR_OTHER      (-1)
45#define MPI_ERR_INTERN     (-1)
46#define MPI_PENDING        (-1)
47#define MPI_ERR_IN_STATUS  (-1)
48#define MPI_ERR_LASTCODE   (-1)
49
50
51/*
52 * MPI_UNDEFINED
53 *
54 * Uses:
55 *   value for "color" in e.g. comm_split
56 *   value for rank in Group_translate_ranks
57 *
58 */
59
60
61#define MPI_UNDEFINED (-1)
62
63
64/*
65 * Data types etc.
66 */
67
68typedef unsigned long int MPI_Aint;
69#define MPI_BOTTOM (0)
70typedef int MPI_Datatype;
71
72
73/* The type's value is its size in bytes */
74
75#define MPI_DATATYPE_NULL  (0)
76#define MPI_BYTE           (sizeof(char))
77#define MPI_CHAR           (sizeof(char))
78#define MPI_UNSIGNED_CHAR  (sizeof(unsigned char))
79#define MPI_SHORT          (sizeof(short))
80#define MPI_UNSIGNED_SHORT (sizeof(unsigned short))
81#define MPI_INT            (sizeof(int))
82#define MPI_UNSIGNED       (sizeof(unsigned))
83#define MPI_LONG           (sizeof(long))
84#define MPI_UNSIGNED_LONG  (sizeof(unsigned long))
85#define MPI_FLOAT          (sizeof(float))
86#define MPI_DOUBLE         (sizeof(double))
87#define MPI_LONG_DOUBLE    (sizeof(long double))
88#define MPI_PACKED         (sizeof(char))
89
90/* types for MINLOC and MAXLOC */
91
92#define MPI_FLOAT_INT        (sizeof(struct{float a; int b;}))
93#define MPI_DOUBLE_INT       (sizeof(struct{double a; int b;}))
94#define MPI_LONG_INT         (sizeof(struct{long a; int b;}))
95#define MPI_2INT             (sizeof(struct{int a; int b;}))
96#define MPI_SHORT_INT        (sizeof (struct{short a; int b;}))
97#define MPI_LONG_DOUBLE_INT  (sizeof (struct{long double a; int b;}))
98
99/* size-specific types */
100
101#define MPI_INTEGER1       (1)
102#define MPI_INTEGER2       (2)
103#define MPI_INTEGER4       (4)
104#define MPI_INTEGER8       (8)
105#define MPI_INTEGER16      (16)
106
107#define MPI_REAL4          (4)
108#define MPI_REAL8          (8)
109#define MPI_REAL16         (16)
110
111
112
113/*
114 * Fortran int size
115 *
116 */
117
118typedef int MPI_Fint;
119
120
121
122#define MPI_ANY_TAG (-1)
123
124#define MPI_ANY_SOURCE (-1)
125#define MPI_PROC_NULL (-2)
126#define MPI_ROOT (-3)
127
128#define MPI_REQUEST_NULL (0)
129
130#define MPI_MAX_ERROR_STRING (128)
131#define MPI_MAX_PROCESSOR_NAME (128)
132
133
134/*
135 * MPI_Status
136 *
137 * definition must be compatible with the mpif.h values for
138 * MPI_STATUS_SIZE, MPI_SOURCE, MPI_TAG, and MPI_ERROR.
139 *
140 * Note: The type used for MPI_Status_int must be chosen to match
141 * Fortran INTEGER.
142 *
143 */
144
145typedef int MPI_Status_int;
146
147typedef struct                  /* Fortran: INTEGER status(MPI_STATUS_SIZE) */
148{
149  MPI_Status_int MPI_SOURCE;    /* Fortran: status(MPI_SOURCE) */
150  MPI_Status_int MPI_TAG;       /* Fortran: status(MPI_TAG) */
151  MPI_Status_int MPI_ERROR;     /* Fortran: status(MPI_ERROR) */
152
153} MPI_Status;
154
155
156/*
157 * Collective operations
158 */
159
160
161typedef int MPI_Op;
162
163typedef void MPI_User_function( void *invec, void *inoutvec, int *len,
164                                MPI_Datatype *datatype); 
165
166#define MPI_OP_NULL (0)
167
168#define MPI_MAX     (0)
169#define MPI_MIN     (0)
170#define MPI_SUM     (0)
171#define MPI_PROD    (0)
172#define MPI_LAND    (0)
173#define MPI_BAND    (0)
174#define MPI_LOR     (0)
175#define MPI_BOR     (0)
176#define MPI_LXOR    (0)
177#define MPI_BXOR    (0)
178#define MPI_MAXLOC  (0)
179#define MPI_MINLOC  (0)
180
181
182
183/*
184 * These are provided for Fortran...
185 */
186
187
188#define MPI_INTEGER           MPI_INT
189#define MPI_REAL              MPI_FLOAT
190#define MPI_DOUBLE_PRECISION  MPI_DOUBLE
191
192#define MPI_STATUS_SIZE       (sizeof(MPI_Status) / sizeof(int))
193
194
195/**********************************************************
196 *
197 * Note: if you need to regenerate the prototypes below,
198 * you can use 'protify.awk' and paste the output here.
199 *
200 */                                                     
201
202
203extern int MPI_Barrier(MPI_Comm comm );
204extern int MPI_Bcast(void* buffer, int count, MPI_Datatype datatype,
205                     int root, MPI_Comm comm );
206extern int MPI_Gather(void* sendbuf, int sendcount, MPI_Datatype sendtype,
207                      void* recvbuf, int recvcount, MPI_Datatype recvtype,
208                      int root, MPI_Comm comm);
209extern int MPI_Gatherv(void* sendbuf, int sendcount, MPI_Datatype sendtype, 
210                       void* recvbuf, int *recvcounts, int *displs,
211                       MPI_Datatype recvtype, int root, MPI_Comm comm);
212extern int MPI_Allgather(void* sendbuf, int sendcount, MPI_Datatype sendtype,
213                         void* recvbuf, int recvcount, MPI_Datatype recvtype,
214                         MPI_Comm comm);
215extern int MPI_Allgatherv(void* sendbuf, int sendcount, MPI_Datatype sendtype,
216                          void* recvbuf, int *recvcounts, int *displs,
217                          MPI_Datatype recvtype, MPI_Comm comm);
218extern int MPI_Scatter( void* sendbuf, int sendcount, MPI_Datatype sendtype, 
219                        void* recvbuf, int recvcount, MPI_Datatype recvtype,
220                        int root, MPI_Comm comm);
221extern int MPI_Scatterv(void* sendbuf, int *sendcounts, int *displs, 
222                        MPI_Datatype sendtype, void* recvbuf, int recvcount, 
223                        MPI_Datatype recvtype, int root, MPI_Comm comm);
224extern int MPI_Reduce(void* sendbuf, void* recvbuf, int count, 
225                      MPI_Datatype datatype, MPI_Op op, int root, MPI_Comm comm);
226extern int MPI_Allreduce(void* sendbuf, void* recvbuf, int count, 
227                         MPI_Datatype datatype, MPI_Op op, MPI_Comm comm);
228extern int MPI_Scan( void* sendbuf, void* recvbuf, int count, 
229                     MPI_Datatype datatype, MPI_Op op, MPI_Comm comm);
230extern int MPI_Alltoall(void *sendbuf, int sendcount, MPI_Datatype sendtype,
231                        void *recvbuf, int recvcount, MPI_Datatype recvtype,
232                        MPI_Comm comm);
233extern int MPI_Alltoallv(void *sendbuf, int *sendcounts,
234                         int *sdispls, MPI_Datatype sendtype,
235                         void *recvbuf, int *recvcounts,
236                         int *rdispls, MPI_Datatype recvtype,
237                         MPI_Comm comm) ;
238extern int MPI_Op_create(MPI_User_function *function, int commute, 
239                         MPI_Op *op);
240extern MPI_Op MPI_Op_f2c(MPI_Fint op);
241extern MPI_Fint MPI_Op_c2f(MPI_Op op);
242extern MPI_Comm mpi_comm_new(void);
243extern int MPI_Comm_free(MPI_Comm *comm);
244extern int MPI_Comm_size(MPI_Comm comm, int *size);
245extern int MPI_Comm_rank(MPI_Comm comm, int *rank);
246extern int MPI_Comm_dup(MPI_Comm comm, MPI_Comm *newcomm);
247extern int MPI_Comm_create(MPI_Comm comm, MPI_Group group, MPI_Comm *newcomm);
248extern int MPI_Comm_split(MPI_Comm comm, int color, int key, MPI_Comm *newcomm);
249extern int MPI_Comm_group(MPI_Comm comm, MPI_Group *group);
250extern MPI_Comm MPI_Comm_f2c(MPI_Fint comm);
251extern MPI_Fint MPI_Comm_c2f(MPI_Comm comm);
252extern int MPI_Group_incl(MPI_Group group, int n, int *ranks, MPI_Group *newgroup);
253extern int MPI_Group_range_incl(MPI_Group group, int n, int ranges[][3],
254                                MPI_Group *newgroup);
255extern int MPI_Group_union(MPI_Group group1, MPI_Group group2, MPI_Group *newgroup);
256extern int MPI_Group_intersection(MPI_Group group1, MPI_Group group2,
257                                  MPI_Group *newgroup);
258extern int MPI_Group_difference(MPI_Group group1, MPI_Group group2,
259                                MPI_Group *newgroup);
260extern int MPI_Group_free(MPI_Group *group);
261extern int MPI_Group_translate_ranks(MPI_Group group1, int n, int *ranks1,
262                                     MPI_Group group2, int *ranks2);
263extern MPI_Group MPI_Group_f2c(MPI_Fint group);
264extern MPI_Fint MPI_Group_c2f(MPI_Group group);
265
266extern int MPI_Init(int *argc, char **argv[]) ;
267extern int MPI_Finalize(void);
268extern int MPI_Abort(MPI_Comm comm, int errorcode);
269extern int MPI_Error_string(int errorcode, char *string, int *resultlen);
270extern int MPI_Get_processor_name(char *name, int *resultlen);
271extern int MPI_Initialized(int *flag);
272extern int MPI_Pack( void *inbuf, int incount, MPI_Datatype datatype,
273                     void *outbuf, int outsize, int *position, MPI_Comm comm);
274extern int MPI_Unpack( void *inbuf, int insize, int *position,
275                       void *outbuf, int outcount, MPI_Datatype datatype,
276                       MPI_Comm comm );
277extern int MPI_Irecv(void *buf, int count, MPI_Datatype datatype,
278                     int source, int tag, MPI_Comm comm, MPI_Request *request);
279extern int MPI_Recv(void *buf, int count, MPI_Datatype datatype, int source,
280                    int tag, MPI_Comm comm, MPI_Status *status);
281
282extern int MPI_Test(MPI_Request *request, int *flag, MPI_Status *status);
283extern int MPI_Wait(MPI_Request *request, MPI_Status *status);
284extern int MPI_Waitany(int count, MPI_Request *array_of_requests,
285                       int *index, MPI_Status *status);
286extern int MPI_Waitall(int count, MPI_Request *array_of_requests,
287                       MPI_Status *array_of_statuses);
288extern MPI_Request MPI_Request_f2c(MPI_Fint request);
289extern MPI_Fint MPI_Request_c2f(MPI_Request request);
290extern int MPI_Isend(void *buf, int count, MPI_Datatype datatype,
291                     int dest, int tag, MPI_Comm comm, MPI_Request *request) ;
292extern int MPI_Send(void* buf, int count, MPI_Datatype datatype,
293                    int dest, int tag, MPI_Comm comm);
294extern int MPI_Ssend(void* buf, int count, MPI_Datatype datatype,
295                     int dest, int tag, MPI_Comm comm);
296extern int MPI_Rsend(void* buf, int count, MPI_Datatype datatype,
297                     int dest, int tag, MPI_Comm comm);
298extern int MPI_Irsend(void *buf, int count, MPI_Datatype datatype,
299                     int dest, int tag, MPI_Comm comm, MPI_Request *request) ;
300extern int MPI_Sendrecv(void* sendbuf, int sendcount, MPI_Datatype sendtype,
301                        int dest, int sendtag,
302                        void *recvbuf, int recvcount, MPI_Datatype recvtype,
303                        int source, int recvtag,
304                        MPI_Comm comm, MPI_Status *status);
305extern double MPI_Wtime(void);;
306extern double MPI_Wtime(void);
307
308#endif
Note: See TracBrowser for help on using the repository browser.