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. 5 6 For example, 7 * Does not implement send to self. 8 * Does not implement attributes correctly. 9 */ 10 11 /* 12 The following info is a response to one of the petsc-maint questions 13 regarding MPIUNI. 14 15 MPIUNI was developed with the aim of getting PETSc compiled, and 16 usable in the absence of a full MPI implementation. With this, we 17 were able to provide PETSc on Windows and Windows64 even before any MPI 18 implementation was available on these platforms. [Or with certain 19 compilers - like Borland, that do not have a usable MPI 20 implementation] 21 22 However - providing a sequential, standards compliant MPI 23 implementation is *not* the goal of MPIUNI. The development strategy 24 was - to make enough changes to it so that PETSc sources and examples 25 compile without errors, and run in the uni-processor mode. This is 26 the reason each function is not documented. 27 28 Because collective MPI routines, such as MPI_Allreduce(), MPI_Scatter(), 29 are used in PETSc code that runs on only a single MPI rank, the 30 wrappers provided in MPIUNI do work for those routines. 31 32 PETSc usage of MPIUNI is primarily from C. However a minimal Fortran 33 interface is also provided - to get PETSc Fortran examples with a 34 few MPI calls working. 35 36 One of the optimization with MPIUNI, is to avoid the function call 37 overhead, when possible. Hence most of the C functions are 38 implemented as macros. However the function calls cannot be avoided 39 with Fortran usage. 40 41 Most PETSc objects have both sequential and parallel 42 implementations, which are separate. For example, we have two types of 43 sparse matrix storage formats - SeqAIJ, and MPIAIJ. Some MPI 44 routines are used in the sequential format, but most of them are used in the 45 MPI part. The send/receive calls can be found mostly in the MPI 46 part. 47 48 When MPIUNI is used, only the sequential version of the PETSc objects are 49 used, even though the MPI variant of the objects are compiled. Since 50 there are no send/receive calls in the sequential variant, PETSc works fine 51 with MPIUNI in seq mode. 52 53 The reason some send/receive functions are defined to abort(), is to 54 detect sections of code that use send/receive functions, and gets 55 executed in the sequential mode. (which shouldn't happen in case of 56 PETSc). 57 58 Proper implementation of send/receive would involve writing a 59 function for each of them. Inside each of these functions, we would have 60 to check if the send is to self or receive is from self, and then 61 do the buffering accordingly (until the receive is called) - or 62 what if a nonblocking receive is called, do a copy etc.. Handling 63 the buffering aspects might be complicated enough, that in this 64 case, a proper implementation of MPI might as well be used. This is 65 the reason the send to self is not implemented in MPIUNI, and never 66 will be. 67 68 Proper implementations of MPI [for eg: MPICH & Open MPI] are 69 available for most machines. When these packages are available, Its 70 generally preferable to use one of them instead of MPIUNI - even if 71 the user is using PETSc sequentially. 72 73 - MPIUNI does not support all MPI functions [or functionality]. 74 Hence it might not work with external packages or user code that 75 might have MPI calls in it. 76 77 - MPIUNI is not a standards compliant implementation even for one MPI rank. 78 For example, if the user code has send/recv to self, then it will 79 abort. [Similar issues exist with a number of other MPI functionality] 80 However MPICH & Open MPI are the correct implementations of MPI 81 standard for one MPI rank. 82 83 - When user code uses multiple MPI based packages that have their 84 own *internal* stubs equivalent to MPIUNI - in sequential mode, 85 invariably these multiple implementations of MPI for one rank conflict 86 with each other. The correct thing to do is: make all such 87 packages use the *same* MPI implementation for one rank. MPICH/Open MPI 88 satisfy this requirement correctly [and hence is the correct choice]. 89 90 - Using MPICH/Open MPI sequentially should have minimal 91 disadvantages. [for examples, the binaries can be run without 92 mpiexec/mpirun as ./executable, without requiring any extra 93 configurations for ssh/rsh/daemons etc..]. This should not be a 94 reason to avoid these packages for sequential use. 95 */ 96 97 #if !defined(MPIUNI_H) 98 #define MPIUNI_H 99 100 /* Required by abort() in mpi.c & for win64 */ 101 #include <petscconf.h> 102 #include <stddef.h> 103 104 /* 105 This is reproduced from petscsys.h so that mpi.h can be used standalone without first including petscsys.h 106 Note that it does require <petscconf.h> to be included to obtain some properties of the system being built for 107 */ 108 #if defined(_WIN32) && defined(PETSC_USE_SHARED_LIBRARIES) 109 #define MPIUni_PETSC_DLLEXPORT __declspec(dllexport) 110 #define MPIUni_PETSC_DLLIMPORT __declspec(dllimport) 111 #elif defined(PETSC_USE_VISIBILITY_CXX) && defined(__cplusplus) 112 #define MPIUni_PETSC_DLLEXPORT __attribute__((visibility("default"))) 113 #define MPIUni_PETSC_DLLIMPORT __attribute__((visibility("default"))) 114 #elif defined(PETSC_USE_VISIBILITY_C) && !defined(__cplusplus) 115 #define MPIUni_PETSC_DLLEXPORT __attribute__((visibility("default"))) 116 #define MPIUni_PETSC_DLLIMPORT __attribute__((visibility("default"))) 117 #else 118 #define MPIUni_PETSC_DLLEXPORT 119 #define MPIUni_PETSC_DLLIMPORT 120 #endif 121 122 #if defined(petsc_EXPORTS) 123 #define MPIUni_PETSC_VISIBILITY_PUBLIC MPIUni_PETSC_DLLEXPORT 124 #else /* Win32 users need this to import symbols from petsc.dll */ 125 #define MPIUni_PETSC_VISIBILITY_PUBLIC MPIUni_PETSC_DLLIMPORT 126 #endif 127 128 #if defined(__cplusplus) 129 #define MPIUni_PETSC_EXTERN extern "C" MPIUni_PETSC_VISIBILITY_PUBLIC 130 #else 131 #define MPIUni_PETSC_EXTERN extern MPIUni_PETSC_VISIBILITY_PUBLIC 132 #endif 133 134 #if defined(__cplusplus) 135 extern "C" { 136 #endif 137 138 /* MPI_Aint has to be a signed integral type large enough to hold a pointer */ 139 typedef ptrdiff_t MPI_Aint; 140 141 /* old 32-bit Microsoft compiler does not support long long */ 142 #if defined(PETSC_SIZEOF_LONG_LONG) 143 typedef long long MPIUNI_INT64; 144 typedef unsigned long long MPIUNI_UINT64; 145 #elif defined(PETSC_HAVE___INT64) 146 typedef _int64 MPIUNI_INT64; 147 typedef unsigned _int64 MPIUNI_UINT64; 148 #else 149 #error "Cannot determine MPIUNI_INT64, MPIUNI_UINT64 types" 150 #endif 151 152 typedef MPIUNI_INT64 MPI_Count; 153 154 /* 155 MPIUNI_ARG is used in the macros below only to stop C/C++ compilers 156 from generating warning messages about unused variables while compiling PETSc. 157 */ 158 MPIUni_PETSC_EXTERN void *MPIUNI_TMP; 159 #define MPIUNI_ARG(arg) (MPIUNI_TMP = (void *)(MPI_Aint)(arg)) 160 161 #define MPI_IDENT 0 162 #define MPI_CONGRUENT 1 163 #define MPI_SIMILAR 2 164 #define MPI_UNEQUAL 3 165 166 #define MPI_BOTTOM ((void *)0) 167 #define MPI_IN_PLACE ((void *)-1) 168 169 #define MPI_PROC_NULL (-1) 170 #define MPI_ANY_SOURCE (-2) 171 #define MPI_ANY_TAG (-1) 172 #define MPI_UNDEFINED (-32766) 173 174 #define MPI_SUCCESS 0 175 #define MPI_ERR_COUNT 2 176 #define MPI_ERR_OTHER 17 177 #define MPI_ERR_UNKNOWN 18 178 #define MPI_ERR_INTERN 21 179 #define MPI_ERR_NOSUPPORT 22 180 181 #define MPI_KEYVAL_INVALID 0 182 #define MPI_TAG_UB 0 183 184 #define MPI_MAX_PROCESSOR_NAME 1024 185 #define MPI_MAX_ERROR_STRING 2056 186 #define MPI_MAX_OBJECT_NAME 1024 187 188 typedef int MPI_Comm; 189 #define MPI_COMM_NULL 0 190 #define MPI_COMM_SELF 1 191 #define MPI_COMM_WORLD 2 192 #define MPI_COMM_TYPE_SHARED 1 193 194 typedef void *MPI_Win; 195 typedef int MPI_Info; 196 #define MPI_INFO_NULL 0 197 198 typedef struct { 199 int MPI_SOURCE, MPI_TAG, MPI_ERROR; 200 } MPI_Status; 201 #define MPI_STATUS_IGNORE (MPI_Status *)0 202 #define MPI_STATUSES_IGNORE (MPI_Status *)0 203 204 /* 32-bit packing scheme: [combiner:4 | type-index:8 | count:12 | base-bytes:8] */ 205 /* Any changes here must also be reflected in mpif.h */ 206 typedef int MPI_Datatype; 207 #define MPI_DATATYPE_NULL 0 208 #define MPI_PACKED 0 209 210 #define MPI_FLOAT (1 << 20 | 1 << 8 | (int)sizeof(float)) 211 #define MPI_DOUBLE (1 << 20 | 1 << 8 | (int)sizeof(double)) 212 #define MPI_LONG_DOUBLE (1 << 20 | 1 << 8 | (int)sizeof(long double)) 213 214 #define MPI_COMPLEX (2 << 20 | 1 << 8 | 2 * (int)sizeof(float)) 215 #define MPI_C_COMPLEX (2 << 20 | 1 << 8 | 2 * (int)sizeof(float)) 216 #define MPI_C_FLOAT_COMPLEX (2 << 20 | 1 << 8 | 2 * (int)sizeof(float)) 217 #define MPI_DOUBLE_COMPLEX (2 << 20 | 1 << 8 | 2 * (int)sizeof(double)) 218 #define MPI_C_DOUBLE_COMPLEX (2 << 20 | 1 << 8 | 2 * (int)sizeof(double)) 219 220 #define MPI_C_BOOL (3 << 20 | 1 << 8 | (int)sizeof(_Bool)) 221 #define MPI_CHAR (3 << 20 | 1 << 8 | (int)sizeof(char)) 222 #define MPI_BYTE (3 << 20 | 1 << 8 | (int)sizeof(char)) 223 #define MPI_SIGNED_CHAR (3 << 20 | 1 << 8 | (int)sizeof(signed char)) 224 #define MPI_UNSIGNED_CHAR (3 << 20 | 1 << 8 | (int)sizeof(unsigned char)) 225 226 #define MPI_SHORT (4 << 20 | 1 << 8 | (int)sizeof(short)) 227 #define MPI_INT (4 << 20 | 1 << 8 | (int)sizeof(int)) 228 #define MPI_LONG (4 << 20 | 1 << 8 | (int)sizeof(long)) 229 #define MPI_LONG_LONG (4 << 20 | 1 << 8 | (int)sizeof(MPIUNI_INT64)) 230 #define MPI_LONG_LONG_INT MPI_LONG_LONG 231 #define MPI_AINT (4 << 20 | 1 << 8 | (int)sizeof(void *)) 232 #define MPI_INTEGER8 MPI_LONG_LONG 233 #define MPI_INT8_T (5 << 20 | 1 << 8 | (int)sizeof(int8_t)) 234 #define MPI_INT16_T (5 << 20 | 1 << 8 | (int)sizeof(int16_t)) 235 #define MPI_INT32_T (5 << 20 | 1 << 8 | (int)sizeof(int32_t)) 236 #define MPI_INT64_T (5 << 20 | 1 << 8 | (int)sizeof(int64_t)) 237 238 #define MPI_UNSIGNED_SHORT (5 << 20 | 1 << 8 | (int)sizeof(unsigned short)) 239 #define MPI_UNSIGNED (5 << 20 | 1 << 8 | (int)sizeof(unsigned)) 240 #define MPI_UNSIGNED_LONG (5 << 20 | 1 << 8 | (int)sizeof(unsigned long)) 241 #define MPI_UNSIGNED_LONG_LONG (5 << 20 | 1 << 8 | (int)sizeof(MPIUNI_UINT64)) 242 243 #define MPI_FLOAT_INT (10 << 20 | 1 << 8 | (int)(sizeof(float) + sizeof(int))) 244 #define MPI_DOUBLE_INT (11 << 20 | 1 << 8 | (int)(sizeof(double) + sizeof(int))) 245 #define MPI_LONG_INT (12 << 20 | 1 << 8 | (int)(sizeof(long) + sizeof(int))) 246 #define MPI_SHORT_INT (13 << 20 | 1 << 8 | (int)(sizeof(short) + sizeof(int))) 247 #define MPI_2INT (14 << 20 | 1 << 8 | (int)(2 * sizeof(int))) 248 #define MPI_2DOUBLE (15 << 20 | 1 << 8 | (int)(2 * sizeof(double))) 249 250 /* Fortran datatypes; Jed Brown says they should be defined here */ 251 #define MPI_INTEGER MPI_INT 252 #define MPI_DOUBLE_PRECISION MPI_DOUBLE 253 #define MPI_COMPLEX16 MPI_C_DOUBLE_COMPLEX 254 #define MPI_2DOUBLE_PRECISION MPI_2DOUBLE 255 256 #define MPI_ORDER_C 0 257 #define MPI_ORDER_FORTRAN 1 258 259 #define MPI_sizeof_default(datatype) ((((datatype) >> 8) & 0xfff) * ((datatype) & 0xff)) 260 #if defined(PETSC_USE_REAL___FP16) 261 MPIUni_PETSC_EXTERN MPI_Datatype MPIU___FP16; 262 #define MPI_sizeof(datatype) ((datatype == MPIU___FP16) ? (int)(2 * sizeof(char)) : MPI_sizeof_default(datatype)) 263 #elif defined(PETSC_USE_REAL___FLOAT128) 264 MPIUni_PETSC_EXTERN MPI_Datatype MPIU___FLOAT128; 265 #define MPI_sizeof(datatype) ((datatype == MPIU___FLOAT128) ? (int)(2 * sizeof(double)) : MPI_sizeof_default(datatype)) 266 #else 267 #define MPI_sizeof(datatype) (MPI_sizeof_default(datatype)) 268 #endif 269 270 MPIUni_PETSC_EXTERN int MPIUNI_Memcpy(void *, const void *, MPI_Count); 271 272 typedef int MPI_Request; 273 #define MPI_REQUEST_NULL 0 274 275 typedef int MPI_Group; 276 #define MPI_GROUP_NULL 0 277 #define MPI_GROUP_EMPTY 0 278 279 typedef int MPI_Op; 280 #define MPI_OP_NULL 0 281 #define MPI_SUM 1 282 #define MPI_MAX 2 283 #define MPI_MIN 3 284 #define MPI_REPLACE 4 285 #define MPI_PROD 5 286 #define MPI_LAND 6 287 #define MPI_BAND 7 288 #define MPI_LOR 8 289 #define MPI_BOR 9 290 #define MPI_LXOR 10 291 #define MPI_BXOR 11 292 #define MPI_MAXLOC 12 293 #define MPI_MINLOC 13 294 295 typedef void(MPI_User_function)(void *, void *, int *, MPI_Datatype *); 296 297 typedef int MPI_Errhandler; 298 #define MPI_ERRHANDLER_NULL 0 299 #define MPI_ERRORS_RETURN 0 300 #define MPI_ERRORS_ARE_FATAL 0 301 #define MPI_ERR_LASTCODE 0x3fffffff 302 typedef void(MPI_Handler_function)(MPI_Comm *, int *, ...); 303 304 /* 305 Prototypes of some functions which are implemented in mpi.c 306 */ 307 typedef int(MPI_Copy_function)(MPI_Comm, int, void *, void *, void *, int *); 308 typedef int(MPI_Delete_function)(MPI_Comm, int, void *, void *); 309 #define MPI_NULL_COPY_FN (MPI_Copy_function *)0 310 #define MPI_NULL_DELETE_FN (MPI_Delete_function *)0 311 312 #define MPI_THREAD_SINGLE 0 313 #define MPI_THREAD_FUNNELED 1 314 #define MPI_THREAD_SERIALIZED 2 315 #define MPI_THREAD_MULTIPLE 3 316 317 /* 318 To enable linking PETSc and MPIUNI with any other package that might have their 319 own equivalent to MPIUNI we need to avoid using 'MPI' 320 namespace for MPIUNI functions that go into the PETSc library. 321 322 For C functions below (that get compiled into PETSc library) - we map 323 the 'MPI' functions to the 'Petsc_MPI' namespace. 324 325 With Fortran we use a similar mapping - thus requiring the use of the 326 Fortran preprocessor with mpif.h 327 */ 328 #define MPI_Abort Petsc_MPI_Abort 329 #define MPIUni_Abort Petsc_MPIUni_Abort 330 #define MPI_Attr_get Petsc_MPI_Attr_get 331 #define MPI_Keyval_free Petsc_MPI_Keyval_free 332 #define MPI_Attr_put Petsc_MPI_Attr_put 333 #define MPI_Attr_delete Petsc_MPI_Attr_delete 334 #define MPI_Keyval_create Petsc_MPI_Keyval_create 335 #define MPI_Comm_free Petsc_MPI_Comm_free 336 #define MPI_Comm_dup Petsc_MPI_Comm_dup 337 #define MPI_Comm_create Petsc_MPI_Comm_create 338 #define MPI_Init Petsc_MPI_Init 339 #define MPI_Init_thread Petsc_MPI_Init_thread 340 #define MPI_Query_thread Petsc_MPI_Query_thread 341 #define MPI_Finalize Petsc_MPI_Finalize 342 #define MPI_Initialized Petsc_MPI_Initialized 343 #define MPI_Finalized Petsc_MPI_Finalized 344 #define MPI_Comm_size Petsc_MPI_Comm_size 345 #define MPI_Comm_rank Petsc_MPI_Comm_rank 346 #define MPI_Wtime Petsc_MPI_Wtime 347 #define MPI_Type_get_envelope Petsc_MPI_Type_get_envelope 348 #define MPI_Type_get_contents Petsc_MPI_Type_get_contents 349 #define MPI_Add_error_class Petsc_MPI_Add_error_class 350 #define MPI_Add_error_code Petsc_MPI_Add_error_code 351 #define MPI_Win_free Petsc_MPI_Win_free 352 #define MPI_Win_allocate_shared Petsc_MPI_Win_allocate_shared 353 354 /* identical C bindings */ 355 #define MPI_Comm_copy_attr_function MPI_Copy_function 356 #define MPI_Comm_delete_attr_function MPI_Delete_function 357 #define MPI_COMM_NULL_COPY_FN MPI_NULL_COPY_FN 358 #define MPI_COMM_NULL_DELETE_FN MPI_NULL_DELETE_FN 359 #define MPI_Comm_create_keyval Petsc_MPI_Keyval_create 360 #define MPI_Comm_free_keyval Petsc_MPI_Keyval_free 361 #define MPI_Comm_get_attr Petsc_MPI_Attr_get 362 #define MPI_Comm_set_attr Petsc_MPI_Attr_put 363 #define MPI_Comm_delete_attr Petsc_MPI_Attr_delete 364 #define MPI_Comm_get_name Petsc_MPI_Comm_get_name 365 #define MPI_Comm_set_name Petsc_MPI_Comm_set_name 366 367 MPIUni_PETSC_EXTERN int MPIUni_Abort(MPI_Comm, int); 368 MPIUni_PETSC_EXTERN int MPI_Abort(MPI_Comm, int); 369 MPIUni_PETSC_EXTERN int MPI_Attr_get(MPI_Comm comm, int keyval, void *attribute_val, int *flag); 370 MPIUni_PETSC_EXTERN int MPI_Keyval_free(int *); 371 MPIUni_PETSC_EXTERN int MPI_Attr_put(MPI_Comm, int, void *); 372 MPIUni_PETSC_EXTERN int MPI_Attr_delete(MPI_Comm, int); 373 MPIUni_PETSC_EXTERN int MPI_Keyval_create(MPI_Copy_function *, MPI_Delete_function *, int *, void *); 374 MPIUni_PETSC_EXTERN int MPI_Comm_free(MPI_Comm *); 375 MPIUni_PETSC_EXTERN int MPI_Comm_dup(MPI_Comm, MPI_Comm *); 376 MPIUni_PETSC_EXTERN int MPI_Comm_create(MPI_Comm, MPI_Group, MPI_Comm *); 377 MPIUni_PETSC_EXTERN int MPI_Init(int *, char ***); 378 MPIUni_PETSC_EXTERN int MPI_Init_thread(int *, char ***, int, int *); 379 MPIUni_PETSC_EXTERN int MPI_Query_thread(int *); 380 MPIUni_PETSC_EXTERN int MPI_Finalize(void); 381 MPIUni_PETSC_EXTERN int MPI_Initialized(int *); 382 MPIUni_PETSC_EXTERN int MPI_Finalized(int *); 383 MPIUni_PETSC_EXTERN int MPI_Comm_size(MPI_Comm, int *); 384 MPIUni_PETSC_EXTERN int MPI_Comm_rank(MPI_Comm, int *); 385 MPIUni_PETSC_EXTERN double MPI_Wtime(void); 386 387 MPIUni_PETSC_EXTERN int MPI_Win_free(MPI_Win *); 388 MPIUni_PETSC_EXTERN int MPI_Win_allocate_shared(size_t sz, size_t asz, MPI_Info, MPI_Comm, void **addr, MPI_Win *); 389 390 #define MPI_Info_create(info) (MPIUNI_ARG(info), MPI_SUCCESS) 391 #define MPI_Info_set(info, a, b) (MPIUNI_ARG(info), MPIUNI_ARG(a), MPIUNI_ARG(b), MPI_SUCCESS) 392 #define MPI_Info_free(info) (MPIUNI_ARG(info), MPI_SUCCESS) 393 394 MPIUni_PETSC_EXTERN int MPI_Type_get_envelope(MPI_Datatype, int *, int *, int *, int *); 395 MPIUni_PETSC_EXTERN int MPI_Type_get_contents(MPI_Datatype, int, int, int, int *, MPI_Aint *, MPI_Datatype *); 396 MPIUni_PETSC_EXTERN int MPI_Add_error_class(int *); 397 MPIUni_PETSC_EXTERN int MPI_Add_error_code(int, int *); 398 MPIUni_PETSC_EXTERN int MPI_Comm_get_name(MPI_Comm, char *, int *); 399 MPIUni_PETSC_EXTERN int MPI_Comm_set_name(MPI_Comm, const char *); 400 /* 401 Routines we have replace with macros that do nothing 402 Some return error codes, others return success 403 */ 404 405 typedef int MPI_Fint; 406 #define MPI_Comm_f2c(comm) (MPI_Comm)(comm) 407 #define MPI_Comm_c2f(comm) (MPI_Fint)(comm) 408 #define MPI_Type_f2c(type) (MPI_Datatype)(type) 409 #define MPI_Type_c2f(type) (MPI_Fint)(type) 410 #define MPI_Op_f2c(op) (MPI_Op)(op) 411 #define MPI_Op_c2f(op) (MPI_Fint)(op) 412 413 #define MPI_Send_c MPI_Send 414 #define MPI_Send(buf, count, datatype, dest, tag, comm) (MPIUNI_ARG(buf), MPIUNI_ARG(count), MPIUNI_ARG(datatype), MPIUNI_ARG(dest), MPIUNI_ARG(tag), MPIUNI_ARG(comm), MPIUni_Abort(MPI_COMM_WORLD, 0)) 415 #define MPI_Recv_c MPI_Recv 416 #define MPI_Recv(buf, count, datatype, source, tag, comm, status) (MPIUNI_ARG(buf), MPIUNI_ARG(count), MPIUNI_ARG(datatype), MPIUNI_ARG(source), MPIUNI_ARG(tag), MPIUNI_ARG(comm), MPIUNI_ARG(status), MPIUni_Abort(MPI_COMM_WORLD, 0)) 417 #define MPI_Get_count_c MPI_Get_count 418 #define MPI_Get_count(status, datatype, count) (MPIUNI_ARG(status), MPIUNI_ARG(datatype), MPIUNI_ARG(count), MPIUni_Abort(MPI_COMM_WORLD, 0)) 419 #define MPI_Bsend(buf, count, datatype, dest, tag, comm) (MPIUNI_ARG(buf), MPIUNI_ARG(count), MPIUNI_ARG(datatype), MPIUNI_ARG(dest), MPIUNI_ARG(tag), MPIUNI_ARG(comm), MPIUni_Abort(MPI_COMM_WORLD, 0)) 420 #define MPI_Ssend(buf, count, datatype, dest, tag, comm) (MPIUNI_ARG(buf), MPIUNI_ARG(count), MPIUNI_ARG(datatype), MPIUNI_ARG(dest), MPIUNI_ARG(tag), MPIUNI_ARG(comm), MPIUni_Abort(MPI_COMM_WORLD, 0)) 421 #define MPI_Rsend(buf, count, datatype, dest, tag, comm) (MPIUNI_ARG(buf), MPIUNI_ARG(count), MPIUNI_ARG(datatype), MPIUNI_ARG(dest), MPIUNI_ARG(tag), MPIUNI_ARG(comm), MPIUni_Abort(MPI_COMM_WORLD, 0)) 422 #define MPI_Buffer_attach(buffer, size) (MPIUNI_ARG(buffer), MPIUNI_ARG(size), MPI_SUCCESS) 423 #define MPI_Buffer_detach(buffer, size) (MPIUNI_ARG(buffer), MPIUNI_ARG(size), MPI_SUCCESS) 424 #define MPI_Ibsend(buf, count, datatype, dest, tag, comm, request) (MPIUNI_ARG(buf), MPIUNI_ARG(count), MPIUNI_ARG(datatype), MPIUNI_ARG(dest), MPIUNI_ARG(tag), MPIUNI_ARG(comm), MPIUNI_ARG(request), MPIUni_Abort(MPI_COMM_WORLD, 0)) 425 #define MPI_Issend(buf, count, datatype, dest, tag, comm, request) (MPIUNI_ARG(buf), MPIUNI_ARG(count), MPIUNI_ARG(datatype), MPIUNI_ARG(dest), MPIUNI_ARG(tag), MPIUNI_ARG(comm), MPIUNI_ARG(request), MPIUni_Abort(MPI_COMM_WORLD, 0)) 426 #define MPI_Irsend(buf, count, datatype, dest, tag, comm, request) (MPIUNI_ARG(buf), MPIUNI_ARG(count), MPIUNI_ARG(datatype), MPIUNI_ARG(dest), MPIUNI_ARG(tag), MPIUNI_ARG(comm), MPIUNI_ARG(request), MPIUni_Abort(MPI_COMM_WORLD, 0)) 427 #define MPI_Irecv_c MPI_Irecv 428 #define MPI_Irecv(buf, count, datatype, source, tag, comm, request) (MPIUNI_ARG(buf), MPIUNI_ARG(count), MPIUNI_ARG(datatype), MPIUNI_ARG(source), MPIUNI_ARG(tag), MPIUNI_ARG(comm), MPIUNI_ARG(request), MPIUni_Abort(MPI_COMM_WORLD, 0)) 429 #define MPI_Isend_c MPI_Isend 430 #define MPI_Isend(buf, count, datatype, dest, tag, comm, request) (MPIUNI_ARG(buf), MPIUNI_ARG(count), MPIUNI_ARG(datatype), MPIUNI_ARG(dest), MPIUNI_ARG(tag), MPIUNI_ARG(comm), MPIUNI_ARG(request), MPIUni_Abort(MPI_COMM_WORLD, 0)) 431 #define MPI_Wait(request, status) (MPIUNI_ARG(request), MPIUNI_ARG(status), MPI_SUCCESS) 432 #define MPI_Test(request, flag, status) (MPIUNI_ARG(request), MPIUNI_ARG(status), *(flag) = 0, MPI_SUCCESS) 433 #define MPI_Request_free(request) (MPIUNI_ARG(request), MPI_SUCCESS) 434 #define MPI_Waitany(count, array_of_requests, index, status) (MPIUNI_ARG(count), MPIUNI_ARG(array_of_requests), MPIUNI_ARG(status), (*(status)).MPI_SOURCE = 0, *(index) = 0, MPI_SUCCESS) 435 #define MPI_Testany(a, b, c, d, e) (MPIUNI_ARG(a), MPIUNI_ARG(b), MPIUNI_ARG(c), MPIUNI_ARG(d), MPIUNI_ARG(e), MPI_SUCCESS) 436 #define MPI_Waitall(count, array_of_requests, array_of_statuses) (MPIUNI_ARG(count), MPIUNI_ARG(array_of_requests), MPIUNI_ARG(array_of_statuses), MPI_SUCCESS) 437 #define MPI_Testall(count, array_of_requests, flag, array_of_statuses) (MPIUNI_ARG(count), MPIUNI_ARG(array_of_requests), MPIUNI_ARG(flag), MPIUNI_ARG(array_of_statuses), MPI_SUCCESS) 438 #define MPI_Waitsome(incount, array_of_requests, outcount, array_of_indices, array_of_statuses) (MPIUNI_ARG(incount), MPIUNI_ARG(array_of_requests), MPIUNI_ARG(outcount), MPIUNI_ARG(array_of_indices), MPIUNI_ARG(array_of_statuses), MPI_SUCCESS) 439 #define MPI_Comm_group(comm, group) (MPIUNI_ARG(comm), *group = 1, MPI_SUCCESS) 440 #define MPI_Group_excl(group, n, ranks, newgroup) (MPIUNI_ARG(group), MPIUNI_ARG(n), MPIUNI_ARG(ranks), MPIUNI_ARG(newgroup), MPI_SUCCESS) 441 #define MPI_Group_incl(group, n, ranks, newgroup) (MPIUNI_ARG(group), MPIUNI_ARG(n), MPIUNI_ARG(ranks), MPIUNI_ARG(newgroup), MPI_SUCCESS) 442 #define MPI_Testsome(incount, array_of_requests, outcount, array_of_indices, array_of_statuses) (MPIUNI_ARG(incount), MPIUNI_ARG(array_of_requests), MPIUNI_ARG(outcount), MPIUNI_ARG(array_of_indices), MPIUNI_ARG(array_of_statuses), MPI_SUCCESS) 443 #define MPI_Iprobe(source, tag, comm, flag, status) (MPIUNI_ARG(source), MPIUNI_ARG(tag), MPIUNI_ARG(comm), *(flag) = 0, MPIUNI_ARG(status), MPI_SUCCESS) 444 #define MPI_Probe(source, tag, comm, status) (MPIUNI_ARG(source), MPIUNI_ARG(tag), MPIUNI_ARG(comm), MPIUNI_ARG(status), MPI_SUCCESS) 445 #define MPI_Cancel(request) (MPIUNI_ARG(request), MPI_SUCCESS) 446 #define MPI_Test_cancelled(status, flag) (MPIUNI_ARG(status), *(flag) = 0, MPI_SUCCESS) 447 #define MPI_Send_init_c MPI_Send_init 448 #define MPI_Send_init(buf, count, datatype, dest, tag, comm, request) (MPIUNI_ARG(buf), MPIUNI_ARG(count), MPIUNI_ARG(datatype), MPIUNI_ARG(dest), MPIUNI_ARG(tag), MPIUNI_ARG(comm), MPIUNI_ARG(request), MPI_SUCCESS) 449 #define MPI_Bsend_init(buf, count, datatype, dest, tag, comm, request) (MPIUNI_ARG(buf), MPIUNI_ARG(count), MPIUNI_ARG(datatype), MPIUNI_ARG(dest), MPIUNI_ARG(tag), MPIUNI_ARG(comm), MPIUNI_ARG(request), MPI_SUCCESS) 450 #define MPI_Ssend_init(buf, count, datatype, dest, tag, comm, request) (MPIUNI_ARG(buf), MPIUNI_ARG(count), MPIUNI_ARG(datatype), MPIUNI_ARG(dest), MPIUNI_ARG(tag), MPIUNI_ARG(comm), MPIUNI_ARG(request), MPI_SUCCESS) 451 #define MPI_Bsend_init(buf, count, datatype, dest, tag, comm, request) (MPIUNI_ARG(buf), MPIUNI_ARG(count), MPIUNI_ARG(datatype), MPIUNI_ARG(dest), MPIUNI_ARG(tag), MPIUNI_ARG(comm), MPIUNI_ARG(request), MPI_SUCCESS) 452 #define MPI_Rsend_init(buf, count, datatype, dest, tag, comm, request) (MPIUNI_ARG(buf), MPIUNI_ARG(count), MPIUNI_ARG(datatype), MPIUNI_ARG(dest), MPIUNI_ARG(tag), MPIUNI_ARG(comm), MPIUNI_ARG(request), MPI_SUCCESS) 453 #define MPI_Recv_init_c MPI_Recv_init 454 #define MPI_Recv_init(buf, count, datatype, source, tag, comm, request) (MPIUNI_ARG(buf), MPIUNI_ARG(count), MPIUNI_ARG(datatype), MPIUNI_ARG(source), MPIUNI_ARG(tag), MPIUNI_ARG(comm), MPIUNI_ARG(request), MPI_SUCCESS) 455 #define MPI_Start(request) (MPIUNI_ARG(request), MPI_SUCCESS) 456 #define MPI_Startall(count, array_of_requests) (MPIUNI_ARG(count), MPIUNI_ARG(array_of_requests), MPI_SUCCESS) 457 #define MPI_Sendrecv(sendbuf, sendcount, sendtype, dest, sendtag, recvbuf, recvcount, recvtype, source, recvtag, comm, status) \ 458 (MPIUNI_ARG(dest), MPIUNI_ARG(sendtag), MPIUNI_ARG(recvcount), MPIUNI_ARG(recvtype), MPIUNI_ARG(source), MPIUNI_ARG(recvtag), MPIUNI_ARG(comm), MPIUNI_ARG(status), MPIUNI_Memcpy(recvbuf, sendbuf, (sendcount) * MPI_sizeof(sendtype))) 459 #define MPI_Sendrecv_replace(buf, count, datatype, dest, sendtag, source, recvtag, comm, status) \ 460 (MPIUNI_ARG(buf), MPIUNI_ARG(count), MPIUNI_ARG(datatype), MPIUNI_ARG(dest), MPIUNI_ARG(sendtag), MPIUNI_ARG(source), MPIUNI_ARG(recvtag), MPIUNI_ARG(comm), MPIUNI_ARG(status), MPI_SUCCESS) 461 462 #define MPI_COMBINER_NAMED 0 463 #define MPI_COMBINER_DUP 1 464 #define MPI_COMBINER_CONTIGUOUS 2 465 /* 32-bit packing scheme: [combiner:4 | type-index:8 | count:12 | base-bytes:8] */ 466 #define MPI_Type_dup(oldtype, newtype) (*(newtype) = oldtype, MPI_SUCCESS) 467 #define MPI_Type_contiguous(count, oldtype, newtype) (*(newtype) = (MPI_COMBINER_CONTIGUOUS << 28) | ((oldtype) & 0x0ff00000) | (((oldtype) >> 8 & 0xfff) * (count)) << 8 | ((oldtype) & 0xff), MPI_SUCCESS) 468 #define MPI_Type_vector(count, blocklength, stride, oldtype, newtype) (MPIUNI_ARG(count), MPIUNI_ARG(blocklength), MPIUNI_ARG(stride), MPIUNI_ARG(oldtype), MPIUNI_ARG(newtype), MPIUni_Abort(MPI_COMM_WORLD, 0)) 469 #define MPI_Type_hvector(count, blocklength, stride, oldtype, newtype) (MPIUNI_ARG(count), MPIUNI_ARG(blocklength), MPIUNI_ARG(stride), MPIUNI_ARG(oldtype), MPIUNI_ARG(newtype), MPIUni_Abort(MPI_COMM_WORLD, 0)) 470 #define MPI_Type_indexed(count, array_of_blocklengths, array_of_displacements, oldtype, newtype) \ 471 (MPIUNI_ARG(count), MPIUNI_ARG(array_of_blocklengths), MPIUNI_ARG(array_of_displacements), MPIUNI_ARG(oldtype), MPIUNI_ARG(newtype), MPIUni_Abort(MPI_COMM_WORLD, 0)) 472 #define MPI_Type_hindexed(count, array_of_blocklengths, array_of_displacements, oldtype, newtype) \ 473 (MPIUNI_ARG(count), MPIUNI_ARG(array_of_blocklengths), MPIUNI_ARG(array_of_displacements), MPIUNI_ARG(oldtype), MPIUNI_ARG(newtype), MPIUni_Abort(MPI_COMM_WORLD, 0)) 474 #define MPI_Type_create_struct(count, array_of_blocklengths, array_of_displacements, array_of_types, newtype) \ 475 (MPIUNI_ARG(count), MPIUNI_ARG(array_of_blocklengths), MPIUNI_ARG(array_of_displacements), MPIUNI_ARG(array_of_types), MPIUNI_ARG(newtype), MPIUni_Abort(MPI_COMM_WORLD, 0)) 476 #define MPI_Address(location, address) (*(address) = (MPI_Aint)((char *)(location)), MPI_SUCCESS) 477 #define MPI_Type_size(datatype, size) (*(size) = MPI_sizeof(datatype), MPI_SUCCESS) 478 #define MPI_Type_lb(datatype, lb) (MPIUNI_ARG(datatype), *(lb) = 0, MPI_SUCCESS) 479 #define MPI_Type_ub(datatype, ub) (*(ub) = MPI_sizeof(datatype), MPI_SUCCESS) 480 #define MPI_Type_extent(datatype, extent) (*(extent) = MPI_sizeof(datatype), MPI_SUCCESS) 481 #define MPI_Type_get_extent(datatype, lb, extent) (*(lb) = 0, *(extent) = MPI_sizeof(datatype), MPI_SUCCESS) 482 #define MPI_Type_get_true_extent(datatype, lb, extent) (*(lb) = 0, *(extent) = MPI_sizeof(datatype), MPI_SUCCESS) 483 #define MPI_Type_commit(datatype) (MPIUNI_ARG(datatype), MPI_SUCCESS) 484 #define MPI_Type_free(datatype) (*(datatype) = MPI_DATATYPE_NULL, MPI_SUCCESS) 485 #define MPI_Get_elements(status, datatype, count) (MPIUNI_ARG(status), MPIUNI_ARG(datatype), MPIUNI_ARG(count), MPIUni_Abort(MPI_COMM_WORLD, 0)) 486 #define MPI_Pack(inbuf, incount, datatype, outbuf, outsize, position, comm) \ 487 (MPIUNI_ARG(inbuf), MPIUNI_ARG(incount), MPIUNI_ARG(datatype), MPIUNI_ARG(outbuf), MPIUNI_ARG(outsize), MPIUNI_ARG(position), MPIUNI_ARG(comm), MPIUni_Abort(MPI_COMM_WORLD, 0)) 488 #define MPI_Unpack(inbuf, insize, position, outbuf, outcount, datatype, comm) \ 489 (MPIUNI_ARG(inbuf), MPIUNI_ARG(insize), MPIUNI_ARG(position), MPIUNI_ARG(outbuf), MPIUNI_ARG(outcount), MPIUNI_ARG(datatype), MPIUNI_ARG(comm), MPIUni_Abort(MPI_COMM_WORLD, 0)) 490 #define MPI_Pack_size(incount, datatype, comm, size) (MPIUNI_ARG(incount), MPIUNI_ARG(datatype), MPIUNI_ARG(comm), MPIUNI_ARG(size), MPIUni_Abort(MPI_COMM_WORLD, 0)) 491 #define MPI_Barrier(comm) (MPIUNI_ARG(comm), MPI_SUCCESS) 492 #define MPI_Bcast(buffer, count, datatype, root, comm) (MPIUNI_ARG(buffer), MPIUNI_ARG(count), MPIUNI_ARG(datatype), MPIUNI_ARG(root), MPIUNI_ARG(comm), MPI_SUCCESS) 493 #define MPI_Gather(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, root, comm) (MPIUNI_ARG(recvcount), MPIUNI_ARG(root), MPIUNI_ARG(recvtype), MPIUNI_ARG(comm), MPIUNI_Memcpy(recvbuf, sendbuf, (sendcount) * MPI_sizeof(sendtype))) 494 #define MPI_Gatherv(sendbuf, sendcount, sendtype, recvbuf, recvcounts, displs, recvtype, root, comm) \ 495 (MPIUNI_ARG(recvcounts), MPIUNI_ARG(displs), MPIUNI_ARG(recvtype), MPIUNI_ARG(root), MPIUNI_ARG(comm), MPIUNI_Memcpy(recvbuf, sendbuf, (sendcount) * MPI_sizeof(sendtype))) 496 #define MPI_Gatherv_c(sendbuf, sendcount, sendtype, recvbuf, recvcounts, displs, recvtype, root, comm) \ 497 (MPIUNI_ARG(recvcounts), MPIUNI_ARG(displs), MPIUNI_ARG(recvtype), MPIUNI_ARG(root), MPIUNI_ARG(comm), MPIUNI_Memcpy(recvbuf, sendbuf, (sendcount) * MPI_sizeof(sendtype))) 498 #define MPI_Scatter(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, root, comm) \ 499 (MPIUNI_ARG(sendcount), MPIUNI_ARG(sendtype), MPIUNI_ARG(recvbuf), MPIUNI_ARG(recvtype), MPIUNI_ARG(root), MPIUNI_ARG(comm), MPIUNI_Memcpy(recvbuf, sendbuf, (recvcount) * MPI_sizeof(recvtype))) 500 #define MPI_Scatterv(sendbuf, sendcounts, displs, sendtype, recvbuf, recvcount, recvtype, root, comm) \ 501 (MPIUNI_ARG(displs), MPIUNI_ARG(sendtype), MPIUNI_ARG(sendcounts), MPIUNI_ARG(root), MPIUNI_ARG(comm), MPIUNI_Memcpy(recvbuf, sendbuf, (recvcount) * MPI_sizeof(recvtype))) 502 #define MPI_Scatterv_c(sendbuf, sendcounts, displs, sendtype, recvbuf, recvcount, recvtype, root, comm) \ 503 (MPIUNI_ARG(displs), MPIUNI_ARG(sendtype), MPIUNI_ARG(sendcounts), MPIUNI_ARG(root), MPIUNI_ARG(comm), MPIUNI_Memcpy(recvbuf, sendbuf, (recvcount) * MPI_sizeof(recvtype))) 504 #define MPI_Allgather(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, comm) (MPIUNI_ARG(recvcount), MPIUNI_ARG(recvtype), MPIUNI_ARG(comm), MPIUNI_Memcpy(recvbuf, sendbuf, (sendcount) * MPI_sizeof(sendtype))) 505 #define MPI_Allgatherv(sendbuf, sendcount, sendtype, recvbuf, recvcounts, displs, recvtype, comm) \ 506 (MPIUNI_ARG(recvcounts), MPIUNI_ARG(displs), MPIUNI_ARG(recvtype), MPIUNI_ARG(comm), MPIUNI_Memcpy(recvbuf, sendbuf, (sendcount) * MPI_sizeof(sendtype))) 507 #define MPI_Alltoall(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, comm) (MPIUNI_ARG(recvcount), MPIUNI_ARG(recvtype), MPIUNI_ARG(comm), MPIUNI_Memcpy(recvbuf, sendbuf, (sendcount) * MPI_sizeof(sendtype))) 508 #define MPI_Alltoallv(sendbuf, sendcounts, sdispls, sendtype, recvbuf, recvcounts, rdispls, recvtype, comm) \ 509 (MPIUNI_ARG(sendbuf), MPIUNI_ARG(sendcounts), MPIUNI_ARG(sdispls), MPIUNI_ARG(sendtype), MPIUNI_ARG(recvbuf), MPIUNI_ARG(recvcounts), MPIUNI_ARG(rdispls), MPIUNI_ARG(recvtype), MPIUNI_ARG(comm), MPIUni_Abort(MPI_COMM_WORLD, 0)) 510 #define MPI_Alltoallw(sendbuf, sendcounts, sdispls, sendtypes, recvbuf, recvcounts, rdispls, recvtypes, comm) \ 511 (MPIUNI_ARG(sendbuf), MPIUNI_ARG(sendcounts), MPIUNI_ARG(sdispls), MPIUNI_ARG(sendtypes), MPIUNI_ARG(recvbuf), MPIUNI_ARG(recvcount), MPIUNI_ARG(rdispls), MPIUNI_ARG(recvtypes), MPIUNI_ARG(comm), MPIUni_Abort(MPI_COMM_WORLD, 0)) 512 #define MPI_Reduce_c MPI_Reduce_c 513 #define MPI_Reduce(sendbuf, recvbuf, count, datatype, op, root, comm) (MPIUNI_ARG(op), MPIUNI_ARG(root), MPIUNI_ARG(comm), MPIUNI_Memcpy(recvbuf, sendbuf, (count) * MPI_sizeof(datatype))) 514 #define MPI_Reduce_local_c MPI_Reduce_local 515 #define MPI_Reduce_local(sendbuf, recvbuf, count, datatype, op) (MPIUNI_ARG(op), MPIUNI_Memcpy(recvbuf, sendbuf, (count) * MPI_sizeof(datatype))) 516 #define MPI_Allreduce_c MPI_Allreduce 517 #define MPI_Allreduce(sendbuf, recvbuf, count, datatype, op, comm) (MPIUNI_ARG(op), MPIUNI_ARG(comm), MPIUNI_Memcpy(recvbuf, sendbuf, (count) * MPI_sizeof(datatype)), 0) 518 #define MPI_Iallreduce(sendbuf, recvbuf, count, datatype, op, comm, request) (MPIUNI_ARG(op), MPIUNI_ARG(comm), MPIUNI_ARG(request), MPIUNI_Memcpy(recvbuf, sendbuf, (count) * MPI_sizeof(datatype)), 0) 519 #define MPI_Scan(sendbuf, recvbuf, count, datatype, op, comm) (MPIUNI_ARG(op), MPIUNI_ARG(comm), MPIUNI_Memcpy(recvbuf, sendbuf, (count) * MPI_sizeof(datatype)), 0) 520 #define MPI_Exscan(sendbuf, recvbuf, count, datatype, op, comm) (MPIUNI_ARG(sendbuf), MPIUNI_ARG(recvbuf), MPIUNI_ARG(count), MPIUNI_ARG(datatype), MPIUNI_ARG(op), MPIUNI_ARG(comm), MPI_SUCCESS) 521 #define MPI_Reduce_scatter(sendbuf, recvbuf, recvcounts, datatype, op, comm) (MPIUNI_ARG(op), MPIUNI_ARG(comm), MPIUNI_Memcpy(recvbuf, sendbuf, (*recvcounts) * MPI_sizeof(datatype)), 0) 522 #define MPI_Op_create(function, commute, op) (MPIUNI_ARG(function), MPIUNI_ARG(commute), MPIUNI_ARG(op), MPI_SUCCESS) 523 #define MPI_Op_free(op) (*(op) = MPI_OP_NULL, MPI_SUCCESS) 524 525 #define MPI_Group_size(group, size) (MPIUNI_ARG(group), *(size) = 1, MPI_SUCCESS) 526 #define MPI_Group_rank(group, rank) (MPIUNI_ARG(group), *(rank) = 0, MPI_SUCCESS) 527 #define MPI_Group_translate_ranks(group1, n, ranks1, group2, ranks2) (MPIUNI_ARG(group1), MPIUNI_ARG(group2), MPIUNI_Memcpy((ranks2), (ranks1), (n) * MPI_sizeof(MPI_INT))) 528 #define MPI_Group_compare(group1, group2, result) (MPIUNI_ARG(group1), MPIUNI_ARG(group2), *(result) = 1, MPI_SUCCESS) 529 #define MPI_Group_union(group1, group2, newgroup) (MPIUNI_ARG(group1), MPIUNI_ARG(group2), *(newgroup) = 1, MPI_SUCCESS) 530 #define MPI_Group_intersection(group1, group2, newgroup) (MPIUNI_ARG(group1), MPIUNI_ARG(group2), *(newgroup) = 1, MPI_SUCCESS) 531 #define MPI_Group_difference(group1, group2, newgroup) (MPIUNI_ARG(group1), MPIUNI_ARG(group2), *(newgroup) = MPI_GROUP_EMPTY, MPI_SUCCESS) 532 #define MPI_Group_range_incl(group, n, ranges, newgroup) (MPIUNI_ARG(group), MPIUNI_ARG(n), MPIUNI_ARG(ranges), *(newgroup) = 1, MPI_SUCCESS) 533 #define MPI_Group_range_excl(group, n, ranges, newgroup) (MPIUNI_ARG(group), MPIUNI_ARG(n), MPIUNI_ARG(ranges), *(newgroup) = MPI_GROUP_EMPTY, MPI_SUCCESS) 534 #define MPI_Group_free(group) (*(group) = MPI_GROUP_NULL, MPI_SUCCESS) 535 536 #define MPI_Comm_compare(comm1, comm2, result) (MPIUNI_ARG(comm1), MPIUNI_ARG(comm2), *(result) = MPI_IDENT, MPI_SUCCESS) 537 #define MPI_Comm_split(comm, color, key, newcomm) (MPIUNI_ARG(color), MPIUNI_ARG(key), MPI_Comm_dup(comm, newcomm)) 538 #define MPI_Comm_split_type(comm, color, key, info, newcomm) (MPIUNI_ARG(color), MPIUNI_ARG(key), MPIUNI_ARG(info), MPI_Comm_dup(comm, newcomm)) 539 #define MPI_Comm_test_inter(comm, flag) (*(flag) = 1, MPI_SUCCESS) 540 #define MPI_Comm_remote_size(comm, size) (*(size) = 1, MPI_SUCCESS) 541 #define MPI_Comm_remote_group(comm, group) MPI_SUCCESS 542 #define MPI_Intercomm_create(local_comm, local_leader, peer_comm, remote_leader, tag, newintercomm) MPI_SUCCESS 543 #define MPI_Intercomm_merge(intercomm, high, newintracomm) MPI_SUCCESS 544 #define MPI_Topo_test(comm, flag) MPI_SUCCESS 545 #define MPI_Cart_create(comm_old, ndims, dims, periods, reorder, comm_cart) MPIUni_Abort(MPI_COMM_WORLD, 0) 546 #define MPI_Dims_create(nnodes, ndims, dims) MPIUni_Abort(MPI_COMM_WORLD, 0) 547 #define MPI_Graph_create(comm, a, b, c, d, e) MPIUni_Abort(MPI_COMM_WORLD, 0) 548 #define MPI_Graphdims_Get(comm, nnodes, nedges) MPIUni_Abort(MPI_COMM_WORLD, 0) 549 #define MPI_Graph_get(comm, a, b, c, d) MPIUni_Abort(MPI_COMM_WORLD, 0) 550 #define MPI_Cartdim_get(comm, ndims) MPIUni_Abort(MPI_COMM_WORLD, 0) 551 #define MPI_Cart_get(comm, maxdims, dims, periods, coords) MPIUni_Abort(MPI_COMM_WORLD, 0) 552 #define MPI_Cart_rank(comm, coords, rank) MPIUni_Abort(MPI_COMM_WORLD, 0) 553 #define MPI_Cart_coords(comm, rank, maxdims, coords) MPIUni_Abort(MPI_COMM_WORLD, 0) 554 #define MPI_Graph_neighbors_count(comm, rank, nneighbors) MPIUni_Abort(MPI_COMM_WORLD, 0) 555 #define MPI_Graph_neighbors(comm, rank, maxneighbors, neighbors) MPIUni_Abort(MPI_COMM_WORLD, 0) 556 #define MPI_Cart_shift(comm, direction, disp, rank_source, rank_dest) MPIUni_Abort(MPI_COMM_WORLD, 0) 557 #define MPI_Cart_sub(comm, remain_dims, newcomm) MPIUni_Abort(MPI_COMM_WORLD, 0) 558 #define MPI_Cart_map(comm, ndims, dims, periods, newrank) MPIUni_Abort(MPI_COMM_WORLD, 0) 559 #define MPI_Graph_map(comm, a, b, c, d) MPIUni_Abort(MPI_COMM_WORLD, 0) 560 561 #define MPI_Get_processor_name(name, result_len) (*(result_len) = 9, MPIUNI_Memcpy(name, "localhost", 10 * MPI_sizeof(MPI_CHAR))) 562 #define MPI_Comm_create_errhandler(function, errhandler) (MPIUNI_ARG(function), *(errhandler) = MPI_ERRORS_RETURN, MPI_SUCCESS) 563 #define MPI_Comm_set_errhandler(comm, errhandler) (MPIUNI_ARG(comm), MPIUNI_ARG(errhandler), MPI_SUCCESS) 564 #define MPI_Comm_get_errhandler(comm, errhandler) (MPIUNI_ARG(comm), (*errhandler) = MPI_ERRORS_RETURN, MPI_SUCCESS) 565 #define MPI_Errhandler_free(errhandler) (*(errhandler) = MPI_ERRHANDLER_NULL, MPI_SUCCESS) 566 #define MPI_Error_string(errorcode, string, result_len) \ 567 (MPIUNI_ARG(errorcode), (errorcode == MPI_ERR_NOSUPPORT) ? (*(result_len) = 35, MPIUNI_Memcpy(string, "MPI error, not supported by MPI-uni", 35 * MPI_sizeof(MPI_CHAR))) : (*(result_len) = 9, MPIUNI_Memcpy(string, "MPI error", 9 * MPI_sizeof(MPI_CHAR)))) 568 #define MPI_Error_class(errorcode, errorclass) (*(errorclass) = errorcode, MPI_SUCCESS) 569 #define MPI_Wtick() 1.0 570 #define MPI_Pcontrol(level) MPI_SUCCESS 571 572 /* Support for MPI-IO */ 573 574 typedef int MPI_File; 575 #define MPI_FILE_NULL 0 576 577 typedef int MPI_Offset; 578 579 #define MPI_MODE_RDONLY 0 580 #define MPI_MODE_WRONLY 0 581 #define MPI_MODE_CREATE 0 582 583 #define MPI_File_open(comm, filename, amode, info, mpi_fh) (MPIUNI_ARG(comm), MPIUNI_ARG(filename), MPIUNI_ARG(amode), MPIUNI_ARG(info), MPIUNI_ARG(mpi_fh), MPIUni_Abort(MPI_COMM_WORLD, 0)) 584 585 #define MPI_File_close(mpi_fh) (MPIUNI_ARG(mpi_fh), MPIUni_Abort(MPI_COMM_WORLD, 0)) 586 587 #define MPI_File_set_view(mpi_fh, disp, etype, filetype, datarep, info) (MPIUNI_ARG(mpi_fh), MPIUNI_ARG(disp), MPIUNI_ARG(etype), MPIUNI_ARG(filetype), MPIUNI_ARG(datarep), MPIUNI_ARG(info), MPIUni_Abort(MPI_COMM_WORLD, 0)) 588 589 #define MPI_File_write_all(mpi_fh, buf, count, datatype, status) (MPIUNI_ARG(mpi_fh), MPIUNI_ARG(buf), MPIUNI_ARG(count), MPIUNI_ARG(datatype), MPIUNI_ARG(status), MPIUni_Abort(MPI_COMM_WORLD, 0)) 590 591 #define MPI_File_read_all(mpi_fh, buf, count, datatype, status) (MPIUNI_ARG(mpi_fh), MPIUNI_ARG(buf), MPIUNI_ARG(count), MPIUNI_ARG(datatype), MPIUNI_ARG(status), MPIUni_Abort(MPI_COMM_WORLD, 0)) 592 593 #define MPI_File_write_at(mpi_fh, off, buf, count, datatype, status) (MPIUNI_ARG(mpi_fh), MPIUNI_ARG(off), MPIUNI_ARG(buf), MPIUNI_ARG(count), MPIUNI_ARG(datatype), MPIUNI_ARG(status), MPIUni_Abort(MPI_COMM_WORLD, 0)) 594 595 #define MPI_File_read_at(mpi_fh, off, buf, count, datatype, status) (MPIUNI_ARG(mpi_fh), MPIUNI_ARG(off), MPIUNI_ARG(buf), MPIUNI_ARG(count), MPIUNI_ARG(datatype), MPIUNI_ARG(status), MPIUni_Abort(MPI_COMM_WORLD, 0)) 596 597 #define MPI_File_write_at_all(mpi_fh, off, buf, count, datatype, status) (MPIUNI_ARG(mpi_fh), MPIUNI_ARG(off), MPIUNI_ARG(buf), MPIUNI_ARG(count), MPIUNI_ARG(datatype), MPIUNI_ARG(status), MPIUni_Abort(MPI_COMM_WORLD, 0)) 598 599 #define MPI_File_read_at_all(mpi_fh, off, buf, count, datatype, status) (MPIUNI_ARG(mpi_fh), MPIUNI_ARG(off), MPIUNI_ARG(buf), MPIUNI_ARG(count), MPIUNI_ARG(datatype), MPIUNI_ARG(status), MPIUni_Abort(MPI_COMM_WORLD, 0)) 600 601 /* called from PetscInitialize() - so return success */ 602 #define MPI_Register_datarep(name, read_conv_fn, write_conv_fn, extent_fn, state) (MPIUNI_ARG(name), MPIUNI_ARG(read_conv_fn), MPIUNI_ARG(write_conv_fn), MPIUNI_ARG(extent_fn), MPIUNI_ARG(state), MPI_SUCCESS) 603 604 #define MPI_Type_create_subarray(ndims, array_of_sizes, array_of_subsizes, array_of_starts, order, oldtype, newtype) \ 605 (MPIUNI_ARG(ndims), MPIUNI_ARG(array_of_sizes), MPIUNI_ARG(array_of_subsizes), MPIUNI_ARG(array_of_starts), MPIUNI_ARG(order), MPIUNI_ARG(oldtype), MPIUNI_ARG(newtype), MPIUni_Abort(MPI_COMM_WORLD, 0)) 606 607 #define MPI_Type_create_resized(oldtype, lb, extent, newtype) (MPIUNI_ARG(oldtype), MPIUNI_ARG(lb), MPIUNI_ARG(extent), MPIUNI_ARG(newtype), MPIUni_Abort(MPI_COMM_WORLD, 0)) 608 609 #define MPI_Type_create_indexed_block(count, blocklength, array_of_displacements, oldtype, newtype) \ 610 (MPIUNI_ARG(count), MPIUNI_ARG(blocklength), MPIUNI_ARG(array_of_displacements), MPIUNI_ARG(oldtype), MPIUNI_ARG(newtype), MPIUni_Abort(MPI_COMM_WORLD, 0)) 611 612 #if defined(__cplusplus) 613 } 614 #endif 615 #endif 616