X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/a3848e5ea6b2305d6059c89705edaccbec356455..6dc20ece02e7caea02aff55e3e3582b42c4cb4cf:/src/smpi/colls/allreduce-ompi-ring-segmented.c diff --git a/src/smpi/colls/allreduce-ompi-ring-segmented.c b/src/smpi/colls/allreduce-ompi-ring-segmented.c index 40343886a8..2812d86668 100644 --- a/src/smpi/colls/allreduce-ompi-ring-segmented.c +++ b/src/smpi/colls/allreduce-ompi-ring-segmented.c @@ -1,3 +1,9 @@ +/* Copyright (c) 2013-2014. The SimGrid Team. + * All rights reserved. */ + +/* This program is free software; you can redistribute it and/or modify it + * under the terms of the license (GNU LGPL) which comes with this package. */ + /* * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana * University Research and Technology @@ -10,11 +16,9 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2009 University of Houston. All rights reserved. - * $COPYRIGHT$ * * Additional copyrights may follow * - * $HEADER$ * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: @@ -49,11 +53,8 @@ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - /* * ompi_coll_tuned_allreduce_intra_ring_segmented * @@ -227,10 +228,10 @@ smpi_coll_tuned_allreduce_ompi_ring_segmented(void *sbuf, void *rbuf, int count, max_real_segsize = true_extent + (max_segcount - 1) * extent; /* Allocate and initialize temporary buffers */ - inbuf[0] = (char*)malloc(max_real_segsize); + inbuf[0] = (char*)smpi_get_tmp_sendbuffer(max_real_segsize); if (NULL == inbuf[0]) { ret = -1; line = __LINE__; goto error_hndl; } if (size > 2) { - inbuf[1] = (char*)malloc(max_real_segsize); + inbuf[1] = (char*)smpi_get_tmp_recvbuffer(max_real_segsize); if (NULL == inbuf[1]) { ret = -1; line = __LINE__; goto error_hndl; } } @@ -373,15 +374,15 @@ smpi_coll_tuned_allreduce_ompi_ring_segmented(void *sbuf, void *rbuf, int count, } - if (NULL != inbuf[0]) free(inbuf[0]); - if (NULL != inbuf[1]) free(inbuf[1]); + if (NULL != inbuf[0]) smpi_free_tmp_buffer(inbuf[0]); + if (NULL != inbuf[1]) smpi_free_tmp_buffer(inbuf[1]); return MPI_SUCCESS; error_hndl: XBT_DEBUG("%s:%4d\tRank %d Error occurred %d\n", __FILE__, line, rank, ret); - if (NULL != inbuf[0]) free(inbuf[0]); - if (NULL != inbuf[1]) free(inbuf[1]); + if (NULL != inbuf[0]) smpi_free_tmp_buffer(inbuf[0]); + if (NULL != inbuf[1]) smpi_free_tmp_buffer(inbuf[1]); return ret; }