xref: /petsc/src/sys/mpiuni/mpi.c (revision 1147fc2a6bf7922defbbca15fc6c33f234803ff0)
1 /*
2       This provides a few of the MPI-uni functions that cannot be implemented
3     with C macros
4 */
5 #include <mpiuni/mpi.h>
6 #if !defined(__MPIUNI_H)
7 #error "Wrong mpi.h included! require mpi.h from MPIUNI"
8 #endif
9 #if !defined(PETSC_STDCALL)
10 #define PETSC_STDCALL
11 #endif
12 #include <stdio.h>
13 #if defined(PETSC_HAVE_STDLIB_H)
14 #include <stdlib.h>
15 #endif
16 
17 #define MPI_SUCCESS 0
18 #define MPI_FAILURE 1
19 void    *MPIUNI_TMP        = 0;
20 int     MPIUNI_DATASIZE[10] = {sizeof(int),sizeof(float),sizeof(double),2*sizeof(double),sizeof(char),2*sizeof(int),4*sizeof(double),4,8,2*sizeof(double)};
21 /*
22        With MPI Uni there are exactly four distinct communicators:
23     MPI_COMM_SELF, MPI_COMM_WORLD, and a MPI_Comm_dup() of each of these (duplicates of duplicates return the same communictor)
24 
25     MPI_COMM_SELF and MPI_COMM_WORLD are MPI_Comm_free() in MPI_Finalize() but in general with PETSc,
26      the other communicators are freed once the last PETSc object is freed (before MPI_Finalize()).
27 
28 */
29 #define MAX_ATTR 128
30 
31 typedef struct {
32   void                *attribute_val;
33   int                 active;
34 } MPI_Attr;
35 
36 typedef struct {
37   void                *extra_state;
38   MPI_Delete_function *del;
39 } MPI_Attr_keyval;
40 
41 static MPI_Attr_keyval attr_keyval[MAX_ATTR];
42 static MPI_Attr        attr[4][MAX_ATTR];
43 static int             num_attr = 1,mpi_tag_ub = 100000000;
44 
45 #if defined(__cplusplus)
46 extern "C" {
47 #endif
48 
49 /*
50    To avoid problems with prototypes to the system memcpy() it is duplicated here
51 */
52 int MPIUNI_Memcpy(void *a,const void* b,int n)
53 {
54   int  i;
55   char *aa= (char*)a;
56   char *bb= (char*)b;
57 
58   if (b == MPI_IN_PLACE) return 0;
59   for (i=0; i<n; i++) aa[i] = bb[i];
60   return 0;
61 }
62 
63 /*
64    Used to set the built-in MPI_TAG_UB attribute
65 */
66 static int Keyval_setup(void)
67 {
68   attr[MPI_COMM_WORLD-1][0].active        = 1;
69   attr[MPI_COMM_WORLD-1][0].attribute_val = &mpi_tag_ub;
70   attr[MPI_COMM_SELF-1][0].active         = 1;
71   attr[MPI_COMM_SELF-1][0].attribute_val  = &mpi_tag_ub;
72   return 0;
73 }
74 
75 int MPI_Keyval_create(MPI_Copy_function *copy_fn,MPI_Delete_function *delete_fn,int *keyval,void *extra_state)
76 {
77   if (num_attr >= MAX_ATTR) MPI_Abort(MPI_COMM_WORLD,1);
78 
79   attr_keyval[num_attr].extra_state = extra_state;
80   attr_keyval[num_attr].del         = delete_fn;
81   *keyval                           = num_attr++;
82   return 0;
83 }
84 
85 int MPI_Keyval_free(int *keyval)
86 {
87   attr_keyval[*keyval].extra_state = 0;
88   attr_keyval[*keyval].del         = 0;
89   *keyval = 0;
90   return MPI_SUCCESS;
91 }
92 
93 int MPI_Attr_put(MPI_Comm comm,int keyval,void *attribute_val)
94 {
95   if (comm-1 < 0 || comm-1 > 3) return 1;
96   attr[comm-1][keyval].active        = 1;
97   attr[comm-1][keyval].attribute_val = attribute_val;
98   return MPI_SUCCESS;
99 }
100 
101 int MPI_Attr_delete(MPI_Comm comm,int keyval)
102 {
103   if (comm-1 < 0 || comm-1 > 3) return 1;
104   if (attr[comm-1][keyval].active && attr_keyval[keyval].del) {
105     void* save_attribute_val   = attr[comm-1][keyval].attribute_val;
106     attr[comm-1][keyval].active        = 0;
107     attr[comm-1][keyval].attribute_val = 0;
108     (*(attr_keyval[keyval].del))(comm,keyval,save_attribute_val,attr_keyval[keyval].extra_state);
109   }
110   return MPI_SUCCESS;
111 }
112 
113 int MPI_Attr_get(MPI_Comm comm,int keyval,void *attribute_val,int *flag)
114 {
115   if (comm-1 < 0 || comm-1 > 3) return 1;
116   if (!keyval) Keyval_setup();
117   *flag                   = attr[comm-1][keyval].active;
118   *(void **)attribute_val = attr[comm-1][keyval].attribute_val;
119   return MPI_SUCCESS;
120 }
121 
122   static int dups[4] = {1,1,1,1};
123 int MPI_Comm_create(MPI_Comm comm,MPI_Group group,MPI_Comm *newcomm)
124 {
125   if (comm-1 < 0 || comm-1 > 3) return 1;
126   dups[comm-1]++;
127   *newcomm =  comm;
128   return MPI_SUCCESS;
129 }
130 
131 int MPI_Comm_dup(MPI_Comm comm,MPI_Comm *out)
132 {
133   if (comm-1 < 0 || comm-1 > 3) return 1;
134   if (comm == MPI_COMM_WORLD || comm == MPI_COMM_SELF) {
135     *out = comm + 2;
136   } else {
137     *out = comm;
138     dups[comm-1]++;
139   }
140   return 0;
141 }
142 
143 int MPI_Comm_free(MPI_Comm *comm)
144 {
145   int i;
146 
147   if (*comm-1 < 0 || *comm-1 > 3) return 1;
148   if (--dups[*comm-1]) return MPI_SUCCESS;
149   for (i=0; i<num_attr; i++) {
150     if (attr[*comm-1][i].active && attr_keyval[i].del) {
151       (*attr_keyval[i].del)(*comm,i,attr[*comm-1][i].attribute_val,attr_keyval[i].extra_state);
152     }
153     attr[*comm-1][i].active        = 0;
154     attr[*comm-1][i].attribute_val = 0;
155   }
156   *comm = 0;
157   return MPI_SUCCESS;
158 }
159 
160 int MPI_Comm_size(MPI_Comm comm, int*size)
161 {
162   *size=1;
163   return MPI_SUCCESS;
164 }
165 
166 int MPI_Comm_rank(MPI_Comm comm, int*rank)
167 {
168   *rank=0;
169   return MPI_SUCCESS;
170 }
171 
172 int MPI_Abort(MPI_Comm comm,int errorcode)
173 {
174   abort();
175   return MPI_SUCCESS;
176 }
177 
178 /* --------------------------------------------------------------------------*/
179 
180 static int MPI_was_initialized = 0;
181 static int MPI_was_finalized   = 0;
182 
183 int MPI_Init(int *argc, char ***argv)
184 {
185   if (MPI_was_initialized) return 1;
186   if (MPI_was_finalized) return 1;
187   MPI_was_initialized = 1;
188   return 0;
189 }
190 
191 int MPI_Finalize(void)
192 {
193   MPI_Comm comm;
194   if (MPI_was_finalized) return 1;
195   if (!MPI_was_initialized) return 1;
196   comm = MPI_COMM_WORLD;
197   MPI_Comm_free(&comm);
198   comm = MPI_COMM_SELF;
199   MPI_Comm_free(&comm);
200   MPI_was_finalized = 1;
201   return 0;
202 }
203 
204 int MPI_Initialized(int *flag)
205 {
206   *flag = MPI_was_initialized;
207   return 0;
208 }
209 
210 int MPI_Finalized(int *flag)
211 {
212   *flag = MPI_was_finalized;
213   return 0;
214 }
215 
216 /* -------------------     Fortran versions of several routines ------------------ */
217 
218 #if defined(PETSC_HAVE_FORTRAN_CAPS)
219 #define mpi_init_             MPI_INIT
220 #define mpi_finalize_         MPI_FINALIZE
221 #define mpi_comm_size_        MPI_COMM_SIZE
222 #define mpi_comm_rank_        MPI_COMM_RANK
223 #define mpi_abort_            MPI_ABORT
224 #define mpi_reduce_           MPI_REDUCE
225 #define mpi_allreduce_        MPI_ALLREDUCE
226 #define mpi_barrier_          MPI_BARRIER
227 #define mpi_bcast_            MPI_BCAST
228 #define mpi_gather_           MPI_GATHER
229 #define mpi_allgather_        MPI_ALLGATHER
230 #define mpi_comm_split_       MPI_COMM_SPLIT
231 #define mpi_scan_             MPI_SCAN
232 #define mpi_send_             MPI_SEND
233 #define mpi_recv_             MPI_RECV
234 #define mpi_reduce_scatter_   MPI_REDUCE_SCATTER
235 #define mpi_irecv_            MPI_IRECV
236 #define mpi_isend_            MPI_ISEND
237 #define mpi_sendrecv_         MPI_SENDRECV
238 #define mpi_test_             MPI_TEST
239 #define mpi_waitall_          MPI_WAITALL
240 #define mpi_waitany_          MPI_WAITANY
241 #define mpi_allgatherv_       MPI_ALLGATHERV
242 #define mpi_alltoallv_        MPI_ALLTOALLV
243 #define mpi_comm_create_      MPI_COMM_CREATE
244 #define mpi_address_          MPI_ADDRESS
245 #define mpi_pack_             MPI_PACK
246 #define mpi_unpack_           MPI_UNPACK
247 #define mpi_pack_size_        MPI_PACK_SIZE
248 #define mpi_type_struct_      MPI_TYPE_STRUCT
249 #define mpi_type_commit_      MPI_TYPE_COMMIT
250 #define mpi_wtime_            MPI_WTIME
251 #define mpi_cancel_           MPI_CANCEL
252 #define mpi_comm_dup_         MPI_COMM_DUP
253 #define mpi_comm_free_        MPI_COMM_FREE
254 #define mpi_get_count_        MPI_GET_COUNT
255 #define mpi_get_processor_name_ MPI_GET_PROCESSOR_NAME
256 #define mpi_initialized_      MPI_INITIALIZED
257 #define mpi_iprobe_           MPI_IPROBE
258 #define mpi_probe_            MPI_PROBE
259 #define mpi_request_free_     MPI_REQUEST_FREE
260 #define mpi_ssend_            MPI_SSEND
261 #define mpi_wait_             MPI_WAIT
262 #define mpi_comm_group_       MPI_COMM_GROUP
263 #define mpi_exscan_           MPI_EXSCAN
264 #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE)
265 #define mpi_init_             mpi_init
266 #define mpi_finalize_         mpi_finalize
267 #define mpi_comm_size_        mpi_comm_size
268 #define mpi_comm_rank_        mpi_comm_rank
269 #define mpi_abort_            mpi_abort
270 #define mpi_reduce_           mpi_reduce
271 #define mpi_allreduce_        mpi_allreduce
272 #define mpi_barrier_          mpi_barrier
273 #define mpi_bcast_            mpi_bcast
274 #define mpi_gather_           mpi_gather
275 #define mpi_allgather_        mpi_allgather
276 #define mpi_comm_split_       mpi_comm_split
277 #define mpi_scan_             mpi_scan
278 #define mpi_send_             mpi_send
279 #define mpi_recv_             mpi_recv
280 #define mpi_reduce_scatter_   mpi_reduce_scatter
281 #define mpi_irecv_            mpi_irecv
282 #define mpi_isend_            mpi_isend
283 #define mpi_sendrecv_         mpi_sendrecv
284 #define mpi_test_             mpi_test
285 #define mpi_waitall_          mpi_waitall
286 #define mpi_waitany_          mpi_waitany
287 #define mpi_allgatherv_       mpi_allgatherv
288 #define mpi_alltoallv_        mpi_alltoallv
289 #define mpi_comm_create_      mpi_comm_create
290 #define mpi_address_          mpi_address
291 #define mpi_pack_             mpi_pack
292 #define mpi_unpack_           mpi_unpack
293 #define mpi_pack_size_        mpi_pack_size
294 #define mpi_type_struct_      mpi_type_struct
295 #define mpi_type_commit_      mpi_type_commit
296 #define mpi_wtime_            mpi_wtime
297 #define mpi_cancel_           mpi_cancel
298 #define mpi_comm_dup_         mpi_comm_dup
299 #define mpi_comm_free_        mpi_comm_free
300 #define mpi_get_count_        mpi_get_count
301 #define mpi_get_processor_name_ mpi_get_processor_name
302 #define mpi_initialized_      mpi_initialized
303 #define mpi_iprobe_           mpi_iprobe
304 #define mpi_probe_            mpi_probe
305 #define mpi_request_free_     mpi_request_free
306 #define mpi_ssend_            mpi_ssend
307 #define mpi_wait_             mpi_wait
308 #define mpi_comm_group_       mpi_comm_group
309 #define mpi_exscan_           mpi_exscan
310 #endif
311 
312 #if defined(PETSC_HAVE_FORTRAN_UNDERSCORE_UNDERSCORE)
313 #define mpi_init_             mpi_init__
314 #define mpi_finalize_         mpi_finalize__
315 #define mpi_comm_size_        mpi_comm_size__
316 #define mpi_comm_rank_        mpi_comm_rank__
317 #define mpi_abort_            mpi_abort__
318 #define mpi_reduce_           mpi_reduce__
319 #define mpi_allreduce_        mpi_allreduce__
320 #define mpi_barrier_          mpi_barrier__
321 #define mpi_bcast_            mpi_bcast__
322 #define mpi_gather_           mpi_gather__
323 #define mpi_allgather_        mpi_allgather__
324 #define mpi_comm_split_       mpi_comm_split__
325 #define mpi_scan_             mpi_scan__
326 #define mpi_send_             mpi_send__
327 #define mpi_recv_             mpi_recv__
328 #define mpi_reduce_scatter_   mpi_reduce_scatter__
329 #define mpi_irecv_            mpi_irecv__
330 #define mpi_isend_            mpi_isend__
331 #define mpi_sendrecv_         mpi_sendrecv__
332 #define mpi_test_             mpi_test__
333 #define mpi_waitall_          mpi_waitall__
334 #define mpi_waitany_          mpi_waitany__
335 #define mpi_allgatherv_       mpi_allgatherv__
336 #define mpi_alltoallv_        mpi_alltoallv__
337 #define mpi_comm_create_      mpi_comm_create__
338 #define mpi_address_          mpi_address__
339 #define mpi_pack_             mpi_pack__
340 #define mpi_unpack_           mpi_unpack__
341 #define mpi_pack_size_        mpi_pack_size__
342 #define mpi_type_struct_      mpi_type_struct__
343 #define mpi_type_commit_      mpi_type_commit__
344 #define mpi_wtime_            mpi_wtime__
345 #define mpi_cancel_           mpi_cancel__
346 #define mpi_comm_dup_         mpi_comm_dup__
347 #define mpi_comm_free_        mpi_comm_free__
348 #define mpi_get_count_        mpi_get_count__
349 #define mpi_get_processor_name_ mpi_get_processor_name__
350 #define mpi_initialized_      mpi_initialized__
351 #define mpi_iprobe_           mpi_iprobe__
352 #define mpi_probe_            mpi_probe__
353 #define mpi_request_free_     mpi_request_free__
354 #define mpi_ssend_            mpi_ssend__
355 #define mpi_wait_             mpi_wait__
356 #define mpi_comm_group_       mpi_comm_group__
357 #define mpi_exscan_           mpi_exscan__
358 #endif
359 
360 
361 /* Do not build fortran interface if MPI namespace colision is to be avoided */
362 #if !defined(MPIUNI_AVOID_MPI_NAMESPACE)
363 
364 void PETSC_STDCALL  mpi_init_(int *ierr)
365 {
366   *ierr = MPI_Init((int*)0, (char***)0);
367 }
368 
369 void PETSC_STDCALL  mpi_finalize_(int *ierr)
370 {
371   *ierr = MPI_Finalize();
372 }
373 
374 void PETSC_STDCALL mpi_comm_size_(MPI_Comm *comm,int *size,int *ierr)
375 {
376   *size = 1;
377   *ierr = 0;
378 }
379 
380 void PETSC_STDCALL mpi_comm_rank_(MPI_Comm *comm,int *rank,int *ierr)
381 {
382   *rank=0;
383   *ierr=MPI_SUCCESS;
384 }
385 
386 void PETSC_STDCALL mpi_comm_split_(MPI_Comm *comm,int *color,int *key, MPI_Comm *newcomm, int *ierr)
387 {
388   *newcomm = *comm;
389   *ierr=MPI_SUCCESS;
390 }
391 
392 void PETSC_STDCALL mpi_abort_(MPI_Comm *comm,int *errorcode,int *ierr)
393 {
394   abort();
395   *ierr = MPI_SUCCESS;
396 }
397 
398 void PETSC_STDCALL mpi_reduce_(void *sendbuf,void *recvbuf,int *count,int *datatype,int *op,int *root,int *comm,int *ierr)
399 {
400   MPIUNI_Memcpy(recvbuf,sendbuf,(*count)*MPIUNI_DATASIZE[*datatype]);
401   *ierr = MPI_SUCCESS;
402 }
403 
404 void PETSC_STDCALL mpi_allreduce_(void *sendbuf,void *recvbuf,int *count,int *datatype,int *op,int *comm,int *ierr)
405 {
406   MPIUNI_Memcpy(recvbuf,sendbuf,(*count)*MPIUNI_DATASIZE[*datatype]);
407   *ierr = MPI_SUCCESS;
408 }
409 
410 void PETSC_STDCALL mpi_barrier_(MPI_Comm *comm,int *ierr)
411 {
412   *ierr = MPI_SUCCESS;
413 }
414 
415 void PETSC_STDCALL mpi_bcast_(void *buf,int *count,int *datatype,int *root,int *comm,int *ierr)
416 {
417   *ierr = MPI_SUCCESS;
418 }
419 
420 
421 void PETSC_STDCALL mpi_gather_(void *sendbuf,int *scount,int *sdatatype, void* recvbuf, int* rcount, int* rdatatype, int *root,int *comm,int *ierr)
422 {
423   MPIUNI_Memcpy(recvbuf,sendbuf,(*scount)*MPIUNI_DATASIZE[*sdatatype]);
424   *ierr = MPI_SUCCESS;
425 }
426 
427 void PETSC_STDCALL mpi_allgather_(void *sendbuf,int *scount,int *sdatatype, void* recvbuf, int* rcount, int* rdatatype,int *comm,int *ierr)
428 {
429   MPIUNI_Memcpy(recvbuf,sendbuf,(*scount)*MPIUNI_DATASIZE[*sdatatype]);
430   *ierr = MPI_SUCCESS;
431 }
432 
433 void PETSC_STDCALL mpi_scan_(void *sendbuf,void *recvbuf,int *count,int *datatype,int *op,int *comm,int *ierr)
434 {
435   MPIUNI_Memcpy(recvbuf,sendbuf,(*count)*MPIUNI_DATASIZE[*datatype]);
436   *ierr = MPI_SUCCESS;
437 }
438 
439 void PETSC_STDCALL mpi_send_(void*buf,int *count,int *datatype,int *dest,int *tag,int *comm,int *ierr)
440 {
441   *ierr = MPI_Abort(MPI_COMM_WORLD,0);
442 }
443 
444 void PETSC_STDCALL mpi_recv_(void*buf,int *count,int *datatype,int *source,int *tag,int *comm,int status,int *ierr)
445 {
446   *ierr = MPI_Abort(MPI_COMM_WORLD,0);
447 }
448 
449 void PETSC_STDCALL mpi_reduce_scatter_(void*sendbuf,void*recvbuf,int *recvcounts,int *datatype,int *op,int *comm,int *ierr)
450 {
451   *ierr = MPI_Abort(MPI_COMM_WORLD,0);
452 }
453 
454 void PETSC_STDCALL mpi_irecv_(void*buf,int *count, int *datatype, int *source, int *tag, int *comm, int *request, int *ierr)
455 {
456   *ierr = MPI_Abort(MPI_COMM_WORLD,0);
457 }
458 
459 void PETSC_STDCALL mpi_isend_(void*buf,int *count,int *datatype,int *dest,int *tag,int *comm,int *request, int *ierr)
460 {
461   *ierr = MPI_Abort(MPI_COMM_WORLD,0);
462 }
463 
464 void PETSC_STDCALL mpi_sendrecv_(void*sendbuf,int *sendcount,int *sendtype,int *dest,int *sendtag,void*recvbuf,int *recvcount,int *recvtype,int *source,int *recvtag,int *comm,int *status,int *ierr)
465 {
466   MPIUNI_Memcpy(recvbuf,sendbuf,(*sendcount)*MPIUNI_DATASIZE[*sendtype]);
467   *ierr = MPI_SUCCESS;
468 }
469 
470 void PETSC_STDCALL mpi_test_(int *request,int *flag,int *status,int *ierr)
471 {
472   *ierr = MPI_Abort(MPI_COMM_WORLD,0);
473 }
474 
475 void PETSC_STDCALL mpi_waitall_(int *count,int *array_of_requests,int *array_of_statuses,int *ierr)
476 {
477   *ierr = MPI_SUCCESS;
478 }
479 
480   void PETSC_STDCALL mpi_waitany_(int *count,int *array_of_requests,int * index, int *status,int *ierr)
481 {
482   *ierr = MPI_SUCCESS;
483 }
484 
485 void PETSC_STDCALL mpi_allgatherv_(void*sendbuf,int *sendcount,int *sendtype,void*recvbuf,int *recvcounts,int *displs,int *recvtype,int *comm,int *ierr)
486 {
487   MPIUNI_Memcpy(recvbuf,sendbuf,(*sendcount)*MPIUNI_DATASIZE[*sendtype]);
488   *ierr = MPI_SUCCESS;
489 }
490 
491 void PETSC_STDCALL mpi_alltoallv_(void*sendbuf,int *sendcounts,int *sdispls,int *sendtype,void*recvbuf,int *recvcounts,int *rdispls,int *recvtype,int *comm,int *ierr)
492 {
493   MPIUNI_Memcpy(recvbuf,sendbuf,(*sendcounts)*MPIUNI_DATASIZE[*sendtype]);
494   *ierr = MPI_SUCCESS;
495 }
496 
497 void PETSC_STDCALL mpi_comm_create_(int *comm,int *group,int *newcomm,int *ierr)
498 {
499   *newcomm =  *comm;
500   *ierr = MPI_SUCCESS;
501 }
502 
503 void PETSC_STDCALL mpi_address_(void*location,MPIUNI_INTPTR *address,int *ierr)
504 {
505   *address =  (MPIUNI_INTPTR) location;
506   *ierr = MPI_SUCCESS;
507 }
508 
509 void PETSC_STDCALL mpi_pack_(void*inbuf,int *incount,int *datatype,void*outbuf,int *outsize,int *position,int *comm,int *ierr)
510 {
511   *ierr = MPI_Abort(MPI_COMM_WORLD,0);
512 }
513 
514 void PETSC_STDCALL mpi_unpack_(void*inbuf,int *insize,int *position,void*outbuf,int *outcount,int *datatype,int *comm,int *ierr)
515 {
516   *ierr = MPI_Abort(MPI_COMM_WORLD,0);
517 }
518 
519 void PETSC_STDCALL mpi_pack_size_(int *incount,int *datatype,int *comm,int *size,int *ierr)
520 {
521   *ierr = MPI_Abort(MPI_COMM_WORLD,0);
522 }
523 
524 void PETSC_STDCALL mpi_type_struct_(int *count,int *array_of_blocklengths,int * array_of_displaments,int *array_of_types,int *newtype,int *ierr)
525 {
526   *ierr = MPI_Abort(MPI_COMM_WORLD,0);
527 }
528 
529 void PETSC_STDCALL mpi_type_commit_(int *datatype,int *ierr)
530 {
531   *ierr = MPI_SUCCESS;
532 }
533 
534 double PETSC_STDCALL mpi_wtime_(void)
535 {
536   return 0.0;
537 }
538 
539 void PETSC_STDCALL mpi_cancel_(int *request,int *ierr)
540 {
541   *ierr = MPI_SUCCESS;
542 }
543 
544 void PETSC_STDCALL mpi_comm_dup_(int *comm,int *out,int *ierr)
545 {
546   *out = *comm;
547   *ierr = MPI_SUCCESS;
548 }
549 
550 void PETSC_STDCALL mpi_comm_free_(int *comm,int *ierr)
551 {
552   *ierr = MPI_SUCCESS;
553 }
554 
555 void PETSC_STDCALL mpi_get_count_(int *status,int *datatype,int *count,int *ierr)
556 {
557   *ierr = MPI_Abort(MPI_COMM_WORLD,0);
558 }
559 
560 /* duplicate from fortranimpl.h */
561 #if defined(PETSC_HAVE_FORTRAN_MIXED_STR_ARG)
562 #define PETSC_MIXED_LEN(len) ,int len
563 #define PETSC_END_LEN(len)
564 #else
565 #define PETSC_MIXED_LEN(len)
566 #define PETSC_END_LEN(len)   ,int len
567 #endif
568 
569 void PETSC_STDCALL mpi_get_processor_name_(char *name PETSC_MIXED_LEN(len),int *result_len,int *ierr PETSC_END_LEN(len))
570 {
571   MPIUNI_Memcpy(name,"localhost",9*sizeof(char));
572   *result_len = 9;
573   *ierr = MPI_SUCCESS;
574 }
575 
576 void PETSC_STDCALL mpi_initialized_(int *flag,int *ierr)
577 {
578   *flag = MPI_was_initialized;
579   *ierr = MPI_SUCCESS;
580 }
581 
582 void PETSC_STDCALL mpi_iprobe_(int *source,int *tag,int *comm,int *glag,int *status,int *ierr)
583 {
584   *ierr = MPI_SUCCESS;
585 }
586 
587 void PETSC_STDCALL mpi_probe_(int *source,int *tag,int *comm,int *flag,int *status,int *ierr)
588 {
589   *ierr = MPI_SUCCESS;
590 }
591 
592 void PETSC_STDCALL mpi_request_free_(int *request,int *ierr)
593 {
594   *ierr = MPI_SUCCESS;
595 }
596 
597 void PETSC_STDCALL mpi_ssend_(void*buf,int *count,int *datatype,int *dest,int *tag,int *comm,int *ierr)
598 {
599   *ierr = MPI_Abort(MPI_COMM_WORLD,0);
600 }
601 
602 void PETSC_STDCALL mpi_wait_(int *request,int *status,int *ierr)
603 {
604   *ierr = MPI_SUCCESS;
605 }
606 
607 void PETSC_STDCALL mpi_comm_group_(int*comm,int*group,int *ierr)
608 {
609   *ierr = MPI_SUCCESS;
610 }
611 
612 void PETSC_STDCALL mpi_exscan_(void*sendbuf,void*recvbuf,int*count,int*datatype,int*op,int*comm,int*ierr)
613 {
614   *ierr = MPI_SUCCESS;
615 }
616 
617 #endif /* MPIUNI_AVOID_MPI_NAMESPACE */
618 
619 #if defined(__cplusplus)
620 }
621 #endif
622