X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/9335baa2b23f940577448a84168eb0b50d3dd966..5089a0a98b27f5eeee62321dff4f025f1648f025:/src/smpi/colls/reduce/reduce-flat-tree.cpp diff --git a/src/smpi/colls/reduce/reduce-flat-tree.cpp b/src/smpi/colls/reduce/reduce-flat-tree.cpp index c4c2e7fd21..2eaffae701 100644 --- a/src/smpi/colls/reduce/reduce-flat-tree.cpp +++ b/src/smpi/colls/reduce/reduce-flat-tree.cpp @@ -1,24 +1,23 @@ -/* Copyright (c) 2013-2017. The SimGrid Team. +/* Copyright (c) 2013-2019. 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 "../colls_private.hpp" //#include -namespace simgrid{ -namespace smpi{ -int -Coll_reduce_flat_tree::reduce(void *sbuf, void *rbuf, int count, - MPI_Datatype dtype, MPI_Op op, - int root, MPI_Comm comm) +namespace simgrid { +namespace smpi { +int reduce__flat_tree(const void *sbuf, void *rbuf, int count, + MPI_Datatype dtype, MPI_Op op, + int root, MPI_Comm comm) { int i, tag = COLL_TAG_REDUCE; int size; int rank; MPI_Aint extent; - char *origin = 0; - char *inbuf; + unsigned char* origin = nullptr; + const unsigned char* inbuf; MPI_Status status; rank = comm->rank(); @@ -36,8 +35,7 @@ Coll_reduce_flat_tree::reduce(void *sbuf, void *rbuf, int count, messages. */ if (size > 1) - origin = (char *) smpi_get_tmp_recvbuffer(count * extent); - + origin = smpi_get_tmp_recvbuffer(count * extent); /* Initialize the receive buffer. */ if (rank == (size - 1)) @@ -50,7 +48,7 @@ Coll_reduce_flat_tree::reduce(void *sbuf, void *rbuf, int count, for (i = size - 2; i >= 0; --i) { if (rank == i) - inbuf = static_cast(sbuf); + inbuf = static_cast(sbuf); else { Request::recv(origin, count, dtype, i, tag, comm, &status); inbuf = origin; @@ -61,8 +59,7 @@ Coll_reduce_flat_tree::reduce(void *sbuf, void *rbuf, int count, } - if (origin) - smpi_free_tmp_buffer(origin); + smpi_free_tmp_buffer(origin); /* All done */ return 0;