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