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