X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/5e472a6023eb14e7396b16fa4eb47c805d8f4acf..ebf8e9cb9961c8310418ddcb7e6cee64f750cf8d:/src/smpi/colls/reduce/reduce-ompi.cpp diff --git a/src/smpi/colls/reduce/reduce-ompi.cpp b/src/smpi/colls/reduce/reduce-ompi.cpp index f5d593d1af..d6f2a85335 100644 --- a/src/smpi/colls/reduce/reduce-ompi.cpp +++ b/src/smpi/colls/reduce/reduce-ompi.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 @@ -19,8 +19,8 @@ * Additional copyrights may follow */ -#include "../colls_private.h" -#include "../coll_tuned_topo.h" +#include "../coll_tuned_topo.hpp" +#include "../colls_private.hpp" namespace simgrid{ namespace smpi{ @@ -261,10 +261,7 @@ int smpi_coll_tuned_ompi_reduce_generic( void* sendbuf, void* recvbuf, int origi else { int creq = 0; - MPI_Request* sreq = NULL; - - sreq = (MPI_Request*) calloc( max_outstanding_reqs, - sizeof(MPI_Request ) ); + MPI_Request* sreq = new (std::nothrow) MPI_Request[max_outstanding_reqs]; if (NULL == sreq) { line = __LINE__; ret = -1; goto error_hndl; } /* post first group of requests */ @@ -303,18 +300,18 @@ int smpi_coll_tuned_ompi_reduce_generic( void* sendbuf, void* recvbuf, int origi MPI_STATUSES_IGNORE ); /* free requests */ - free(sreq); + delete[] sreq; } } - free(tree); + ompi_coll_tuned_topo_destroy_tree(&tree); return MPI_SUCCESS; error_hndl: /* error handler */ XBT_DEBUG("ERROR_HNDL: node %d file %s line %d error %d\n", rank, __FILE__, line, ret ); - if( inbuf_free[0] != NULL ) free(inbuf_free[0]); - if( inbuf_free[1] != NULL ) free(inbuf_free[1]); - if( accumbuf_free != NULL ) free(accumbuf); + smpi_free_tmp_buffer(inbuf_free[0]); + smpi_free_tmp_buffer(inbuf_free[1]); + smpi_free_tmp_buffer(accumbuf); return ret; }