00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042 #include "RTOp_MPI_config.h"
00043
00044 #ifndef RTOp_USE_MPI
00045
00046 int MPI_Init(int *argc, char ***argv)
00047 {
00048 return 0;
00049 }
00050
00051 int MPI_Finalize(void)
00052 {
00053 return 0;
00054 }
00055
00056 int MPI_Comm_size(MPI_Comm comm, int *size)
00057 {
00058 *size = 1;
00059 return 0;
00060 }
00061
00062 int MPI_Comm_rank(MPI_Comm comm, int *rank)
00063 {
00064 *rank = 0;
00065 return 0;
00066 }
00067
00068 int MPI_Type_struct(int count , int *array_of_blocklengths, MPI_Aint *array_of_displacements
00069 , MPI_Datatype *array_of_types, MPI_Datatype *data_type)
00070 {
00071
00072 int len = 0, extent = 0, k = 0;
00073 for( k = 0; k < count; ++k ) {
00074 switch( array_of_types[k] ) {
00075 case MPI_CHAR:
00076 len = sizeof(char);
00077 break;
00078 case MPI_INT:
00079 len = sizeof(int);
00080 break;
00081 case MPI_FLOAT:
00082 len = sizeof(float);
00083 break;
00084 case MPI_DOUBLE:
00085 len = sizeof(double);
00086 break;
00087 default:
00088 assert(0);
00089 }
00090 len = array_of_displacements[k] + array_of_blocklengths[k] * len;
00091 if( len > extent )
00092 extent = len;
00093 }
00094 *data_type = extent;
00095 return 0;
00096 }
00097
00098 int MPI_Type_commit(MPI_Datatype *datatype)
00099 {
00100 return 0;
00101 }
00102
00103 int MPI_Type_free(MPI_Datatype *op)
00104 {
00105 *op = MPI_DATATYPE_NULL;
00106 return 0;
00107 }
00108
00109 int MPI_Op_create(MPI_User_function *func, int communitive, MPI_Op *op)
00110 {
00111 *op = (MPI_Op)*func;
00112 return 0;
00113 }
00114 int MPI_Op_free( MPI_Op *op)
00115 {
00116 *op = MPI_OP_NULL;
00117 return 0;
00118 }
00119
00120 int MPI_Send(void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm)
00121 {
00122 assert(0);
00123 return 0;
00124 }
00125 int MPI_Recv(void* buf, int count, MPI_Datatype datatype, int source, int tag, MPI_Comm comm, MPI_Status* status)
00126 {
00127 assert(0);
00128 return 0;
00129 }
00130
00131 int MPI_Sendrecv_replace(void* buff, int count, MPI_Datatype datatype, int dest, int sendtag, int source, int recvtag, MPI_Comm comm, MPI_Status* status)
00132 {
00133 assert(0);
00134 return 0;
00135 }
00136
00137 int MPI_Reduce(void* sendbuf, void* recvbuf, int count, MPI_Datatype datatype, MPI_Op op
00138 , int root, MPI_Comm comm)
00139 {
00140 char
00141 *_sendbuf = sendbuf,
00142 *_recvbuf = recvbuf;
00143 int k;
00144 for( k = 0; k < count * datatype; ++k )
00145 _recvbuf[k] =_sendbuf[k];
00146 return 0;
00147 }
00148
00149 int MPI_Allreduce(void* sendbuf, void* recvbuf, int count, MPI_Datatype datatype
00150 , MPI_Op op, MPI_Comm comm)
00151 {
00152 char
00153 *_sendbuf = sendbuf,
00154 *_recvbuf = recvbuf;
00155 int k;
00156 for( k = 0; k < count * datatype; ++k )
00157 _recvbuf[k] =_sendbuf[k];
00158 return 0;
00159 }
00160
00161 int MPI_Barrier(MPI_Comm comm)
00162 {
00163 return 0;
00164 }
00165
00166 int MPI_Bcast(void* buffer, int count, MPI_Datatype datatype, int root, MPI_Comm comm )
00167 {
00168 return 0;
00169 }
00170
00171 int MPI_Gather(void* sendbuf, int sendcount, MPI_Datatype sendtype
00172 , void* recvbuf, int recvcount, MPI_Datatype recvtype, int root , MPI_Comm comm )
00173 {
00174 char
00175 *_sendbuf = sendbuf,
00176 *_recvbuf = recvbuf;
00177 int k;
00178 assert(sendtype == recvtype);
00179 assert(sendcount == recvcount);
00180 for( k = 0; k < sendcount * sendtype; ++k )
00181 _recvbuf[k] =_sendbuf[k];
00182 return 0;
00183 }
00184
00185 #endif