X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/1faf1e4ac5d8295ab562c45a5507a471ad4540a6..48af4c8427d171d3e05d39116b02e441f2391374:/src/smpi/colls/reduce-binomial.c diff --git a/src/smpi/colls/reduce-binomial.c b/src/smpi/colls/reduce-binomial.c index 6c91ffbf04..597c2e469f 100644 --- a/src/smpi/colls/reduce-binomial.c +++ b/src/smpi/colls/reduce-binomial.c @@ -1,3 +1,9 @@ +/* Copyright (c) 2013-2014. The SimGrid Team. + * All rights reserved. */ + +/* This program is free software; you can redistribute it and/or modify it + * under the terms of the license (GNU LGPL) which comes with this package. */ + #include "colls_private.h" //#include @@ -23,8 +29,6 @@ int smpi_coll_tuned_reduce_binomial(void *sendbuf, void *recvbuf, int count, tmp_buf = (void *) xbt_malloc(count * extent); int is_commutative = smpi_op_is_commute(op); - smpi_mpi_sendrecv(sendbuf, count, datatype, rank, tag, - recvbuf, count, datatype, rank, tag, comm, &status); mask = 1; int lroot; @@ -72,14 +76,17 @@ int smpi_coll_tuned_reduce_binomial(void *sendbuf, void *recvbuf, int count, mask <<= 1; } -if (!is_commutative && (root != 0)){ - if (rank == 0){ - smpi_mpi_send(recvbuf, count, datatype, root,tag, comm); - }else if (rank == root){ - smpi_mpi_recv(recvbuf, count, datatype, 0, tag, comm, &status); + if (!is_commutative && (root != 0)){ + if (rank == 0){ + smpi_mpi_send(recvbuf, count, datatype, root,tag, comm); + }else if (rank == root){ + smpi_mpi_recv(recvbuf, count, datatype, 0, tag, comm, &status); + } } -} + if (rank != root) { + xbt_free(recvbuf); + } free(tmp_buf); return 0;