MPI_Comm comm, MPI_Status * status)
{
//TODO: suboptimal implementation
- // void *recvbuf;
+ void *recvbuf;
int retval;
+ if ((datatype == MPI_DATATYPE_NULL)||(datatype->has_subtype==1)) {
+ retval = MPI_ERR_TYPE;
+ } else if (count < 0) {
+ retval = MPI_ERR_COUNT;
+ } else {
+ int size = smpi_datatype_size(datatype) * count;
+ recvbuf = xbt_new(char, size);
+ retval =
+ MPI_Sendrecv(buf, count, datatype, dst, sendtag, recvbuf, count,
+ datatype, src, recvtag, comm, status);
+ if(retval==MPI_SUCCESS){
+ memcpy(buf, recvbuf, size * sizeof(char));
+ }
+ xbt_free(recvbuf);
-// size = smpi_datatype_size(datatype) * count;
-// recvbuf = xbt_new(char, size);
- retval =
- MPI_Sendrecv(buf, count, datatype, dst, sendtag, buf, count,
- datatype, src, recvtag, comm, status);
-/*memcpy(buf, recvbuf, size * sizeof(char));
- xbt_free(recvbuf);*/
+ }
return retval;
}
smpi_bench_begin();
return retval;}
+int PMPI_Error_class(int errorcode, int* errorclass) {
+ // assume smpi uses only standard mpi error codes
+ *errorclass=errorcode;
+ return MPI_SUCCESS;
+}
/* The following calls are not yet implemented and will fail at runtime. */
/* Once implemented, please move them above this notice. */
return not_yet_implemented();
}
-int PMPI_Error_class(int errorcode, int* errorclass) {
- return not_yet_implemented();
-}
-
int PMPI_Errhandler_create(MPI_Handler_function* function, MPI_Errhandler* errhandler) {
return not_yet_implemented();
}