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