X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/89e44dce958ad9625570b126f11d299b829d4932..1687df79d61a9418bba830bbd0ab7de16e457090:/src/smpi/colls/allreduce-lr.c diff --git a/src/smpi/colls/allreduce-lr.c b/src/smpi/colls/allreduce-lr.c index d5266292d0..9bcf75c1fb 100644 --- a/src/smpi/colls/allreduce-lr.c +++ b/src/smpi/colls/allreduce-lr.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" /* IMPLEMENTED BY PITCH PATARASUK @@ -17,14 +23,14 @@ int smpi_coll_tuned_allreduce_lr(void *sbuf, void *rbuf, int rcount, MPI_Datatype dtype, MPI_Op op, MPI_Comm comm) { - int tag = 5000; + int tag = COLL_TAG_ALLREDUCE; MPI_Status status; int rank, i, size, count; int send_offset, recv_offset; int remainder, remainder_flag, remainder_offset; - rank = smpi_comm_rank(MPI_COMM_WORLD); - size = smpi_comm_size(MPI_COMM_WORLD); + rank = smpi_comm_rank(comm); + size = smpi_comm_size(comm); /* make it compatible with all data type */ MPI_Aint extent; @@ -39,12 +45,12 @@ smpi_coll_tuned_allreduce_lr(void *sbuf, void *rbuf, int rcount, /* when communication size is not divisible by number of process: call the native implementation for the remain chunk at the end of the operation */ - else if (rcount % size != 0) { + if (rcount % size != 0) { remainder = rcount % size; remainder_flag = 1; remainder_offset = (rcount / size) * size * extent; } else { - remainder_flag = remainder_offset = 0; + remainder = remainder_flag = remainder_offset = 0; } /* size of each point-to-point communication is equal to the size of the whole message