X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/13fb4af932a02ea0bd4293d1e55ac071de326f80..39c935d6d5ee86d153f6f7e6a10d723ae7c57f6f:/src/smpi/colls/allreduce/allreduce-rdb.cpp?ds=sidebyside diff --git a/src/smpi/colls/allreduce/allreduce-rdb.cpp b/src/smpi/colls/allreduce/allreduce-rdb.cpp index 552698a0d8..ce1ddfee58 100644 --- a/src/smpi/colls/allreduce/allreduce-rdb.cpp +++ b/src/smpi/colls/allreduce/allreduce-rdb.cpp @@ -1,27 +1,26 @@ -/* Copyright (c) 2013-2017. The SimGrid Team. +/* Copyright (c) 2013-2021. 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_allreduce_rdb::allreduce(void *sbuff, void *rbuff, int count, - MPI_Datatype dtype, MPI_Op op, MPI_Comm comm) +int allreduce__rdb(const void *sbuff, void *rbuff, int count, + MPI_Datatype dtype, MPI_Op op, MPI_Comm comm) { int nprocs, rank, tag = COLL_TAG_ALLREDUCE; int mask, dst, pof2, newrank, rem, newdst; MPI_Aint extent, lb; MPI_Status status; - void *tmp_buf = NULL; /* #ifdef MPICH2_REDUCTION MPI_User_function * uop = MPIR_Op_table[op % 16 - 1]; #else MPI_User_function *uop; - struct MPIR_OP *op_ptr; + MPIR_OP *op_ptr; op_ptr = MPIR_ToPointer(op); uop = op_ptr->op; #endif @@ -30,7 +29,7 @@ int Coll_allreduce_rdb::allreduce(void *sbuff, void *rbuff, int count, rank=comm->rank(); dtype->extent(&lb, &extent); - tmp_buf = (void *) smpi_get_tmp_sendbuffer(count * extent); + unsigned char* tmp_buf = smpi_get_tmp_sendbuffer(count * extent); Request::sendrecv(sbuff, count, dtype, rank, 500, rbuff, count, dtype, rank, 500, comm, &status); @@ -56,7 +55,7 @@ int Coll_allreduce_rdb::allreduce(void *sbuff, void *rbuff, int count, Request::send(rbuff, count, dtype, rank + 1, tag, comm); // temporarily set the rank to -1 so that this - // process does not pariticipate in recursive + // process does not participate in recursive // doubling newrank = -1; } else // odd @@ -100,7 +99,7 @@ int Coll_allreduce_rdb::allreduce(void *sbuff, void *rbuff, int count, // recvbuf contains data accumulated so far // op is commutative OR the order is already right - // we assume it is commuttive op + // we assume it is commutative op // if (op -> op_commute || (dst < rank)) if ((dst < rank)) { if(op!=MPI_OP_NULL) op->apply( tmp_buf, rbuff, &count, dtype);