46 return(
sizeof(
double));
47 else if(
i == MPI_FLOAT)
48 return(
sizeof(
float));
53 else if(
i == MPI_CHAR)
69 void *buf,
int count, MPI_Datatype datatype,
int tag) {
71 Msg_Queue::iterator it;
72 if ( (it=recvQ.find( tag)) != recvQ.end()) {
74 std::memcpy( it->second, (
char*)buf, extent);
81 std::cerr <<
"Unsupported data type " << datatype
82 <<
" used for MPI_Isend" << std::endl;
89 void *buf,
int count, MPI_Datatype datatype,
int tag ) {
91 Msg_Queue::iterator it;
92 if ( (it=sendQ.find( tag)) != sendQ.end()) {
94 std::memcpy( buf, it->second, extent);
101 std::cerr <<
"Unsupported data type " << datatype
102 <<
" used for MPI_Irecv" << std::endl;
114 MPI_Comm comm, MPI_Request *request ) {
117 return MPI_Isend( buf, count, datatype, dest, tag, comm, request);
120 if ( sendQ == NULL) sendQ =
new Msg_Queue();
121 if ( recvQ == NULL) recvQ =
new Msg_Queue();
124 std::cerr <<
"Out of memory" << std::endl;
127 return COM_send( *sendQ, *recvQ, buf, count, datatype, tag);
133 MPI_Comm comm, MPI_Request *request ) {
136 return MPI_Irecv( buf, count, datatype, src, tag, comm, request);
139 if ( sendQ == NULL) sendQ =
new Msg_Queue();
140 if ( recvQ == NULL) recvQ =
new Msg_Queue();
143 std::cerr <<
"Out of memory" << std::endl;
146 return COM_recv( *sendQ, *recvQ, buf, count, datatype, tag);
152 int MPI_Isend(
void *buf,
int count, MPI_Datatype datatype,
154 MPI_Comm comm, MPI_Request *request ) {
155 return COMMPI_Isend( buf, count, datatype, dest, tag, comm, request);
159 int MPI_Irecv(
void *buf,
int count, MPI_Datatype datatype,
161 MPI_Comm comm, MPI_Request *request ) {
162 return COMMPI_Irecv( buf, count, datatype, src, tag, comm, request);
165 int MPI_Init(
int*,
char***) {
169 int MPI_Finalize() {
return 0;
170 if ( sendQ != NULL) {
delete sendQ; sendQ = NULL; }
171 if ( recvQ != NULL) {
delete recvQ; recvQ = NULL; }
175 int MPI_Allreduce(
void *sendbuf,
void *recvbuf,
int count,
176 MPI_Datatype datatype, MPI_Op op, MPI_Comm comm ) {
178 std::memcpy( recvbuf, sendbuf, count*
get_sizeof(datatype));
181 std::cerr <<
"Unsupported data type " << datatype
182 <<
" used for MPI_Allreduce" << std::endl;
188 int MPI_Allgather(
void *sendbuf,
int sendcount, MPI_Datatype sendtype,
189 void *recvbuf,
int recvcount, MPI_Datatype recvtype,
192 std::memcpy( recvbuf, sendbuf, sendcount*
get_sizeof(sendtype));
195 std::cerr <<
"Unsupported data type " << sendtype
196 <<
" used for MPI_Allgather" << std::endl;
202 int MPI_Allgatherv (
void *sendbuf,
int sendcount, MPI_Datatype sendtype,
203 void *recvbuf,
int *recvcounts,
int *displs,
204 MPI_Datatype recvtype, MPI_Comm comm ) {
206 std::memcpy( (
char*)recvbuf+*displs*
get_sizeof(sendtype),
210 std::cerr <<
"Unsupported data type " << sendtype
211 <<
" used for MPI_Allgatherv" << std::endl;
217 int MPI_Alltoall(
void *sendbuf,
int sendcount, MPI_Datatype sendtype,
218 void *recvbuf,
int recvcnt, MPI_Datatype recvtype,
220 return MPI_Allgather( sendbuf, sendcount, sendtype,
221 recvbuf, recvcnt, recvtype, comm);
224 int MPI_Alltoallv(
void *sendbuf,
int *sendcounts,
225 int *senddispls, MPI_Datatype sendtype,
226 void *recvbuf,
int *recvcounts,
int *recvdispls,
227 MPI_Datatype recvtype, MPI_Comm comm ) {
228 return MPI_Allgather( (
char*)sendbuf+*senddispls, *sendcounts, sendtype,
229 (
char*)recvbuf+*recvdispls, *recvcounts, recvtype, comm);
int COMMPI_Irecv(void *buf, int count, MPI_Datatype datatype, int src, int tag, MPI_Comm comm, MPI_Request *request)
Begins a nonblocking receive.
here we put it at the!beginning of the common block The point to point and collective!routines know about but MPI_TYPE_STRUCT as yet does not!MPI_STATUS_IGNORE and MPI_STATUSES_IGNORE are similar objects!Until the underlying MPI library implements the C version of these are declared as arrays of MPI_STATUS_SIZE!The types and are OPTIONAL!Their values are zero if they are not available Note that!using these reduces the portability of MPI_IO INTEGER MPI_BOTTOM INTEGER MPI_DOUBLE_PRECISION INTEGER MPI_LOGICAL INTEGER MPI_BYTE
int COM_send(Msg_Queue &sendQ, Msg_Queue &recvQ, void *buf, int count, MPI_Datatype datatype, int tag)
int COMMPI_Isend(void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request *request)
Begins a nonblocking send.
std::map< int, void * > Msg_Queue
A map from message tags to data addresses.
Contains declarations of MPI subroutines used in Roccom.
int COM_recv(Msg_Queue &sendQ, Msg_Queue &recvQ, void *buf, int count, MPI_Datatype datatype, int tag)
static int get_sizeof(MPI_Datatype i)
Get the size of a given MPI data type.