X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/46da24e9999dbd79a6deafaa4e4ed0ac0db7f1c4..9c92907fc7a130fd6abc60b98791daa320742ba2:/src/smpi/colls/allreduce-mvapich-rs.c diff --git a/src/smpi/colls/allreduce-mvapich-rs.c b/src/smpi/colls/allreduce-mvapich-rs.c index 352fd25936..0bd2dbef6d 100644 --- a/src/smpi/colls/allreduce-mvapich-rs.c +++ b/src/smpi/colls/allreduce-mvapich-rs.c @@ -20,21 +20,22 @@ * copyright file COPYRIGHT in the top level MVAPICH2 directory. * */ - - #include "colls_private.h" - - int smpi_coll_tuned_allreduce_mvapich2_rs(void *sendbuf, - void *recvbuf, - int count, - MPI_Datatype datatype, - MPI_Op op, MPI_Comm comm) + +#include "colls_private.h" + +int smpi_coll_tuned_allreduce_mvapich2_rs(void *sendbuf, + void *recvbuf, + int count, + MPI_Datatype datatype, + MPI_Op op, MPI_Comm comm) { - int comm_size, rank; int mpi_errno = MPI_SUCCESS; - int mask, dst, is_commutative, pof2, newrank = 0, rem, newdst, i, + int newrank = 0; + unsigned int mask, pof2; + int dst, is_commutative, rem, newdst, i, send_idx, recv_idx, last_idx, send_cnt, recv_cnt, *cnts, *disps; MPI_Aint true_lb, true_extent, extent; - void *tmp_buf; + void *tmp_buf, *tmp_buf_free; if (count == 0) { return MPI_SUCCESS; @@ -42,8 +43,8 @@ /* homogeneous */ - comm_size = smpi_comm_size(comm); - rank = smpi_comm_rank(comm); + unsigned int comm_size = smpi_comm_size(comm); + unsigned int rank = smpi_comm_rank(comm); is_commutative = smpi_op_is_commute(op); @@ -51,10 +52,10 @@ smpi_datatype_extent(datatype, &true_lb, &true_extent); extent = smpi_datatype_get_extent(datatype); - tmp_buf= xbt_malloc(count * (MAX(extent, true_extent))); + tmp_buf_free= smpi_get_tmp_recvbuffer(count * (MAX(extent, true_extent))); /* adjust for potential negative lower bound in datatype */ - tmp_buf = (void *) ((char *) tmp_buf - true_lb); + tmp_buf = (void *) ((char *) tmp_buf_free - true_lb); /* copy local data into recvbuf */ if (sendbuf != MPI_IN_PLACE) { @@ -263,6 +264,8 @@ mask >>= 1; } + xbt_free(disps); + xbt_free(cnts); } } @@ -281,7 +284,7 @@ MPI_STATUS_IGNORE); } } - + smpi_free_tmp_buffer(tmp_buf_free); return (mpi_errno); }