X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/61427a88a76a2c2ef25d0d5b8132995c6f550e5c..HEAD:/src/smpi/colls/allreduce/allreduce-mvapich-two-level.cpp diff --git a/src/smpi/colls/allreduce/allreduce-mvapich-two-level.cpp b/src/smpi/colls/allreduce/allreduce-mvapich-two-level.cpp index 730307b0c1..841db601a7 100644 --- a/src/smpi/colls/allreduce/allreduce-mvapich-two-level.cpp +++ b/src/smpi/colls/allreduce/allreduce-mvapich-two-level.cpp @@ -1,4 +1,4 @@ -/* 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 @@ -35,50 +35,48 @@ * See COPYRIGHT in top-level directory. */ -#include "../colls_private.h" +#include "../colls_private.hpp" -#define MPIR_Allreduce_pt2pt_rd_MV2 Coll_allreduce_rdb::allreduce -#define MPIR_Allreduce_pt2pt_rs_MV2 Coll_allreduce_mvapich2_rs::allreduce +#define MPIR_Allreduce_pt2pt_rd_MV2 allreduce__rdb +#define MPIR_Allreduce_pt2pt_rs_MV2 allreduce__mvapich2_rs -extern int (*MV2_Allreducection)(void *sendbuf, +extern int (*MV2_Allreducection)(const void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm); -extern int (*MV2_Allreduce_intra_function)( void *sendbuf, +extern int (*MV2_Allreduce_intra_function)(const void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm); - -namespace simgrid{ -namespace smpi{ -static int MPIR_Allreduce_reduce_p2p_MV2( void *sendbuf, +namespace simgrid::smpi { +static int MPIR_Allreduce_reduce_p2p_MV2(const void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm) { - Colls::reduce(sendbuf,recvbuf,count,datatype,op,0,comm); + colls::reduce(sendbuf, recvbuf, count, datatype, op, 0, comm); return MPI_SUCCESS; } -static int MPIR_Allreduce_reduce_shmem_MV2( void *sendbuf, +static int MPIR_Allreduce_reduce_shmem_MV2(const void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm) { - Colls::reduce(sendbuf,recvbuf,count,datatype,op,0,comm); + colls::reduce(sendbuf, recvbuf, count, datatype, op, 0, comm); return MPI_SUCCESS; } /* general two level allreduce helper function */ -int Coll_allreduce_mvapich2_two_level::allreduce(void *sendbuf, +int allreduce__mvapich2_two_level(const void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, @@ -91,10 +89,10 @@ int Coll_allreduce_mvapich2_two_level::allreduce(void *sendbuf, int local_rank = -1, local_size = 0; //if not set (use of the algo directly, without mvapich2 selector) - if(MV2_Allreduce_intra_function==NULL) - MV2_Allreduce_intra_function = Coll_allreduce_mpich::allreduce; - if(MV2_Allreducection==NULL) - MV2_Allreducection = Coll_allreduce_rdb::allreduce; + if (MV2_Allreduce_intra_function == nullptr) + MV2_Allreduce_intra_function = allreduce__mpich; + if (MV2_Allreducection == nullptr) + MV2_Allreducection = allreduce__rdb; if(comm->get_leaders_comm()==MPI_COMM_NULL){ comm->init_smp(); @@ -135,7 +133,7 @@ int Coll_allreduce_mvapich2_two_level::allreduce(void *sendbuf, } if (local_size != total_size) { - void* sendtmpbuf = (char *)smpi_get_tmp_sendbuffer(count*datatype->get_extent()); + unsigned char* sendtmpbuf = smpi_get_tmp_sendbuffer(count * datatype->get_extent()); Datatype::copy(recvbuf, count, datatype,sendtmpbuf, count, datatype); /* inter-node allreduce */ if(MV2_Allreducection == &MPIR_Allreduce_pt2pt_rd_MV2){ @@ -164,12 +162,11 @@ int Coll_allreduce_mvapich2_two_level::allreduce(void *sendbuf, } } - /* Broadcasting the mesage from leader to the rest */ + /* Broadcasting the message from leader to the rest */ /* Note: shared memory broadcast could improve the performance */ - mpi_errno = Colls::bcast(recvbuf, count, datatype, 0, shmem_comm); + mpi_errno = colls::bcast(recvbuf, count, datatype, 0, shmem_comm); return (mpi_errno); } -} -} +} // namespace simgrid::smpi