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