Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
change some defined values to less current ones
[simgrid.git] / include / smpi / smpi.h
1 /* Copyright (c) 2007, 2008, 2009, 2010. The SimGrid Team.
2  * All rights reserved.                                                     */
3
4 /* This program is free software; you can redistribute it and/or modify it
5  * under the terms of the license (GNU LGPL) which comes with this package. */
6
7 #ifndef SMPI_H
8 #define SMPI_H
9
10 #include <stddef.h>
11 #include <sys/time.h>
12 #include <xbt/misc.h>
13 #include <xbt/function_types.h>
14
15
16 #ifdef _WIN32
17 #define MPI_CALL(type,name,args) \
18   type name args; \
19   type P##name args
20 #else
21 #define MPI_CALL(type,name,args) \
22   type name args __attribute__((weak)); \
23   type P##name args
24 #endif
25
26 SG_BEGIN_DECL()
27 #define MPI_THREAD_SINGLE     0
28 #define MPI_THREAD_FUNNELED   1
29 #define MPI_THREAD_SERIALIZED 2
30 #define MPI_THREAD_MULTIPLE   3
31 //FIXME: check values
32 #define MPI_MAX_PROCESSOR_NAME 100
33 #define MPI_MAX_NAME_STRING    100
34 #define MPI_MAX_ERROR_STRING   100
35 #define MPI_MAX_DATAREP_STRIN  100
36 #define MPI_MAX_INFO_KEY       100
37 #define MPI_MAX_INFO_VAL       100
38 #define MPI_MAX_OBJECT_NAME    100
39 #define MPI_MAX_PORT_NAME      100
40 #define SMPI_RAND_SEED 5
41 #define MPI_ANY_SOURCE -555
42 #define MPI_BOTTOM (void *)0
43 #define MPI_PROC_NULL -666
44 #define MPI_ANY_TAG -444
45 #define MPI_UNDEFINED -333
46 #define MPI_IN_PLACE (void *)-222
47 // errorcodes
48 #define MPI_SUCCESS       0
49 #define MPI_ERR_COMM      1
50 #define MPI_ERR_ARG       2
51 #define MPI_ERR_TYPE      3
52 #define MPI_ERR_REQUEST   4
53 #define MPI_ERR_INTERN    5
54 #define MPI_ERR_COUNT     6
55 #define MPI_ERR_RANK      7
56 #define MPI_ERR_TAG       8
57 #define MPI_ERR_TRUNCATE  9
58 #define MPI_ERR_GROUP    10
59 #define MPI_ERR_OP       11
60 #define MPI_ERR_OTHER    12
61 #define MPI_ERR_IN_STATUS 13
62 #define MPI_ERR_PENDING   14
63 #define MPI_IDENT     0
64 #define MPI_SIMILAR   1
65 #define MPI_UNEQUAL   2
66 #define MPI_CONGRUENT 3
67 #define MPI_WTIME_IS_GLOBAL 1
68 #define MPI_TAG_UB           1000000
69 #define MPI_HOST             0
70 #define MPI_IO               0
71 #define MPI_BSEND_OVERHEAD   0
72
73 typedef enum MPIR_Topo_type {
74   MPI_GRAPH=1,
75   MPI_CART=2,
76   MPI_DIST_GRAPH=3
77 } MPIR_Topo_type;
78
79 typedef ptrdiff_t MPI_Aint;
80 typedef long long MPI_Offset;
81
82 struct s_smpi_mpi_datatype;
83 typedef struct s_smpi_mpi_datatype *MPI_Datatype;
84
85 typedef struct {
86   int MPI_SOURCE;
87   int MPI_TAG;
88   int MPI_ERROR;
89   int count;
90 } MPI_Status;
91
92 #define MPI_STATUS_IGNORE NULL
93 #define MPI_STATUSES_IGNORE NULL
94
95 #define MPI_DATATYPE_NULL NULL
96 XBT_PUBLIC_DATA( MPI_Datatype ) MPI_CHAR;
97 XBT_PUBLIC_DATA( MPI_Datatype ) MPI_SHORT;
98 XBT_PUBLIC_DATA( MPI_Datatype ) MPI_INT;
99 XBT_PUBLIC_DATA( MPI_Datatype ) MPI_LONG;
100 XBT_PUBLIC_DATA( MPI_Datatype ) MPI_LONG_LONG;
101 #define MPI_LONG_LONG_INT MPI_LONG_LONG
102 XBT_PUBLIC_DATA( MPI_Datatype ) MPI_SIGNED_CHAR;
103 XBT_PUBLIC_DATA( MPI_Datatype ) MPI_UNSIGNED_CHAR;
104 XBT_PUBLIC_DATA( MPI_Datatype ) MPI_UNSIGNED_SHORT;
105 XBT_PUBLIC_DATA( MPI_Datatype ) MPI_UNSIGNED;
106 XBT_PUBLIC_DATA( MPI_Datatype ) MPI_UNSIGNED_LONG;
107 XBT_PUBLIC_DATA( MPI_Datatype ) MPI_UNSIGNED_LONG_LONG;
108 XBT_PUBLIC_DATA( MPI_Datatype ) MPI_FLOAT;
109 XBT_PUBLIC_DATA( MPI_Datatype ) MPI_DOUBLE;
110 XBT_PUBLIC_DATA( MPI_Datatype ) MPI_LONG_DOUBLE;
111 XBT_PUBLIC_DATA( MPI_Datatype ) MPI_WCHAR;
112 XBT_PUBLIC_DATA( MPI_Datatype ) MPI_C_BOOL;
113 XBT_PUBLIC_DATA( MPI_Datatype ) MPI_INT8_T;
114 XBT_PUBLIC_DATA( MPI_Datatype ) MPI_INT16_T;
115 XBT_PUBLIC_DATA( MPI_Datatype ) MPI_INT32_T;
116 XBT_PUBLIC_DATA( MPI_Datatype ) MPI_INT64_T;
117 XBT_PUBLIC_DATA( MPI_Datatype ) MPI_UINT8_T;
118 #define MPI_BYTE MPI_UINT8_T
119 XBT_PUBLIC_DATA( MPI_Datatype ) MPI_UINT16_T;
120 XBT_PUBLIC_DATA( MPI_Datatype ) MPI_UINT32_T;
121 XBT_PUBLIC_DATA( MPI_Datatype ) MPI_UINT64_T;
122 XBT_PUBLIC_DATA( MPI_Datatype ) MPI_C_FLOAT_COMPLEX;
123 #define MPI_C_COMPLEX MPI_C_FLOAT_COMPLEX
124 XBT_PUBLIC_DATA( MPI_Datatype ) MPI_C_DOUBLE_COMPLEX;
125 XBT_PUBLIC_DATA( MPI_Datatype ) MPI_C_LONG_DOUBLE_COMPLEX;
126 XBT_PUBLIC_DATA( MPI_Datatype ) MPI_AINT;
127 XBT_PUBLIC_DATA( MPI_Datatype ) MPI_OFFSET;
128 XBT_PUBLIC_DATA( MPI_Datatype ) MPI_LB;
129 XBT_PUBLIC_DATA( MPI_Datatype ) MPI_UB;
130 //The following are datatypes for the MPI functions MPI_MAXLOC  and MPI_MINLOC.
131 XBT_PUBLIC_DATA(MPI_Datatype) MPI_FLOAT_INT;
132 XBT_PUBLIC_DATA(MPI_Datatype) MPI_LONG_INT;
133 XBT_PUBLIC_DATA(MPI_Datatype) MPI_DOUBLE_INT;
134 XBT_PUBLIC_DATA(MPI_Datatype) MPI_SHORT_INT;
135 XBT_PUBLIC_DATA(MPI_Datatype) MPI_2INT;
136 XBT_PUBLIC_DATA(MPI_Datatype) MPI_LONG_DOUBLE_INT;
137 XBT_PUBLIC_DATA(MPI_Datatype) MPI_2FLOAT;
138 XBT_PUBLIC_DATA(MPI_Datatype) MPI_2DOUBLE;
139
140 typedef void MPI_User_function(void *invec, void *inoutvec, int *len,
141                                MPI_Datatype * datatype);
142 struct s_smpi_mpi_op;
143 typedef struct s_smpi_mpi_op *MPI_Op;
144
145 #define MPI_OP_NULL NULL
146 XBT_PUBLIC_DATA( MPI_Op ) MPI_MAX;
147 XBT_PUBLIC_DATA( MPI_Op ) MPI_MIN;
148 XBT_PUBLIC_DATA( MPI_Op ) MPI_MAXLOC;
149 XBT_PUBLIC_DATA( MPI_Op ) MPI_MINLOC;
150 XBT_PUBLIC_DATA( MPI_Op ) MPI_SUM;
151 XBT_PUBLIC_DATA( MPI_Op ) MPI_PROD;
152 XBT_PUBLIC_DATA( MPI_Op ) MPI_LAND;
153 XBT_PUBLIC_DATA( MPI_Op ) MPI_LOR;
154 XBT_PUBLIC_DATA( MPI_Op ) MPI_LXOR;
155 XBT_PUBLIC_DATA( MPI_Op ) MPI_BAND;
156 XBT_PUBLIC_DATA( MPI_Op ) MPI_BOR;
157 XBT_PUBLIC_DATA( MPI_Op ) MPI_BXOR;
158
159 struct s_smpi_mpi_group;
160 typedef struct s_smpi_mpi_group *MPI_Group;
161
162 #define MPI_GROUP_NULL NULL
163
164 XBT_PUBLIC_DATA( MPI_Group ) MPI_GROUP_EMPTY;
165
166 struct s_smpi_mpi_communicator;
167 typedef struct s_smpi_mpi_communicator *MPI_Comm;
168
169 #define MPI_COMM_NULL NULL
170 XBT_PUBLIC_DATA( MPI_Comm ) MPI_COMM_WORLD;
171 #define MPI_COMM_SELF smpi_process_comm_self()
172
173 struct s_smpi_mpi_request;
174 typedef struct s_smpi_mpi_request *MPI_Request;
175
176 #define MPI_REQUEST_NULL NULL
177
178 MPI_CALL(XBT_PUBLIC(int), MPI_Init, (int *argc, char ***argv));
179 MPI_CALL(XBT_PUBLIC(int), MPI_Finalize, (void));
180 MPI_CALL(XBT_PUBLIC(int), MPI_Init_thread,
181                             (int *argc, char ***argv, int required,
182                              int *provided));
183 MPI_CALL(XBT_PUBLIC(int), MPI_Query_thread, (int *provided));
184 MPI_CALL(XBT_PUBLIC(int), MPI_Is_thread_main, (int *flag));
185 MPI_CALL(XBT_PUBLIC(int), MPI_Abort, (MPI_Comm comm, int errorcode));
186 MPI_CALL(XBT_PUBLIC(double), MPI_Wtime, (void));
187 MPI_CALL(XBT_PUBLIC(double), MPI_Wtick,(void));
188 MPI_CALL(XBT_PUBLIC(int), MPI_Address, (void *location, MPI_Aint * address));
189
190 MPI_CALL(XBT_PUBLIC(int), MPI_Type_free, (MPI_Datatype * datatype));
191 MPI_CALL(XBT_PUBLIC(int), MPI_Type_size, (MPI_Datatype datatype, int *size));
192 MPI_CALL(XBT_PUBLIC(int), MPI_Type_get_extent,
193                             (MPI_Datatype datatype, MPI_Aint * lb,
194                              MPI_Aint * extent));
195 MPI_CALL(XBT_PUBLIC(int), MPI_Type_extent, (MPI_Datatype datatype, MPI_Aint * extent));
196 MPI_CALL(XBT_PUBLIC(int), MPI_Type_lb, (MPI_Datatype datatype, MPI_Aint * disp));
197 MPI_CALL(XBT_PUBLIC(int), MPI_Type_ub, (MPI_Datatype datatype, MPI_Aint * disp));
198 MPI_CALL(XBT_PUBLIC(int), MPI_Type_commit, (MPI_Datatype* datatype));
199 MPI_CALL(XBT_PUBLIC(int), MPI_Type_hindexed,
200                             (int count, int* blocklens, MPI_Aint* indices,
201                             MPI_Datatype old_type, MPI_Datatype* newtype));
202 MPI_CALL(XBT_PUBLIC(int), MPI_Type_hvector,
203                             (int count, int blocklen, MPI_Aint stride,
204                              MPI_Datatype old_type, MPI_Datatype* newtype));
205 MPI_CALL(XBT_PUBLIC(int), MPI_Type_indexed,
206                             (int count, int* blocklens, int* indices,
207                              MPI_Datatype old_type, MPI_Datatype* newtype));
208 MPI_CALL(XBT_PUBLIC(int), MPI_Type_struct,
209                             (int count, int* blocklens, MPI_Aint* indices,
210                              MPI_Datatype* old_types, MPI_Datatype* newtype));
211 MPI_CALL(XBT_PUBLIC(int), MPI_Type_vector,
212                             (int count, int blocklen, int stride,
213                              MPI_Datatype old_type, MPI_Datatype* newtype));
214 MPI_CALL(XBT_PUBLIC(int), MPI_Type_contiguous,
215                             (int count, MPI_Datatype old_type,
216                              MPI_Datatype* newtype));
217 MPI_CALL(XBT_PUBLIC(int), MPI_Testall,
218                             (int count, MPI_Request* requests, int* flag,
219                              MPI_Status* statuses));
220 MPI_CALL(XBT_PUBLIC(int), MPI_Op_create,
221                             (MPI_User_function * function, int commute,
222                              MPI_Op * op));
223 MPI_CALL(XBT_PUBLIC(int), MPI_Op_free, (MPI_Op * op));
224
225 MPI_CALL(XBT_PUBLIC(int), MPI_Group_free, (MPI_Group * group));
226 MPI_CALL(XBT_PUBLIC(int), MPI_Group_size, (MPI_Group group, int *size));
227 MPI_CALL(XBT_PUBLIC(int), MPI_Group_rank, (MPI_Group group, int *rank));
228 MPI_CALL(XBT_PUBLIC(int), MPI_Group_translate_ranks,
229                             (MPI_Group group1, int n,
230                              int *ranks1, MPI_Group group2,
231                              int *ranks2));
232 MPI_CALL(XBT_PUBLIC(int), MPI_Group_compare,
233                             (MPI_Group group1, MPI_Group group2,
234                              int *result));
235 MPI_CALL(XBT_PUBLIC(int), MPI_Group_union,
236                             (MPI_Group group1, MPI_Group group2,
237                              MPI_Group * newgroup));
238 MPI_CALL(XBT_PUBLIC(int), MPI_Group_intersection,
239                             (MPI_Group group1, MPI_Group group2,
240                              MPI_Group * newgroup));
241 MPI_CALL(XBT_PUBLIC(int), MPI_Group_difference,
242                             (MPI_Group group1, MPI_Group group2,
243                              MPI_Group * newgroup));
244 MPI_CALL(XBT_PUBLIC(int), MPI_Group_incl,
245                             (MPI_Group group, int n, int *ranks,
246                              MPI_Group * newgroup));
247 MPI_CALL(XBT_PUBLIC(int), MPI_Group_excl,
248                             (MPI_Group group, int n, int *ranks,
249                              MPI_Group * newgroup));
250 MPI_CALL(XBT_PUBLIC(int), MPI_Group_range_incl,
251                             (MPI_Group group, int n, int ranges[][3],
252                              MPI_Group * newgroup));
253 MPI_CALL(XBT_PUBLIC(int), MPI_Group_range_excl,
254                             (MPI_Group group, int n, int ranges[][3],
255                              MPI_Group * newgroup));
256
257 MPI_CALL(XBT_PUBLIC(int), MPI_Comm_rank, (MPI_Comm comm, int *rank));
258 MPI_CALL(XBT_PUBLIC(int), MPI_Comm_size, (MPI_Comm comm, int *size));
259 MPI_CALL(XBT_PUBLIC(int), MPI_Comm_get_name, (MPI_Comm comm, char* name, int* len));
260 MPI_CALL(XBT_PUBLIC(int), MPI_Get_processor_name, (char *name, int *resultlen));
261 MPI_CALL(XBT_PUBLIC(int), MPI_Get_count,
262                             (MPI_Status * status, MPI_Datatype datatype,
263                              int *count));
264
265 MPI_CALL(XBT_PUBLIC(int), MPI_Comm_group, (MPI_Comm comm, MPI_Group * group));
266 MPI_CALL(XBT_PUBLIC(int), MPI_Comm_compare,
267                             (MPI_Comm comm1, MPI_Comm comm2, int *result));
268 MPI_CALL(XBT_PUBLIC(int), MPI_Comm_dup, (MPI_Comm comm, MPI_Comm * newcomm));
269 MPI_CALL(XBT_PUBLIC(int), MPI_Comm_create,
270                             (MPI_Comm comm, MPI_Group group, MPI_Comm * newcomm));
271 MPI_CALL(XBT_PUBLIC(int), MPI_Comm_free, (MPI_Comm * comm));
272 MPI_CALL(XBT_PUBLIC(int), MPI_Comm_disconnect, (MPI_Comm * comm));
273 MPI_CALL(XBT_PUBLIC(int), MPI_Comm_split, (MPI_Comm comm, int color, int key, MPI_Comm* comm_out));
274
275 MPI_CALL(XBT_PUBLIC(int), MPI_Send_init,
276                             (void *buf, int count, MPI_Datatype datatype,
277                              int dst, int tag, MPI_Comm comm,
278                              MPI_Request * request));
279 MPI_CALL(XBT_PUBLIC(int), MPI_Recv_init,
280                             (void *buf, int count, MPI_Datatype datatype,
281                              int src, int tag, MPI_Comm comm,
282                              MPI_Request * request));
283 MPI_CALL(XBT_PUBLIC(int), MPI_Start, (MPI_Request * request));
284 MPI_CALL(XBT_PUBLIC(int), MPI_Startall, (int count, MPI_Request * requests));
285 MPI_CALL(XBT_PUBLIC(int), MPI_Request_free, (MPI_Request * request));
286 MPI_CALL(XBT_PUBLIC(int), MPI_Irecv,
287                             (void *buf, int count, MPI_Datatype datatype,
288                              int src, int tag, MPI_Comm comm,
289                              MPI_Request * request));
290 MPI_CALL(XBT_PUBLIC(int), MPI_Isend,
291                             (void *buf, int count, MPI_Datatype datatype,
292                              int dst, int tag, MPI_Comm comm,
293                              MPI_Request * request));
294 MPI_CALL(XBT_PUBLIC(int), MPI_Recv,
295                             (void *buf, int count, MPI_Datatype datatype,
296                              int src, int tag, MPI_Comm comm,
297                              MPI_Status * status));
298 MPI_CALL(XBT_PUBLIC(int), MPI_Send,
299                             (void *buf, int count, MPI_Datatype datatype,
300                              int dst, int tag, MPI_Comm comm));
301 MPI_CALL(XBT_PUBLIC(int), MPI_Sendrecv,
302                             (void *sendbuf, int sendcount,
303                              MPI_Datatype sendtype, int dst, int sendtag,
304                              void *recvbuf, int recvcount,
305                              MPI_Datatype recvtype, int src, int recvtag,
306                              MPI_Comm comm, MPI_Status * status));
307 MPI_CALL(XBT_PUBLIC(int), MPI_Sendrecv_replace,
308                             (void *buf, int count,
309                              MPI_Datatype datatype, int dst,
310                              int sendtag, int src, int recvtag,
311                              MPI_Comm comm, MPI_Status * status));
312
313 MPI_CALL(XBT_PUBLIC(int), MPI_Test,
314                             (MPI_Request * request, int *flag, MPI_Status* status));
315 MPI_CALL(XBT_PUBLIC(int), MPI_Testany,
316                             (int count, MPI_Request requests[], int *index,
317                              int *flag, MPI_Status * status));
318 MPI_CALL(XBT_PUBLIC(int), MPI_Wait, (MPI_Request * request, MPI_Status * status));
319 MPI_CALL(XBT_PUBLIC(int), MPI_Waitany,
320                             (int count, MPI_Request requests[], int *index,
321                              MPI_Status * status));
322 MPI_CALL(XBT_PUBLIC(int), MPI_Waitall,
323                             (int count, MPI_Request requests[],
324                              MPI_Status status[]));
325 MPI_CALL(XBT_PUBLIC(int), MPI_Waitsome,
326                             (int incount, MPI_Request requests[],
327                              int *outcount, int *indices,
328                              MPI_Status status[]));
329 MPI_CALL(XBT_PUBLIC(int), MPI_Testsome,
330                             (int incount, MPI_Request requests[],
331                              int *outcount, int *indices,
332                              MPI_Status status[]));
333 MPI_CALL(XBT_PUBLIC(int), MPI_Bcast,
334                             (void *buf, int count, MPI_Datatype datatype,
335                              int root, MPI_Comm comm));
336 MPI_CALL(XBT_PUBLIC(int), MPI_Barrier, (MPI_Comm comm));
337 MPI_CALL(XBT_PUBLIC(int), MPI_Gather,
338                             (void *sendbuf, int sendcount,
339                              MPI_Datatype sendtype, void *recvbuf,
340                              int recvcount, MPI_Datatype recvtype, int root,
341                              MPI_Comm comm));
342 MPI_CALL(XBT_PUBLIC(int), MPI_Gatherv,
343                             (void *sendbuf, int sendcount,
344                              MPI_Datatype sendtype, void *recvbuf,
345                              int *recvcounts, int *displs,
346                              MPI_Datatype recvtype, int root,
347                              MPI_Comm comm));
348 MPI_CALL(XBT_PUBLIC(int), MPI_Allgather,
349                             (void *sendbuf, int sendcount,
350                              MPI_Datatype sendtype, void *recvbuf,
351                              int recvcount, MPI_Datatype recvtype,
352                              MPI_Comm comm));
353 MPI_CALL(XBT_PUBLIC(int), MPI_Allgatherv,
354                             (void *sendbuf, int sendcount,
355                              MPI_Datatype sendtype, void *recvbuf,
356                              int *recvcounts, int *displs,
357                              MPI_Datatype recvtype, MPI_Comm comm));
358 MPI_CALL(XBT_PUBLIC(int), MPI_Scatter,
359                             (void *sendbuf, int sendcount,
360                              MPI_Datatype sendtype, void *recvbuf,
361                              int recvcount, MPI_Datatype recvtype, int root,
362                              MPI_Comm comm));
363 MPI_CALL(XBT_PUBLIC(int), MPI_Scatterv,
364                             (void *sendbuf, int *sendcounts, int *displs,
365                              MPI_Datatype sendtype, void *recvbuf,
366                              int recvcount, MPI_Datatype recvtype,
367                              int root, MPI_Comm comm));
368 MPI_CALL(XBT_PUBLIC(int), MPI_Reduce,
369                             (void *sendbuf, void *recvbuf, int count,
370                              MPI_Datatype datatype, MPI_Op op, int root,
371                              MPI_Comm comm));
372 MPI_CALL(XBT_PUBLIC(int), MPI_Allreduce,
373                             (void *sendbuf, void *recvbuf, int count,
374                              MPI_Datatype datatype, MPI_Op op,
375                              MPI_Comm comm));
376 MPI_CALL(XBT_PUBLIC(int), MPI_Scan,
377                             (void *sendbuf, void *recvbuf, int count,
378                              MPI_Datatype datatype, MPI_Op op, MPI_Comm comm));
379 MPI_CALL(XBT_PUBLIC(int), MPI_Reduce_scatter,
380                             (void *sendbuf, void *recvbuf,
381                              int *recvcounts, MPI_Datatype datatype,
382                              MPI_Op op, MPI_Comm comm));
383 MPI_CALL(XBT_PUBLIC(int), MPI_Alltoall,
384                             (void *sendbuf, int sendcount,
385                              MPI_Datatype sendtype, void *recvbuf,
386                              int recvcount, MPI_Datatype recvtype,
387                              MPI_Comm comm));
388 MPI_CALL(XBT_PUBLIC(int), MPI_Alltoallv,
389                             (void *sendbuf, int *sendcounts,
390                              int *senddisps, MPI_Datatype sendtype,
391                              void *recvbuf, int *recvcounts,
392                              int *recvdisps, MPI_Datatype recvtype,
393                              MPI_Comm comm));
394 MPI_CALL(XBT_PUBLIC(int), MPI_Iprobe,
395                             (int source, int tag, MPI_Comm comm,
396                              int* flag, MPI_Status* status));
397 MPI_CALL(XBT_PUBLIC(int), MPI_Probe,
398                             (int source, int tag, MPI_Comm comm,
399                              MPI_Status* status));
400
401
402 //FIXME: these are not yet implemented
403
404 typedef void MPI_Handler_function(MPI_Comm*, int*, ...);
405 typedef int MPI_Win;
406 typedef int MPI_Info;
407 typedef void* MPI_Errhandler;
408 typedef int MPI_Copy_function(MPI_Comm oldcomm, int keyval, void* extra_state, void* attribute_val_in,
409                               void* attribute_val_out, int* flag);
410 typedef int MPI_Delete_function(MPI_Comm comm, int keyval, void* attribute_val, void* extra_state);
411
412 XBT_PUBLIC_DATA(MPI_Datatype)  MPI_PACKED;
413 XBT_PUBLIC_DATA(MPI_Errhandler*)  MPI_ERRORS_RETURN;
414 XBT_PUBLIC_DATA(MPI_Errhandler*)  MPI_ERRORS_ARE_FATAL;
415 XBT_PUBLIC_DATA(MPI_Errhandler*)  MPI_ERRHANDLER_NULL;
416
417
418 MPI_CALL(XBT_PUBLIC(int), MPI_Pack_size, (int incount, MPI_Datatype datatype, MPI_Comm comm, int* size));
419 MPI_CALL(XBT_PUBLIC(int), MPI_Cart_coords, (MPI_Comm comm, int rank, int maxdims, int* coords));
420 MPI_CALL(XBT_PUBLIC(int), MPI_Cart_create, (MPI_Comm comm_old, int ndims, int* dims, int* periods, int reorder, MPI_Comm* comm_cart));
421 MPI_CALL(XBT_PUBLIC(int), MPI_Cart_get, (MPI_Comm comm, int maxdims, int* dims, int* periods, int* coords));
422 MPI_CALL(XBT_PUBLIC(int), MPI_Cart_map, (MPI_Comm comm_old, int ndims, int* dims, int* periods, int* newrank));
423 MPI_CALL(XBT_PUBLIC(int), MPI_Cart_rank, (MPI_Comm comm, int* coords, int* rank));
424 MPI_CALL(XBT_PUBLIC(int), MPI_Cart_shift, (MPI_Comm comm, int direction, int displ, int* source, int* dest));
425 MPI_CALL(XBT_PUBLIC(int), MPI_Cart_sub, (MPI_Comm comm, int* remain_dims, MPI_Comm* comm_new));
426 MPI_CALL(XBT_PUBLIC(int), MPI_Cartdim_get, (MPI_Comm comm, int* ndims));
427 MPI_CALL(XBT_PUBLIC(int), MPI_Graph_create, (MPI_Comm comm_old, int nnodes, int* index, int* edges, int reorder, MPI_Comm* comm_graph));
428 MPI_CALL(XBT_PUBLIC(int), MPI_Graph_get, (MPI_Comm comm, int maxindex, int maxedges, int* index, int* edges));
429 MPI_CALL(XBT_PUBLIC(int), MPI_Graph_map, (MPI_Comm comm_old, int nnodes, int* index, int* edges, int* newrank));
430 MPI_CALL(XBT_PUBLIC(int), MPI_Graph_neighbors, (MPI_Comm comm, int rank, int maxneighbors, int* neighbors));
431 MPI_CALL(XBT_PUBLIC(int), MPI_Graph_neighbors_count, (MPI_Comm comm, int rank, int* nneighbors));
432 MPI_CALL(XBT_PUBLIC(int), MPI_Graphdims_get, (MPI_Comm comm, int* nnodes, int* nedges));
433 MPI_CALL(XBT_PUBLIC(int), MPI_Topo_test, (MPI_Comm comm, int* top_type));
434 MPI_CALL(XBT_PUBLIC(int), MPI_Error_class, (int errorcode, int* errorclass));
435 MPI_CALL(XBT_PUBLIC(int), MPI_Errhandler_create, (MPI_Handler_function* function, MPI_Errhandler* errhandler));
436 MPI_CALL(XBT_PUBLIC(int), MPI_Errhandler_free, (MPI_Errhandler* errhandler));
437 MPI_CALL(XBT_PUBLIC(int), MPI_Errhandler_get, (MPI_Comm comm, MPI_Errhandler* errhandler));
438 MPI_CALL(XBT_PUBLIC(int), MPI_Error_string, (int errorcode, char* string, int* resultlen));
439 MPI_CALL(XBT_PUBLIC(int), MPI_Errhandler_set, (MPI_Comm comm, MPI_Errhandler errhandler));
440 MPI_CALL(XBT_PUBLIC(int), MPI_Cancel, (MPI_Request* request));
441 MPI_CALL(XBT_PUBLIC(int), MPI_Buffer_attach, (void* buffer, int size));
442 MPI_CALL(XBT_PUBLIC(int), MPI_Buffer_detach, (void* buffer, int* size));
443 MPI_CALL(XBT_PUBLIC(int), MPI_Comm_test_inter, (MPI_Comm comm, int* flag));
444 MPI_CALL(XBT_PUBLIC(int), MPI_Comm_get_attr, (MPI_Comm comm, int comm_keyval, void *attribute_val, int *flag));
445 MPI_CALL(XBT_PUBLIC(int), MPI_Unpack, (void* inbuf, int insize, int* position, void* outbuf, int outcount, MPI_Datatype type, MPI_Comm comm));
446 MPI_CALL(XBT_PUBLIC(int), MPI_Ssend, (void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm));
447 MPI_CALL(XBT_PUBLIC(int), MPI_Ssend_init, (void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request* request));
448 MPI_CALL(XBT_PUBLIC(int), MPI_Intercomm_create, (MPI_Comm local_comm, int local_leader, MPI_Comm peer_comm, int remote_leader, int tag, MPI_Comm* comm_out));
449 MPI_CALL(XBT_PUBLIC(int), MPI_Intercomm_merge, (MPI_Comm comm, int high, MPI_Comm* comm_out));
450 MPI_CALL(XBT_PUBLIC(int), MPI_Bsend, (void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm));
451 MPI_CALL(XBT_PUBLIC(int), MPI_Bsend_init, (void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request* request));
452 MPI_CALL(XBT_PUBLIC(int), MPI_Ibsend, (void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request* request));
453 MPI_CALL(XBT_PUBLIC(int), MPI_Comm_remote_group, (MPI_Comm comm, MPI_Group* group));
454 MPI_CALL(XBT_PUBLIC(int), MPI_Comm_remote_size, (MPI_Comm comm, int* size));
455 MPI_CALL(XBT_PUBLIC(int), MPI_Issend, (void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request* request));
456 MPI_CALL(XBT_PUBLIC(int), MPI_Attr_delete, (MPI_Comm comm, int keyval));
457 MPI_CALL(XBT_PUBLIC(int), MPI_Attr_get, (MPI_Comm comm, int keyval, void* attr_value, int* flag));
458 MPI_CALL(XBT_PUBLIC(int), MPI_Attr_put, (MPI_Comm comm, int keyval, void* attr_value));
459 MPI_CALL(XBT_PUBLIC(int), MPI_Rsend, (void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm));
460 MPI_CALL(XBT_PUBLIC(int), MPI_Rsend_init, (void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request* request));
461 MPI_CALL(XBT_PUBLIC(int), MPI_Irsend, (void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request* request));
462 MPI_CALL(XBT_PUBLIC(int), MPI_Keyval_create, (MPI_Copy_function* copy_fn, MPI_Delete_function* delete_fn, int* keyval, void* extra_state));
463 MPI_CALL(XBT_PUBLIC(int), MPI_Keyval_free, (int* keyval));
464 MPI_CALL(XBT_PUBLIC(int), MPI_Test_cancelled, (MPI_Status* status, int* flag));
465 MPI_CALL(XBT_PUBLIC(int), MPI_Pack, (void* inbuf, int incount, MPI_Datatype type, void* outbuf, int outcount, int* position, MPI_Comm comm));
466 MPI_CALL(XBT_PUBLIC(int), MPI_Get_elements, (MPI_Status* status, MPI_Datatype datatype, int* elements));
467 MPI_CALL(XBT_PUBLIC(int), MPI_Dims_create, (int nnodes, int ndims, int* dims));
468 MPI_CALL(XBT_PUBLIC(int), MPI_Initialized, (int* flag));
469 MPI_CALL(XBT_PUBLIC(int), MPI_Pcontrol, (const int level ));
470 MPI_CALL(XBT_PUBLIC(int), MPI_Win_fence,( int assert,  MPI_Win win));
471 MPI_CALL(XBT_PUBLIC(int), MPI_Win_free,( MPI_Win* win));
472 MPI_CALL(XBT_PUBLIC(int), MPI_Win_create,( void *base, MPI_Aint size, int disp_unit, MPI_Info info, MPI_Comm comm, MPI_Win *win));
473 MPI_CALL(XBT_PUBLIC(int), MPI_Info_create,( MPI_Info *info));
474 MPI_CALL(XBT_PUBLIC(int), MPI_Info_set,( MPI_Info *info, char *key, char *value));
475 MPI_CALL(XBT_PUBLIC(int), MPI_Info_free,( MPI_Info *info));
476 MPI_CALL(XBT_PUBLIC(int), MPI_Get,( void *origin_addr, int origin_count, MPI_Datatype origin_datatype, int target_rank,
477     MPI_Aint target_disp, int target_count, MPI_Datatype target_datatype, MPI_Win win));
478
479 //FIXME: End of all the not yet implemented stuff
480
481 // smpi functions
482 XBT_PUBLIC(MPI_Comm) smpi_process_comm_self(void);
483 /*
484 XBT_PUBLIC(void) smpi_exit(int);
485 */
486
487 XBT_PUBLIC(unsigned int) smpi_sleep(unsigned int secs);
488 XBT_PUBLIC(int) smpi_gettimeofday(struct timeval *tv);
489 XBT_PUBLIC(unsigned long long) smpi_rastro_resolution (void);
490 XBT_PUBLIC(unsigned long long) smpi_rastro_timestamp (void);
491 XBT_PUBLIC(void) smpi_sample_1(int global, const char *file, int line,
492                               int iters, double threshold);
493 XBT_PUBLIC(int) smpi_sample_2(int global, const char *file, int line);
494 XBT_PUBLIC(void) smpi_sample_3(int global, const char *file, int line);
495
496 #define SMPI_SAMPLE_LOCAL(iters,thres) for(smpi_sample_1(0, __FILE__, __LINE__, iters, thres); \
497                                            smpi_sample_2(0, __FILE__, __LINE__);      \
498                                            smpi_sample_3(0, __FILE__, __LINE__))
499
500 #define SMPI_SAMPLE_GLOBAL(iters,thres) for(smpi_sample_1(1, __FILE__, __LINE__, iters, thres); \
501                                             smpi_sample_2(1, __FILE__, __LINE__);      \
502                                             smpi_sample_3(1, __FILE__, __LINE__))
503
504 #define SMPI_SAMPLE_DELAY(duration) for(smpi_execute(duration); 0; )
505 #define SMPI_SAMPLE_FLOPS(flops) for(smpi_execute_flops(flops); 0; )
506
507 XBT_PUBLIC(void *) smpi_shared_malloc(size_t size, const char *file,
508                                       int line);
509 #define SMPI_SHARED_MALLOC(size) smpi_shared_malloc(size, __FILE__, __LINE__)
510
511 XBT_PUBLIC(void) smpi_shared_free(void *data);
512 #define SMPI_SHARED_FREE(data) smpi_shared_free(data)
513
514 XBT_PUBLIC(int) smpi_shared_known_call(const char* func, const char* input);
515 XBT_PUBLIC(void*) smpi_shared_get_call(const char* func, const char* input);
516 XBT_PUBLIC(void*) smpi_shared_set_call(const char* func, const char* input, void* data);
517 #define SMPI_SHARED_CALL(func, input, ...) \
518    (smpi_shared_known_call(#func, input) ? smpi_shared_get_call(#func, input) \
519                                          : smpi_shared_set_call(#func, input, func(__VA_ARGS__)))
520
521 /* Fortran specific stuff */
522 XBT_PUBLIC(int) __attribute__((weak)) smpi_simulated_main_(int argc, char** argv);
523 XBT_PUBLIC(int) __attribute__((weak)) MAIN__(void);
524 XBT_PUBLIC(int) smpi_main(int (*realmain) (int argc, char *argv[]),int argc, char *argv[]);
525 XBT_PUBLIC(void) __attribute__((weak)) user_main_(void);
526
527 XBT_PUBLIC(int) smpi_process_index(void);
528
529 /* Trace replay specific stuff */
530 XBT_PUBLIC(void) smpi_replay_init(int *argc, char***argv);
531 XBT_PUBLIC(void) smpi_action_trace_run(char *);
532 XBT_PUBLIC(int) smpi_replay_finalize(void);
533
534 SG_END_DECL()
535 #endif