X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/40616078da72e823931c1fb884949054699ec39d..befbbbe1fbb31663a8f91e24ce12df271cf4ae79:/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 d2a2264c82..730307b0c1 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-2014. The SimGrid Team. +/* Copyright (c) 2013-2017. The SimGrid Team. * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it @@ -37,10 +37,10 @@ #include "../colls_private.h" -#define MPIR_Allreduce_pt2pt_rd_MV2 smpi_coll_tuned_allreduce_rdb -#define MPIR_Allreduce_pt2pt_rs_MV2 smpi_coll_tuned_allreduce_mvapich2_rs +#define MPIR_Allreduce_pt2pt_rd_MV2 Coll_allreduce_rdb::allreduce +#define MPIR_Allreduce_pt2pt_rs_MV2 Coll_allreduce_mvapich2_rs::allreduce -extern int (*MV2_Allreduce_function)(void *sendbuf, +extern int (*MV2_Allreducection)(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, @@ -52,14 +52,17 @@ extern int (*MV2_Allreduce_intra_function)( void *sendbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm); - + + +namespace simgrid{ +namespace smpi{ static int MPIR_Allreduce_reduce_p2p_MV2( void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm) { - mpi_coll_reduce_fun(sendbuf,recvbuf,count,datatype,op,0,comm); + Colls::reduce(sendbuf,recvbuf,count,datatype,op,0,comm); return MPI_SUCCESS; } @@ -69,13 +72,13 @@ static int MPIR_Allreduce_reduce_shmem_MV2( void *sendbuf, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm) { - mpi_coll_reduce_fun(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 smpi_coll_tuned_allreduce_mvapich2_two_level(void *sendbuf, +int Coll_allreduce_mvapich2_two_level::allreduce(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, @@ -89,14 +92,14 @@ int smpi_coll_tuned_allreduce_mvapich2_two_level(void *sendbuf, //if not set (use of the algo directly, without mvapich2 selector) if(MV2_Allreduce_intra_function==NULL) - MV2_Allreduce_intra_function = smpi_coll_tuned_allreduce_mpich; - if(MV2_Allreduce_function==NULL) - MV2_Allreduce_function = smpi_coll_tuned_allreduce_rdb; - + MV2_Allreduce_intra_function = Coll_allreduce_mpich::allreduce; + if(MV2_Allreducection==NULL) + MV2_Allreducection = Coll_allreduce_rdb::allreduce; + if(comm->get_leaders_comm()==MPI_COMM_NULL){ comm->init_smp(); } - + if (count == 0) { return MPI_SUCCESS; } @@ -119,7 +122,7 @@ int smpi_coll_tuned_allreduce_mvapich2_two_level(void *sendbuf, /* Doing the shared memory gather and reduction by the leader */ if (local_rank == 0) { - if ((MV2_Allreduce_intra_function == &MPIR_Allreduce_reduce_shmem_MV2) || + if ((MV2_Allreduce_intra_function == &MPIR_Allreduce_reduce_shmem_MV2) || (MV2_Allreduce_intra_function == &MPIR_Allreduce_reduce_p2p_MV2) ) { mpi_errno = MV2_Allreduce_intra_function(sendbuf, recvbuf, count, datatype, @@ -135,7 +138,7 @@ int smpi_coll_tuned_allreduce_mvapich2_two_level(void *sendbuf, void* sendtmpbuf = (char *)smpi_get_tmp_sendbuffer(count*datatype->get_extent()); Datatype::copy(recvbuf, count, datatype,sendtmpbuf, count, datatype); /* inter-node allreduce */ - if(MV2_Allreduce_function == &MPIR_Allreduce_pt2pt_rd_MV2){ + if(MV2_Allreducection == &MPIR_Allreduce_pt2pt_rd_MV2){ mpi_errno = MPIR_Allreduce_pt2pt_rd_MV2(sendtmpbuf, recvbuf, count, datatype, op, leader_comm); @@ -148,7 +151,7 @@ int smpi_coll_tuned_allreduce_mvapich2_two_level(void *sendbuf, } } else { /* insert the first reduce here */ - if ((MV2_Allreduce_intra_function == &MPIR_Allreduce_reduce_shmem_MV2) || + if ((MV2_Allreduce_intra_function == &MPIR_Allreduce_reduce_shmem_MV2) || (MV2_Allreduce_intra_function == &MPIR_Allreduce_reduce_p2p_MV2) ) { mpi_errno = MV2_Allreduce_intra_function(sendbuf, recvbuf, count, datatype, @@ -163,8 +166,10 @@ int smpi_coll_tuned_allreduce_mvapich2_two_level(void *sendbuf, /* Broadcasting the mesage from leader to the rest */ /* Note: shared memory broadcast could improve the performance */ - mpi_errno = mpi_coll_bcast_fun(recvbuf, count, datatype, 0, shmem_comm); + mpi_errno = Colls::bcast(recvbuf, count, datatype, 0, shmem_comm); return (mpi_errno); } +} +}