+/* 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
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
- * $COPYRIGHT$
*
* Additional copyrights may follow
- *
- * $HEADER$
*/
#include "colls_private.h"
} else {
/* root is not on 0, allocate temp buffer for recv,
* rotate data at the end */
- tempbuf = (char *) malloc(rtrue_extent + (rcount*size - 1) * rextent);
+ tempbuf = (char *) smpi_get_tmp_recvbuffer(rtrue_extent + (rcount*size - 1) * rextent);
if (NULL == tempbuf) {
err= MPI_ERR_OTHER; line = __LINE__; goto err_hndl;
}
/* other non-leaf nodes, allocate temp buffer for data received from
* children, the most we need is half of the total data elements due
* to the property of binimoal tree */
- tempbuf = (char *) malloc(strue_extent + (scount*size - 1) * sextent);
+ tempbuf = (char *) smpi_get_tmp_sendbuffer(strue_extent + (scount*size - 1) * sextent);
if (NULL == tempbuf) {
err= MPI_ERR_OTHER; line = __LINE__; goto err_hndl;
}
(char *) rbuf,rcount*root,rdtype);
if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; }
- free(tempbuf);
+ smpi_free_tmp_buffer(tempbuf);
}
} else if (!(vrank % 2)) {
/* other non-leaf nodes */
- free(tempbuf);
+ smpi_free_tmp_buffer(tempbuf);
}
+ xbt_free(bmtree);
return MPI_SUCCESS;
err_hndl:
if (NULL != tempbuf)
- free(tempbuf);
+ smpi_free_tmp_buffer(tempbuf);
XBT_DEBUG( "%s:%4d\tError occurred %d, rank %2d",
__FILE__, line, err, rank);
COLL_TUNED_COMPUTED_SEGCOUNT( (size_t)first_segment_size, typelng,
first_segment_count );
- ptmp = (char *) rbuf;
for (i = 0; i < size; ++i) {
if (i == rank) {
/* skip myself */
/* wait all second segments to complete */
ret = smpi_mpi_waitall(size, reqs, MPI_STATUSES_IGNORE);
+ if (ret != MPI_SUCCESS) { line = __LINE__; goto error_hndl; }
free(reqs);
}