X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/f35db13138682b1be530a509d1eeadeafff84ca7..84402e8e2ee2a2d0bef25fdceb0a263ed8b471f6:/src/smpi/colls/alltoall/alltoall-mvapich-scatter-dest.cpp diff --git a/src/smpi/colls/alltoall/alltoall-mvapich-scatter-dest.cpp b/src/smpi/colls/alltoall/alltoall-mvapich-scatter-dest.cpp index 77baf42248..15dd553323 100644 --- a/src/smpi/colls/alltoall/alltoall-mvapich-scatter-dest.cpp +++ b/src/smpi/colls/alltoall/alltoall-mvapich-scatter-dest.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2013-2014. The SimGrid Team. +/* Copyright (c) 2013-2020. The SimGrid Team. * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it @@ -37,38 +37,35 @@ * copyright file COPYRIGHT in the top level MVAPICH2 directory. * */ - + //correct on stampede #define MV2_ALLTOALL_THROTTLE_FACTOR 4 - -#include "../colls_private.h" + +#include "../colls_private.hpp" namespace simgrid{ namespace smpi{ -int Coll_alltoall_mvapich2_scatter_dest::alltoall( - void *sendbuf, - int sendcount, - MPI_Datatype sendtype, - void *recvbuf, - int recvcount, - MPI_Datatype recvtype, - MPI_Comm comm) +int alltoall__mvapich2_scatter_dest(const void *sendbuf, + int sendcount, + MPI_Datatype sendtype, + void *recvbuf, + int recvcount, + MPI_Datatype recvtype, + MPI_Comm comm) { int comm_size, i, j; MPI_Aint sendtype_extent = 0, recvtype_extent = 0; int mpi_errno=MPI_SUCCESS; int dst, rank; - MPI_Request *reqarray; - MPI_Status *starray; - + if (recvcount == 0) return MPI_SUCCESS; - + comm_size = comm->size(); rank = comm->rank(); - + /* Get extent of send and recv types */ recvtype_extent = recvtype->get_extent(); sendtype_extent = sendtype->get_extent(); - + /* Medium-size message. Use isend/irecv with scattered destinations. Use Tony Ladd's modification to post only a small number of isends/irecvs at a time. */ @@ -83,20 +80,20 @@ int Coll_alltoall_mvapich2_scatter_dest::alltoall( there are only a few isend/irecvs left) */ int ii, ss, bblock; - + //Stampede is configured with bblock = MV2_ALLTOALL_THROTTLE_FACTOR;//mv2_coll_param.alltoall_throttle_factor; - + if (bblock >= comm_size) bblock = comm_size; /* If throttle_factor is n, each process posts n pairs of isend/irecv in each iteration. */ - + /* FIXME: This should use the memory macros (there are storage leaks here if there is an error, for example) */ - reqarray= (MPI_Request*)xbt_malloc(2*bblock*sizeof(MPI_Request)); - - starray=(MPI_Status *)xbt_malloc(2*bblock*sizeof(MPI_Status)); - + MPI_Request* reqarray = new MPI_Request[2 * bblock]; + + MPI_Status* starray = new MPI_Status[2 * bblock]; + for (ii=0; ii