-#include "colls.h"
+#include "colls_private.h"
//#include <star-reduction.c>
if (count == 0)
return 0;
- MPI_Comm_rank(comm, &rank);
- MPI_Comm_size(comm, &comm_size);
+ rank = smpi_comm_rank(comm);
+ comm_size = smpi_comm_size(comm);
- MPI_Type_extent(datatype, &extent);
+ extent = smpi_datatype_get_extent(datatype);
- tmp_buf = (void *) malloc(count * extent);
+ tmp_buf = (void *) xbt_malloc(count * extent);
- MPI_Sendrecv(sendbuf, count, datatype, rank, tag,
+ smpi_mpi_sendrecv(sendbuf, count, datatype, rank, tag,
recvbuf, count, datatype, rank, tag, comm, &status);
mask = 1;
relrank = (rank - root + comm_size) % comm_size;
source = (relrank | mask);
if (source < comm_size) {
source = (source + root) % comm_size;
- MPI_Recv(tmp_buf, count, datatype, source, tag, comm, &status);
+ smpi_mpi_recv(tmp_buf, count, datatype, source, tag, comm, &status);
star_reduction(op, tmp_buf, recvbuf, &count, &datatype);
}
} else {
dst = ((relrank & (~mask)) + root) % comm_size;
- MPI_Send(recvbuf, count, datatype, dst, tag, comm);
+ smpi_mpi_send(recvbuf, count, datatype, dst, tag, comm);
break;
}
mask <<= 1;