X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/40616078da72e823931c1fb884949054699ec39d..5f1dc33c9f76ee99973ba93f034f031451398ebe:/src/smpi/colls/allgather/allgather-mvapich-smp.cpp diff --git a/src/smpi/colls/allgather/allgather-mvapich-smp.cpp b/src/smpi/colls/allgather/allgather-mvapich-smp.cpp index 32d4aea198..e30e455f18 100644 --- a/src/smpi/colls/allgather/allgather-mvapich-smp.cpp +++ b/src/smpi/colls/allgather/allgather-mvapich-smp.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 @@ -35,16 +35,16 @@ * See COPYRIGHT in top-level directory. */ #include "../colls_private.h" +namespace simgrid{ +namespace smpi{ - - -int smpi_coll_tuned_allgather_mvapich2_smp(void *sendbuf,int sendcnt, MPI_Datatype sendtype, +int Coll_allgather_mvapich2_smp::allgather(void *sendbuf,int sendcnt, MPI_Datatype sendtype, void *recvbuf, int recvcnt,MPI_Datatype recvtype, MPI_Comm comm) { int rank, size; int local_rank, local_size; - int leader_comm_size = 0; + int leader_comm_size = 0; int mpi_errno = MPI_SUCCESS; MPI_Aint recvtype_extent = 0; /* Datatype extent */ MPI_Comm shmem_comm, leader_comm; @@ -52,10 +52,10 @@ int smpi_coll_tuned_allgather_mvapich2_smp(void *sendbuf,int sendcnt, MPI_Dataty if(comm->get_leaders_comm()==MPI_COMM_NULL){ comm->init_smp(); } - - if(!comm->is_uniform() || !comm->is_blocked()) + + if (not comm->is_uniform() || not comm->is_blocked()) THROWF(arg_error,0, "allgather MVAPICH2 smp algorithm can't be used with irregular deployment. Please insure that processes deployed on the same node are contiguous and that each node has the same number of processes"); - + if (recvcnt == 0) { return MPI_SUCCESS; } @@ -65,7 +65,7 @@ int smpi_coll_tuned_allgather_mvapich2_smp(void *sendbuf,int sendcnt, MPI_Dataty /* extract the rank,size information for the intra-node communicator */ recvtype_extent=recvtype->get_extent(); - + shmem_comm = comm->get_intra_comm(); local_rank = shmem_comm->rank(); local_size = shmem_comm->size(); @@ -82,20 +82,20 @@ int smpi_coll_tuned_allgather_mvapich2_smp(void *sendbuf,int sendcnt, MPI_Dataty /*If there is just one node, after gather itself, * root has all the data and it can do bcast*/ if(local_rank == 0) { - mpi_errno = mpi_coll_gather_fun(sendbuf, sendcnt,sendtype, - (void*)((char*)recvbuf + (rank * recvcnt * recvtype_extent)), + mpi_errno = Colls::gather(sendbuf, sendcnt,sendtype, + (void*)((char*)recvbuf + (rank * recvcnt * recvtype_extent)), recvcnt, recvtype, 0, shmem_comm); } else { - /*Since in allgather all the processes could have + /*Since in allgather all the processes could have * its own data in place*/ if(sendbuf == MPI_IN_PLACE) { - mpi_errno = mpi_coll_gather_fun((void*)((char*)recvbuf + (rank * recvcnt * recvtype_extent)), - recvcnt , recvtype, + mpi_errno = Colls::gather((void*)((char*)recvbuf + (rank * recvcnt * recvtype_extent)), + recvcnt , recvtype, recvbuf, recvcnt, recvtype, 0, shmem_comm); } else { - mpi_errno = mpi_coll_gather_fun(sendbuf, sendcnt,sendtype, + mpi_errno = Colls::gather(sendbuf, sendcnt,sendtype, recvbuf, recvcnt, recvtype, 0, shmem_comm); } @@ -114,8 +114,8 @@ int smpi_coll_tuned_allgather_mvapich2_smp(void *sendbuf,int sendcnt, MPI_Dataty displs = static_cast(xbt_malloc(sizeof (int) * leader_comm_size)); recvcnts = static_cast(xbt_malloc(sizeof (int) * leader_comm_size)); - if (!displs || !recvcnts) { - return MPI_ERR_OTHER; + if (not displs || not recvcnts) { + return MPI_ERR_OTHER; } recvcnts[0] = node_sizes[0] * recvcnt; displs[0] = 0; @@ -128,9 +128,9 @@ int smpi_coll_tuned_allgather_mvapich2_smp(void *sendbuf,int sendcnt, MPI_Dataty void* sendbuf=((char*)recvbuf)+recvtype->get_extent()*displs[leader_comm->rank()]; - mpi_errno = mpi_coll_allgatherv_fun(sendbuf, + mpi_errno = Colls::allgatherv(sendbuf, (recvcnt*local_size), - recvtype, + recvtype, recvbuf, recvcnts, displs, recvtype, leader_comm); @@ -138,10 +138,10 @@ int smpi_coll_tuned_allgather_mvapich2_smp(void *sendbuf,int sendcnt, MPI_Dataty xbt_free(recvcnts); } else { void* sendtmpbuf=((char*)recvbuf)+recvtype->get_extent()*(recvcnt*local_size)*leader_comm->rank(); - - - mpi_errno = smpi_coll_tuned_allgather_mpich(sendtmpbuf, + + + mpi_errno = Coll_allgather_mpich::allgather(sendtmpbuf, (recvcnt*local_size), recvtype, recvbuf, (recvcnt*local_size), recvtype, @@ -151,6 +151,9 @@ int smpi_coll_tuned_allgather_mvapich2_smp(void *sendbuf,int sendcnt, MPI_Dataty } /*Bcast the entire data from node leaders to all other cores*/ - mpi_errno = mpi_coll_bcast_fun (recvbuf, recvcnt * size, recvtype, 0, shmem_comm); + mpi_errno = Colls::bcast (recvbuf, recvcnt * size, recvtype, 0, shmem_comm); return mpi_errno; } + +} +}