Logo AND Algorithmique Numérique Distribuée

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