X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/d20f024dba9ff1e9c8822237caaf963b9e913889..5ed37babb2fa9097abe82df299c0aa259ed84d5a:/src/smpi/colls/reduce/reduce-binomial.cpp diff --git a/src/smpi/colls/reduce/reduce-binomial.cpp b/src/smpi/colls/reduce/reduce-binomial.cpp index d36c30f2f6..097fcd6e8a 100644 --- a/src/smpi/colls/reduce/reduce-binomial.cpp +++ b/src/smpi/colls/reduce/reduce-binomial.cpp @@ -1,17 +1,17 @@ -/* Copyright (c) 2013-2017. The SimGrid Team. +/* Copyright (c) 2013-2023. 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.hpp" +#include //#include -namespace simgrid{ -namespace smpi{ -int Coll_reduce_binomial::reduce(void *sendbuf, void *recvbuf, int count, - MPI_Datatype datatype, MPI_Op op, int root, - MPI_Comm comm) +namespace simgrid::smpi { +int reduce__binomial(const void *sendbuf, void *recvbuf, int count, + MPI_Datatype datatype, MPI_Op op, int root, + MPI_Comm comm) { MPI_Status status; int comm_size, rank; @@ -19,7 +19,6 @@ int Coll_reduce_binomial::reduce(void *sendbuf, void *recvbuf, int count, int dst; int tag = COLL_TAG_REDUCE; MPI_Aint extent; - void *tmp_buf; MPI_Aint true_lb, true_extent; if (count == 0) return 0; @@ -28,8 +27,8 @@ int Coll_reduce_binomial::reduce(void *sendbuf, void *recvbuf, int count, extent = datatype->get_extent(); - tmp_buf = (void *) smpi_get_tmp_sendbuffer(count * extent); - int is_commutative = (op==MPI_OP_NULL || op->is_commutative()); + unsigned char* tmp_buf = smpi_get_tmp_sendbuffer(count * extent); + bool is_commutative = (op == MPI_OP_NULL || op->is_commutative()); mask = 1; int lroot; @@ -42,12 +41,12 @@ int Coll_reduce_binomial::reduce(void *sendbuf, void *recvbuf, int count, datatype->extent(&true_lb, &true_extent); /* adjust for potential negative lower bound in datatype */ - tmp_buf = (void *)((char*)tmp_buf - true_lb); + tmp_buf = tmp_buf - true_lb; /* If I'm not the root, then my recvbuf may not be valid, therefore I have to allocate a temporary one */ if (rank != root) { - recvbuf = (void *) smpi_get_tmp_recvbuffer(count*(MAX(extent,true_extent))); + recvbuf = (void*)smpi_get_tmp_recvbuffer(count * std::max(extent, true_extent)); recvbuf = (void *)((char*)recvbuf - true_lb); } if ((rank != root) || (sendbuf != MPI_IN_PLACE)) { @@ -86,11 +85,10 @@ int Coll_reduce_binomial::reduce(void *sendbuf, void *recvbuf, int count, } if (rank != root) { - smpi_free_tmp_buffer(recvbuf); + smpi_free_tmp_buffer(static_cast(recvbuf)); } smpi_free_tmp_buffer(tmp_buf); return 0; } -} -} +} // namespace simgrid::smpi