Logo AND Algorithmique Numérique Distribuée

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