//TODO: suboptimal implementation
void *recvbuf;
int retval;
- if ((datatype == MPI_DATATYPE_NULL)||(datatype->has_subtype==1)) {
+ if (datatype == MPI_DATATYPE_NULL) {
retval = MPI_ERR_TYPE;
} else if (count < 0) {
retval = MPI_ERR_COUNT;
} else {
- int size = smpi_datatype_size(datatype) * count;
+ int size = smpi_datatype_get_extent(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));
+ smpi_datatype_copy(recvbuf, count, datatype, buf, count, datatype);
}
xbt_free(recvbuf);
int valid_count = 0;
for (i = 0; i < count; i++) {
MPI_Request req = requests[i];
- if(req){
+ if(req!=MPI_REQUEST_NULL){
srcs[valid_count] = req->src;
dsts[valid_count] = req->dst;
recvs[valid_count] = req->recv;
if (comm == MPI_COMM_NULL) {
retval = MPI_ERR_COMM;
} else {
- smpi_mpi_bcast(buf, count, datatype, root, comm);
+ mpi_coll_bcast_fun(buf, count, datatype, root, comm);
retval = MPI_SUCCESS;
}
#ifdef HAVE_TRACING
|| recvtype == MPI_DATATYPE_NULL) {
retval = MPI_ERR_TYPE;
} else {
- smpi_mpi_allgather(sendbuf, sendcount, sendtype, recvbuf, recvcount,
- recvtype, comm);
+ mpi_coll_allgather_fun(sendbuf, sendcount, sendtype, recvbuf, recvcount,
+ recvtype, comm);
retval = MPI_SUCCESS;
}
#ifdef HAVE_TRACING
} else if (datatype == MPI_DATATYPE_NULL || op == MPI_OP_NULL) {
retval = MPI_ERR_ARG;
} else {
- smpi_mpi_reduce(sendbuf, recvbuf, count, datatype, op, root, comm);
+ mpi_coll_reduce_fun(sendbuf, recvbuf, count, datatype, op, root, comm);
retval = MPI_SUCCESS;
}
#ifdef HAVE_TRACING
} else if (op == MPI_OP_NULL) {
retval = MPI_ERR_OP;
} else {
- smpi_mpi_allreduce(sendbuf, recvbuf, count, datatype, op, comm);
+ mpi_coll_allreduce_fun(sendbuf, recvbuf, count, datatype, op, comm);
retval = MPI_SUCCESS;
}
#ifdef HAVE_TRACING
count += recvcounts[i];
displs[i] = 0;
}
- smpi_mpi_reduce(sendbuf, recvbuf, count, datatype, op, 0, comm);
+ mpi_coll_reduce_fun(sendbuf, recvbuf, count, datatype, op, 0, comm);
smpi_mpi_scatterv(recvbuf, recvcounts, displs, datatype, recvbuf,
recvcounts[rank], datatype, 0, comm);
xbt_free(displs);