int PMPI_Reduce_scatter(void *sendbuf, void *recvbuf, int *recvcounts,
MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)
{
- int retval, i, size, count;
- int *displs;
+ int retval;
int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
-
smpi_bench_end();
#ifdef HAVE_TRACING
TRACE_smpi_computing_out(rank);
} else if (recvcounts == NULL) {
retval = MPI_ERR_ARG;
} else {
- /* arbitrarily choose root as rank 0 */
- /* TODO: faster direct implementation ? */
- size = smpi_comm_size(comm);
- count = 0;
- displs = xbt_new(int, size);
- for (i = 0; i < size; i++) {
- count += recvcounts[i];
- displs[i] = 0;
- }
- 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);
+
+ mpi_coll_reduce_scatter_fun(sendbuf, recvbuf, recvcounts,
+ datatype, op, comm);
retval = MPI_SUCCESS;
}
#ifdef HAVE_TRACING