X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/863aeead864a309c494893a1b06ec33ed2b7daf1..d5cc61332edae35867a41bb38ad9401faaab2716:/src/smpi/colls/allgather/allgather-mvapich-smp.cpp?ds=sidebyside diff --git a/src/smpi/colls/allgather/allgather-mvapich-smp.cpp b/src/smpi/colls/allgather/allgather-mvapich-smp.cpp index e30e455f18..993efeafe6 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-2017. The SimGrid Team. +/* Copyright (c) 2013-2019. The SimGrid Team. * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it @@ -34,11 +34,11 @@ * (C) 2001 by Argonne National Laboratory. * See COPYRIGHT in top-level directory. */ - #include "../colls_private.h" +#include "../colls_private.hpp" namespace simgrid{ namespace smpi{ -int Coll_allgather_mvapich2_smp::allgather(void *sendbuf,int sendcnt, MPI_Datatype sendtype, +int Coll_allgather_mvapich2_smp::allgather(const void *sendbuf,int sendcnt, MPI_Datatype sendtype, void *recvbuf, int recvcnt,MPI_Datatype recvtype, MPI_Comm comm) { @@ -105,18 +105,13 @@ int Coll_allgather_mvapich2_smp::allgather(void *sendbuf,int sendcnt, MPI_Dataty /*When data in each socket is different*/ if (comm->is_uniform() != 1) { - int *displs = NULL; - int *recvcnts = NULL; int *node_sizes = NULL; int i = 0; node_sizes = comm->get_non_uniform_map(); - displs = static_cast(xbt_malloc(sizeof (int) * leader_comm_size)); - recvcnts = static_cast(xbt_malloc(sizeof (int) * leader_comm_size)); - if (not displs || not recvcnts) { - return MPI_ERR_OTHER; - } + int* displs = new int[leader_comm_size]; + int* recvcnts = new int[leader_comm_size]; recvcnts[0] = node_sizes[0] * recvcnt; displs[0] = 0; @@ -134,8 +129,8 @@ int Coll_allgather_mvapich2_smp::allgather(void *sendbuf,int sendcnt, MPI_Dataty recvbuf, recvcnts, displs, recvtype, leader_comm); - xbt_free(displs); - xbt_free(recvcnts); + delete[] displs; + delete[] recvcnts; } else { void* sendtmpbuf=((char*)recvbuf)+recvtype->get_extent()*(recvcnt*local_size)*leader_comm->rank();