1/* 2 (C) 2007 by Argonne National Laboratory. 3 See COPYRIGHT in top-level directory. 4*/ 5#if !defined( _MPI_NULL ) 6#define _MPI_NULL 7/* 8 A Serial MPI implementation for non-MPI program. 9*/ 10/* Keep C++ compilers from getting confused */ 11#if defined(__cplusplus) 12extern "C" { 13#endif 14 15#if !defined( _MPI_NULL_MPI_COMM ) 16#define _MPI_NULL_MPI_COMM 17typedef int MPI_Comm; 18#endif 19#define MPI_COMM_NULL ((MPI_Comm)-1) 20#define MPI_COMM_WORLD ((MPI_Comm)0) 21#define MPI_COMM_SELF ((MPI_Comm)1) 22 23typedef int (MPI_Comm_copy_attr_function)(MPI_Comm, int, void *, void *, 24 void *, int *); 25#define MPI_COMM_NULL_COPY_FN ((MPI_Comm_copy_attr_function*)0) 26 27typedef int (MPI_Comm_delete_attr_function)(MPI_Comm, int, void *, void *); 28#define MPI_COMM_NULL_DELETE_FN ((MPI_Comm_delete_attr_function*)0) 29 30/* A convenient trick to account for total message size in send/recv */ 31typedef int MPI_Datatype; 32#define MPI_CHAR ((MPI_Datatype)sizeof(char)) 33#define MPI_BYTE ((MPI_Datatype)sizeof(char)) 34#define MPI_INT ((MPI_Datatype)sizeof(int)) 35#define MPI_DOUBLE ((MPI_Datatype)sizeof(double)) 36 37typedef struct MPI_Status { 38 int count; 39 int cancelled; 40 int MPI_SOURCE; 41 int MPI_TAG; 42 int MPI_ERROR; 43} MPI_Status; 44 45typedef int MPI_Request; 46 47typedef int MPI_Op; 48#define MPI_MAX (MPI_Op)(0x58000001) 49#define MPI_MIN (MPI_Op)(0x58000002) 50#define MPI_SUM (MPI_Op)(0x58000003) 51 52extern int MPI_WTIME_IS_GLOBAL; 53/* Pre-defined constants */ 54#define MPI_UNDEFINED (-32766) 55#define MPI_KEYVAL_INVALID 0x24000000 56#define MPI_MAX_PROCESSOR_NAME 128 57 58#define MPI_PROC_NULL (-1) 59#define MPI_ANY_SOURCE (-2) 60#define MPI_ROOT (-3) 61#define MPI_ANY_TAG (-1) 62 63/* MPI's error classes */ 64#define MPI_SUCCESS 0 /* Successful return code */ 65#define MPI_ERR_COMM 5 /* Invalid communicator */ 66#define MPI_ERR_INTERN 16 /* Internal error code */ 67#define MPI_ERR_NO_MEM 34 68#define MPI_ERR_KEYVAL 48 /* Erroneous attribute key */ 69 70int PMPI_Init( int *argc, char ***argv ); 71 72int PMPI_Finalize( void ); 73 74int PMPI_Abort( MPI_Comm comm, int errorcode ); 75 76int PMPI_Initialized( int *flag ); 77 78int PMPI_Get_processor_name( char *name, int *resultlen ); 79 80int PMPI_Comm_size( MPI_Comm comm, int *size ); 81 82int PMPI_Comm_rank( MPI_Comm comm, int *rank ); 83 84double PMPI_Wtime( void ); 85 86int PMPI_Comm_create_keyval( MPI_Comm_copy_attr_function *comm_copy_attr_fn, 87 MPI_Comm_delete_attr_function *comm_delete_attr_fn, 88 int *comm_keyval, void *extra_state ); 89 90int PMPI_Comm_free_keyval( int *comm_keyval ); 91 92int PMPI_Comm_set_attr( MPI_Comm comm, int comm_keyval, 93 void *attribute_val ); 94 95int PMPI_Comm_get_attr( MPI_Comm comm, int comm_keyval, 96 void *attribute_val, int *flag ); 97 98int PMPI_Comm_test_inter( MPI_Comm comm, int *flag ); 99 100int PMPI_Ssend( void *buf, int count, MPI_Datatype datatype, int dest, 101 int tag, MPI_Comm comm ); 102 103int PMPI_Send( void *buf, int count, MPI_Datatype datatype, int dest, 104 int tag, MPI_Comm comm ); 105 106int PMPI_Recv( void *buf, int count, MPI_Datatype datatype, int source, 107 int tag, MPI_Comm comm, MPI_Status *status ); 108 109int PMPI_Irecv( void *buf, int count, MPI_Datatype datatype, int source, 110 int tag, MPI_Comm comm, MPI_Request *request ); 111 112int PMPI_Wait( MPI_Request *request, MPI_Status *status ); 113 114int PMPI_Get_count( MPI_Status *status, MPI_Datatype datatype, int *count ); 115 116int PMPI_Barrier( MPI_Comm comm ); 117 118int PMPI_Bcast( void *buffer, int count, MPI_Datatype datatype, 119 int root, MPI_Comm comm ); 120 121int PMPI_Scan( void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, 122 MPI_Op op, MPI_Comm comm ); 123 124int PMPI_Scatter( void *sendbuf, int sendcnt, MPI_Datatype sendtype, 125 void *recvbuf, int recvcnt, MPI_Datatype recvtype, 126 int root, MPI_Comm comm ); 127 128int PMPI_Gather( void *sendbuf, int sendcnt, MPI_Datatype sendtype, 129 void *recvbuf, int recvcnt, MPI_Datatype recvtype, 130 int root, MPI_Comm comm ); 131 132int PMPI_Allreduce( void *sendbuf, void *recvbuf, int count, 133 MPI_Datatype datatype, MPI_Op op, MPI_Comm comm ); 134 135#if defined(__cplusplus) 136} 137#endif 138 139#endif /* of _MPI_NULL */ 140