Actual source code: mpi.h
1: /*
2: This is a special set of bindings for uni-processor use of MPI by the PETSc library.
3:
4: NOT ALL THE MPI CALLS ARE IMPLEMENTED CORRECTLY! Only those needed in PETSc.
6: For example,
7: * Does not implement send to self.
8: * Does not implement attributes correctly.
9: */
11: /*
12: The following info is a response to one of the petsc-maint questions
13: regarding MPIUNI.
15: MPIUNI was developed with the aim of getting PETSc compiled, and
16: usable in the absence of MPI. This is the reason each function is
17: not documented. The development strategy was - to make enough
18: changes to it so that PETSc source compiles without errors, and runs
19: in the uni-processor mode.
21: Most PETSc objects have both sequential and parallel
22: implementations, which are separate. For eg: We have two types of
23: sparse matrix storage formats - SeqAIJ, and MPIAIJ. Some MPI
24: routines are used in the Seq part, but most of them are used in the
25: MPI part. The send/receive calls can be found mostly in the MPI
26: part.
28: When MPIUNI is used, only the Seq version of the PETSc objects are
29: used, even though the MPI variant of the objects are compiled. Since
30: there are no send/receive calls in the Seq variant, PETSc works fine
31: with MPIUNI in seq mode.
33: The reason some send/receive functions are defined to abort(), is to
34: detect sections of code that use send/receive functions, and gets
35: executed in the sequential mode. (which shouldn't happen in case of
36: PETSc).
38: One of the goals with MPIUNI, is to avoid the function call overhead
39: of a regular MPI implementation. If this was not the case, we could
40: as well have used a regular implementation of MPI as they are
41: available on almost all machines. Hence most of the functions are
42: implemented as macros. One of the additional benefits we got from
43: MPIUNI is, we were able to use PETSc on machines where using a
44: proper implementation of MPI was painful (for eg NT).
46: Proper implementation of send/receive would involve writing a
47: function for each of them. Inside each of these functions, we have
48: to check if the send is to self or receive is from self, and then
49: doing the buffering accordingly (until the receive is called) - or
50: what if a nonblocking receive is called, do a copy etc.. Handling
51: the buffering aspects might be complicated enough, that in this
52: case, a proper implementation of MPI might as well be used. This is
53: the reason the send to self is not implemented in MPIUNI, and never
54: will be.
55: */
60: /* Requred by abort() in mpi.c & for win64 */
61: #include "petscconf.h"
63: #if defined(__cplusplus)
65: #endif
67: /* require an int variable large enough to hold a pointer */
68: #if !defined(MPIUNI_INTPTR)
69: #define MPIUNI_INTPTR long
70: #endif
72: #define _petsc_mpi_uni
74: /*
76: MPIUNI_TMP is used in the macros below only to stop various C/C++ compilers
77: from generating warning messages about unused variables while compiling PETSc.
78: */
81: #define MPI_COMM_WORLD 1
82: #define MPI_COMM_SELF MPI_COMM_WORLD
83: #define MPI_COMM_NULL 0
84: #define MPI_SUCCESS 0
85: #define MPI_IDENT 0
86: #define MPI_CONGRUENT 0
87: #define MPI_SIMILAR 0
88: #define MPI_UNEQUAL 3
89: #define MPI_ANY_SOURCE (-2)
90: #define MPI_KEYVAL_INVALID 0
91: #define MPI_ERR_UNKNOWN 18
92: #define MPI_ERR_INTERN 21
93: #define MPI_ERR_OTHER 1
94: #define MPI_TAG_UB 0
95: #define MPI_ERRORS_RETURN 0
97: /* External types */
98: typedef int MPI_Comm;
99: typedef void *MPI_Request;
100: typedef void *MPI_Group;
101: typedef struct {int MPI_TAG,MPI_SOURCE,MPI_ERROR;} MPI_Status;
102: typedef char *MPI_Errhandler;
103: typedef int MPI_Fint;
107: /* In order to handle datatypes, we make them into "sizeof(raw-type)";
108: this allows us to do the MPIUNI_Memcpy's easily */
109: #define MPI_Datatype int
110: #define MPI_FLOAT sizeof(float)
111: #define MPI_DOUBLE sizeof(double)
112: #define MPI_CHAR sizeof(char)
113: #define MPI_BYTE sizeof(char)
114: #define MPI_INT sizeof(int)
115: #define MPI_LONG sizeof(long)
116: #define MPI_LONG_LONG_INT sizeof(long long)
117: #define MPI_SHORT sizeof(short)
118: #define MPI_UNSIGNED sizeof(unsigned)
119: #define MPI_UNSIGNED_CHAR sizeof(unsigned char)
120: #define MPI_UNSIGNED_LONG sizeof(unsigned long)
121: #define MPI_COMPLEX 2*sizeof(float)
122: #define MPI_DOUBLE_COMPLEX 2*sizeof(double)
123: #define MPIU_PETSCLOGDOUBLE sizeof(PetscLogDouble)
124: #define MPI_FLOAT_INT (sizeof(float) + sizeof(int))
125: #define MPI_DOUBLE_INT (sizeof(double) + sizeof(int))
126: #define MPI_LONG_INT (sizeof(long) + sizeof(int))
127: #define MPI_SHORT_INT (sizeof(short) + sizeof(int))
128: #define MPI_2INT (2* sizeof(int))
130: #define MPI_REQUEST_NULL ((MPI_Request)0)
131: #define MPI_GROUP_NULL ((MPI_Group)0)
132: typedef int MPI_Op;
134: #define MPI_SUM 0
135: #define MPI_ANY_TAG (-1)
136: #define MPI_DATATYPE_NULL 0
137: /*
138: Prototypes of some functions which are implemented in mpi.c
139: */
140: typedef int (MPI_Copy_function)(MPI_Comm,int,void *,void *,void *,int *);
141: typedef int (MPI_Delete_function)(MPI_Comm,int,void *,void *);
142: typedef void (MPI_User_function)(void*, void *, int *, MPI_Datatype *);
144: /*
145: In order that the PETSc MPIUNI can be used with another package that has its
146: own MPIUni we map the following function names to a unique PETSc name. Those functions
147: are defined in mpi.c
148: */
160: #define MPI_Abort Petsc_MPI_Abort
161: #define MPI_Attr_get Petsc_MPI_Attr_get
162: #define MPI_Keyval_free Petsc_MPI_Keyval_free
163: #define MPI_Attr_put Petsc_MPI_Attr_put
164: #define MPI_Attr_delete Petsc_MPI_Attr_delete
165: #define MPI_Keyval_create Petsc_MPI_Keyval_create
166: #define MPI_Comm_free Petsc_MPI_Comm_free
167: #define MPI_Initialized Petsc_MPI_Initialized
168: #define MPI_Comm_dup Petsc_MPI_Comm_dup
169: #define MPI_Finalize Petsc_MPI_Finalize
171: #define MPI_Aint int
172: /*
173: Routines we have replace with macros that do nothing
174: Some return error codes others return success
175: */
177: #define MPI_Comm_f2c(comm) (MPI_Comm)(comm)
178: #define MPI_Comm_c2f(comm) (MPI_Fint)(comm)
180: #define MPI_Init(argc,argv) \
181: (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (argc),\
182: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (argv),\
183: MPI_SUCCESS)
184: #define MPI_Send(buf,count,datatype,dest,tag,comm) \
185: (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (buf),\
186: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (count),\
187: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (datatype),\
188: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (dest),\
189: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (tag),\
190: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (comm),\
191: MPI_SUCCESS)
192: #define MPI_Recv(buf,count,datatype,source,tag,comm,status) \
193: (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (buf),\
194: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (count),\
195: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (datatype),\
196: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (source),\
197: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (tag),\
198: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (comm),\
199: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (status),\
200: MPI_Abort(MPI_COMM_WORLD,0))
201: #define MPI_Get_count(status, datatype,count) \
202: (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (status),\
203: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (datatype),\
204: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (count),\
205: MPI_Abort(MPI_COMM_WORLD,0))
206: #define MPI_Bsend(buf,count,datatype,dest,tag,comm) \
207: (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (buf),\
208: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (count),\
209: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (datatype),\
210: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (dest),\
211: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (tag),\
212: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (comm),\
213: MPI_SUCCESS)
214: #define MPI_Ssend(buf,count, datatype,dest,tag,comm) \
215: (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (buf),\
216: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (count),\
217: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (datatype),\
218: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (dest),\
219: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (tag),\
220: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (comm),\
221: MPI_SUCCESS)
222: #define MPI_Rsend(buf,count, datatype,dest,tag,comm) \
223: (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (buf),\
224: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (count),\
225: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (datatype),\
226: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (dest),\
227: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (tag),\
228: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (comm),\
229: MPI_SUCCESS)
230: #define MPI_Buffer_attach(buffer,size) \
231: (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (buffer),\
232: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (size),\
233: MPI_SUCCESS)
234: #define MPI_Buffer_detach(buffer,size)\
235: (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (buffer),\
236: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (size),\
237: MPI_SUCCESS)
238: #define MPI_Ibsend(buf,count, datatype,dest,tag,comm,request) \
239: (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (buf),\
240: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (count),\
241: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (datatype),\
242: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (dest),\
243: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (tag),\
244: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (comm),\
245: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (request),\
246: MPI_SUCCESS)
247: #define MPI_Issend(buf,count, datatype,dest,tag,comm,request) \
248: (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (buf),\
249: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (count),\
250: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (datatype),\
251: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (dest),\
252: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (tag),\
253: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (comm),\
254: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (request),\
255: MPI_SUCCESS)
256: #define MPI_Irsend(buf,count, datatype,dest,tag,comm,request) \
257: (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (buf),\
258: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (count),\
259: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (datatype),\
260: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (dest),\
261: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (tag),\
262: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (comm),\
263: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (request),\
264: MPI_SUCCESS)
265: #define MPI_Irecv(buf,count, datatype,source,tag,comm,request) \
266: (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (buf),\
267: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (count),\
268: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (datatype),\
269: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (source),\
270: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (tag),\
271: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (comm),\
272: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (request),\
273: MPI_Abort(MPI_COMM_WORLD,0))
274: #define MPI_Isend(buf,count, datatype,dest,tag,comm,request) \
275: (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (buf),\
276: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (count),\
277: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (datatype),\
278: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (dest),\
279: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (tag),\
280: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (comm),\
281: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (request),\
282: MPI_Abort(MPI_COMM_WORLD,0))
283: #define MPI_Wait(request,status) \
284: (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (request),\
285: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (status),\
286: MPI_SUCCESS)
287: #define MPI_Test(request,flag,status) \
288: (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (request),\
289: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (status),\
290: *(flag) = 0, \
291: MPI_SUCCESS)
292: #define MPI_Request_free(request) \
293: (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (request),\
294: MPI_SUCCESS)
295: #define MPI_Waitany(a,b,c,d) \
296: (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (a),\
297: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (b),\
298: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (c),\
299: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (d),\
300: MPI_SUCCESS)
301: #define MPI_Testany(a,b,c,d,e) \
302: (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (a),\
303: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (b),\
304: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (c),\
305: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (d),\
306: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (e),\
307: MPI_SUCCESS)
308: #define MPI_Waitall(count,array_of_requests,array_of_statuses) \
309: (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (count),\
310: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (array_of_requests),\
311: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (array_of_statuses),\
312: MPI_SUCCESS)
313: #define MPI_Testall(count,array_of_requests,flag,array_of_statuses) \
314: (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (count),\
315: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (array_of_requests),\
316: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (flag),\
317: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (array_of_statuses),\
318: MPI_SUCCESS)
319: #define MPI_Waitsome(incount,array_of_requests,outcount,\
320: array_of_indices,array_of_statuses) \
321: (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (incount),\
322: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (array_of_requests),\
323: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (outcount),\
324: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (array_of_indices),\
325: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (array_of_statuses),\
326: MPI_SUCCESS)
327: #define MPI_Comm_group(comm,group) \
328: (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (comm),\
329: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (group),\
330: MPI_SUCCESS)
331: #define MPI_Group_incl(group,n,ranks,newgroup) \
332: (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (group),\
333: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (n),\
334: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (ranks),\
335: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (newgroup),\
336: MPI_SUCCESS)
337: #define MPI_Testsome(incount,array_of_requests,outcount,\
338: array_of_indices,array_of_statuses) MPI_SUCCESS
339: #define MPI_Iprobe(source,tag,comm,flag,status) (*(flag)=0, MPI_SUCCESS)
340: #define MPI_Probe(source,tag,comm,status) MPI_SUCCESS
341: #define MPI_Cancel(request) (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (request),MPI_SUCCESS)
342: #define MPI_Test_cancelled(status,flag) (*(flag)=0,MPI_SUCCESS)
343: #define MPI_Send_init(buf,count, datatype,dest,tag,comm,request) \
344: (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (buf),\
345: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (count),\
346: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (datatype),\
347: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (dest),\
348: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (tag),\
349: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (comm),\
350: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (request),\
351: MPI_SUCCESS)
352: #define MPI_Bsend_init(buf,count, datatype,dest,tag,comm,request) \
353: (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (buf),\
354: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (count),\
355: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (datatype),\
356: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (dest),\
357: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (tag),\
358: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (comm),\
359: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (request),\
360: MPI_SUCCESS)
361: #define MPI_Ssend_init(buf,count, datatype,dest,tag,comm,request) \
362: (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (buf),\
363: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (count),\
364: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (datatype),\
365: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (dest),\
366: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (tag),\
367: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (comm),\
368: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (request),\
369: MPI_SUCCESS)
370: #define MPI_Bsend_init(buf,count, datatype,dest,tag,comm,request) \
371: (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (buf),\
372: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (count),\
373: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (datatype),\
374: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (dest),\
375: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (tag),\
376: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (comm),\
377: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (request),\
378: MPI_SUCCESS)
379: #define MPI_Rsend_init(buf,count, datatype,dest,tag,comm,request) \
380: (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (buf),\
381: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (count),\
382: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (datatype),\
383: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (dest),\
384: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (tag),\
385: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (comm),\
386: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (request),\
387: MPI_SUCCESS)
388: #define MPI_Recv_init(buf,count, datatype,source,tag,comm,request) \
389: (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (buf),\
390: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (count),\
391: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (datatype),\
392: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (source),\
393: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (tag),\
394: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (comm),\
395: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (request),\
396: MPI_SUCCESS)
397: #define MPI_Start(request) (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (request),MPI_SUCCESS)
398: #define MPI_Startall(count,array_of_requests) \
399: (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (count),\
400: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (array_of_requests),\
401: MPI_SUCCESS)
402: #define MPI_Op_create(function,commute,op) \
403: (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (function),\
404: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (commute),\
405: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (op),\
406: MPI_SUCCESS)
407: #define MPI_Op_free(op) \
408: (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (op),\
409: MPI_SUCCESS)
410: /* Need to determine sizeof "sendtype" */
411: #define MPI_Sendrecv(sendbuf,sendcount, sendtype,\
412: dest,sendtag,recvbuf,recvcount,\
413: recvtype,source,recvtag,\
414: comm,status) \
415: MPIUNI_Memcpy(recvbuf,sendbuf,(sendcount) * (sendtype))
416: #define MPI_Sendrecv_replace(buf,count, datatype,dest,sendtag,\
417: source,recvtag,comm,status) MPI_SUCCESS
418: #define MPI_Type_contiguous(count, oldtype,newtype) \
419: (*(newtype) = (count)*(oldtype),MPI_SUCCESS)
420: #define MPI_Type_vector(count,blocklength,stride,oldtype, newtype) MPI_SUCCESS
421: #define MPI_Type_hvector(count,blocklength,stride,oldtype, newtype) MPI_SUCCESS
422: #define MPI_Type_indexed(count,array_of_blocklengths,\
423: array_of_displacements, oldtype,\
424: newtype) MPI_SUCCESS
425: #define MPI_Type_hindexed(count,array_of_blocklengths,\
426: array_of_displacements, oldtype,\
427: newtype) MPI_SUCCESS
428: #define MPI_Type_struct(count,array_of_blocklengths,\
429: array_of_displacements,\
430: array_of_types, newtype) MPI_SUCCESS
431: #define MPI_Address(location,address) \
432: (*(address) = (MPIUNI_INTPTR)(char *)(location),MPI_SUCCESS)
433: #define MPI_Type_extent(datatype,extent) \
434: MPI_Abort(MPI_COMM_WORLD,0)
435: #define MPI_Type_size(datatype,size) \
436: MPI_Abort(MPI_COMM_WORLD,0)
437: #define MPI_Type_lb(datatype,displacement) \
438: MPI_Abort(MPI_COMM_WORLD,0)
439: #define MPI_Type_ub(datatype,displacement) \
440: MPI_Abort(MPI_COMM_WORLD,0)
441: #define MPI_Type_commit(datatype) (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (datatype),\
442: MPI_SUCCESS)
443: #define MPI_Type_free(datatype) MPI_SUCCESS
444: #define MPI_Get_elements(status, datatype,count) \
445: MPI_Abort(MPI_COMM_WORLD,0)
446: #define MPI_Pack(inbuf,incount, datatype,outbuf,\
447: outsize,position, comm) \
448: MPI_Abort(MPI_COMM_WORLD,0)
449: #define MPI_Unpack(inbuf,insize,position,outbuf,\
450: outcount, datatype,comm) \
451: MPI_Abort(MPI_COMM_WORLD,0)
452: #define MPI_Pack_size(incount, datatype,comm,size) \
453: MPI_Abort(MPI_COMM_WORLD,0)
454: #define MPI_Barrier(comm) \
455: (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (comm),\
456: MPI_SUCCESS)
457: #define MPI_Bcast(buffer,count,datatype,root,comm) \
458: (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (buffer),\
459: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (count),\
460: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (datatype),\
461: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (comm),\
462: MPI_SUCCESS)
463: #define MPI_Gather(sendbuf,sendcount, sendtype,\
464: recvbuf,recvcount, recvtype,\
465: root,comm) \
466: (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (recvcount),\
467: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (root),\
468: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (recvtype),\
469: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (comm),\
470: MPIUNI_Memcpy(recvbuf,sendbuf,(sendcount)* (sendtype)),\
471: MPI_SUCCESS)
472: #define MPI_Gatherv(sendbuf,sendcount, sendtype,\
473: recvbuf,recvcounts,displs,\
474: recvtype,root,comm) \
475: (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (recvcounts),\
476: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (displs),\
477: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (recvtype),\
478: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (root),\
479: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (comm),\
480: MPIUNI_Memcpy(recvbuf,sendbuf,(sendcount)* (sendtype)),\
481: MPI_SUCCESS)
482: #define MPI_Scatter(sendbuf,sendcount, sendtype,\
483: recvbuf,recvcount, recvtype,\
484: root,comm) \
485: (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (sendbuf),\
486: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (sendcount),\
487: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (sendtype),\
488: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (recvbuf),\
489: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (recvcount),\
490: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (recvtype),\
491: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (root),\
492: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (comm),MPI_Abort(MPI_COMM_WORLD,0))
493: #define MPI_Scatterv(sendbuf,sendcounts,displs,\
494: sendtype, recvbuf,recvcount,\
495: recvtype,root,comm) \
496: (MPIUNI_Memcpy(recvbuf,sendbuf,(recvcount)*(recvtype)),\
497: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (displs),\
498: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (sendtype),\
499: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (sendcounts),\
500: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (root),\
501: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (comm),\
502: MPI_SUCCESS)
503: #define MPI_Allgather(sendbuf,sendcount, sendtype,\
504: recvbuf,recvcount, recvtype,comm) \
505: (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (recvcount),\
506: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (recvtype),\
507: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (comm),\
508: MPIUNI_Memcpy(recvbuf,sendbuf,(sendcount)* (sendtype)),\
509: MPI_SUCCESS)
510: #define MPI_Allgatherv(sendbuf,sendcount, sendtype,\
511: recvbuf,recvcounts,displs,recvtype,comm) \
512: (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (recvcounts),\
513: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (displs),\
514: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (recvtype),\
515: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (comm),\
516: MPIUNI_Memcpy(recvbuf,sendbuf,(sendcount)* (sendtype)),\
517: MPI_SUCCESS)
518: #define MPI_Alltoall(sendbuf,sendcount, sendtype,\
519: recvbuf,recvcount, recvtype,comm) \
520: (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (recvcount),\
521: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (recvtype),\
522: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (comm),\
523: MPIUNI_Memcpy(recvbuf,sendbuf,(sendcount)* (sendtype)),\
524: MPI_SUCCESS)
525: #define MPI_Alltoallv(sendbuf,sendcounts,sdispls,\
526: sendtype, recvbuf,recvcounts,\
527: rdispls, recvtype,comm) MPI_Abort(MPI_COMM_WORLD,0)
528: #define MPI_Reduce(sendbuf, recvbuf,count,\
529: datatype,op,root,comm) \
530: (MPIUNI_Memcpy(recvbuf,sendbuf,(count)*(datatype)),\
531: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (comm),MPI_SUCCESS)
532: #define MPI_Allreduce(sendbuf, recvbuf,count,datatype,op,comm) \
533: (MPIUNI_Memcpy(recvbuf,sendbuf,(count)*(datatype)),\
534: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (comm),MPI_SUCCESS)
535: #define MPI_Scan(sendbuf, recvbuf,count,datatype,op,comm) \
536: (MPIUNI_Memcpy(recvbuf,sendbuf,(count)*(datatype)),\
537: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (comm),MPI_SUCCESS)
538: #define MPI_Reduce_scatter(sendbuf, recvbuf,recvcounts,\
539: datatype,op,comm) \
540: MPI_Abort(MPI_COMM_WORLD,0)
541: #define MPI_Group_size(group,size) (*(size)=1,MPI_SUCCESS)
542: #define MPI_Group_rank(group,rank) (*(rank)=0,MPI_SUCCESS)
543: #define MPI_Group_translate_ranks (group1,n,ranks1,\
544: group2,ranks2) MPI_Abort(MPI_COMM_WORLD,0)
545: #define MPI_Group_compare(group1,group2,result) \
546: (*(result)=1,MPI_SUCCESS)
547: #define MPI_Group_union(group1,group2,newgroup) MPI_SUCCESS
548: #define MPI_Group_intersection(group1,group2,newgroup) MPI_SUCCESS
549: #define MPI_Group_difference(group1,group2,newgroup) MPI_SUCCESS
550: #define MPI_Group_excl(group,n,ranks,newgroup) MPI_SUCCESS
551: #define MPI_Group_range_incl(group,n,ranges,newgroup) MPI_SUCCESS
552: #define MPI_Group_range_excl(group,n,ranges,newgroup) MPI_SUCCESS
553: #define MPI_Group_free(group) \
554: (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (group),\
555: MPI_SUCCESS)
556: #define MPI_Comm_size(comm,size) \
557: (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (comm),\
558: *(size)=1,\
559: MPI_SUCCESS)
560: #define MPI_Comm_rank(comm,rank) \
561: (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (comm),\
562: *(rank)=0,\
563: MPI_SUCCESS)
564: #define MPI_Comm_compare(comm1,comm2,result) \
565: (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (comm1),\
566: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (comm2),\
567: *(result)=MPI_IDENT,\
568: MPI_SUCCESS)
569: #define MPI_Comm_create(comm,group,newcomm) \
570: (*(newcomm) = (comm),\
571: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (group),\
572: MPI_SUCCESS)
573: #define MPI_Comm_split(comm,color,key,newcomm) MPI_SUCCESS
574: #define MPI_Comm_test_inter(comm,flag) (*(flag)=1,MPI_SUCCESS)
575: #define MPI_Comm_remote_size(comm,size) (*(size)=1,MPI_SUCCESS)
576: #define MPI_Comm_remote_group(comm,group) MPI_SUCCESS
577: #define MPI_Intercomm_create(local_comm,local_leader,peer_comm,\
578: remote_leader,tag,newintercomm) MPI_SUCCESS
579: #define MPI_Intercomm_merge(intercomm,high,newintracomm) MPI_SUCCESS
581: #define MPI_Topo_test(comm,status) MPI_SUCCESS
582: #define MPI_Cart_create(comm_old,ndims,dims,periods,\
583: reorder,comm_cart) MPI_SUCCESS
584: #define MPI_Dims_create(nnodes,ndims,dims) MPI_Abort(MPI_COMM_WORLD,0)
585: #define MPI_Graph_create(comm,a,b,c,d,e) MPI_SUCCESS
586: #define MPI_Graphdims_Get(comm,nnodes,nedges) MPI_Abort(MPI_COMM_WORLD,0)
587: #define MPI_Graph_get(comm,a,b,c,d) MPI_Abort(MPI_COMM_WORLD,0)
588: #define MPI_Cartdim_get(comm,ndims) MPI_Abort(MPI_COMM_WORLD,0)
589: #define MPI_Cart_get(comm,maxdims,dims,periods,coords) \
590: MPI_Abort(MPI_COMM_WORLD,0)
591: #define MPI_Cart_rank(comm,coords,rank) MPI_Abort(MPI_COMM_WORLD,0)
592: #define MPI_Cart_coords(comm,rank,maxdims,coords) \
593: MPI_Abort(MPI_COMM_WORLD,0)
594: #define MPI_Graph_neighbors_count(comm,rank,nneighbors) \
595: MPI_Abort(MPI_COMM_WORLD,0)
596: #define MPI_Graph_neighbors(comm,rank,maxneighbors,neighbors) \
597: MPI_Abort(MPI_COMM_WORLD,0)
598: #define MPI_Cart_shift(comm,direction,disp,rank_source,rank_dest) \
599: MPI_Abort(MPI_COMM_WORLD,0)
600: #define MPI_Cart_sub(comm,remain_dims,newcomm) MPI_Abort(MPI_COMM_WORLD,0)
601: #define MPI_Cart_map(comm,ndims,dims,periods,newrank) MPI_Abort(MPI_COMM_WORLD,0)
602: #define MPI_Graph_map(comm,a,b,c,d) MPI_Abort(MPI_COMM_WORLD,0)
603: #define MPI_Get_processor_name(name,result_len) \
604: (MPIUNI_Memcpy(name,"localhost",9*sizeof(char)),name[10] = 0,*(result_len) = 10)
605: #define MPI_Errhandler_create(function,errhandler) \
606: (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (errhandler),\
607: MPI_SUCCESS)
608: #define MPI_Errhandler_set(comm,errhandler) \
609: (MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (comm),\
610: MPIUNI_TMP = (void*)(MPIUNI_INTPTR) (errhandler),\
611: MPI_SUCCESS)
612: #define MPI_Errhandler_get(comm,errhandler) MPI_SUCCESS
613: #define MPI_Errhandler_free(errhandler) MPI_SUCCESS
614: #define MPI_Error_string(errorcode,string,result_len) MPI_SUCCESS
615: #define MPI_Error_class(errorcode,errorclass) MPI_SUCCESS
616: #define MPI_Wtick() 1.0
617: #define MPI_Wtime() 0.0
618: #define MPI_Pcontrol(level) MPI_SUCCESS
620: #define MPI_NULL_COPY_FN 0
621: #define MPI_NULL_DELETE_FN 0
623: #if defined(__cplusplus)
624: }
625: #endif
626: #endif