X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/9e6224ecd95ff7b6452fe9b2c088138877797542..0ac5b9da8918916f09bbbe3103bcd5f58e856e55:/src/smpi/colls/reduce_scatter-ompi.c diff --git a/src/smpi/colls/reduce_scatter-ompi.c b/src/smpi/colls/reduce_scatter-ompi.c index bb01dee9ec..e188c00370 100644 --- a/src/smpi/colls/reduce_scatter-ompi.c +++ b/src/smpi/colls/reduce_scatter-ompi.c @@ -1,4 +1,9 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ +/* 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 @@ -12,15 +17,13 @@ * All rights reserved. * Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved. * Copyright (c) 2009 University of Houston. All rights reserved. - * $COPYRIGHT$ * * Additional copyrights may follow - * - * $HEADER$ */ #include "colls_private.h" #include "coll_tuned_topo.h" +#include "xbt/replay.h" /* * Recursive-halving function is (*mostly*) copied from the BASIC coll module. @@ -59,6 +62,8 @@ smpi_coll_tuned_reduce_scatter_ompi_basic_recursivehalving(void *sbuf, size = smpi_comm_size(comm); XBT_DEBUG("coll:tuned:reduce_scatter_ompi_basic_recursivehalving, rank %d", rank); + if(!smpi_op_is_commute(op)) + THROWF(arg_error,0, " reduce_scatter ompi_basic_recursivehalving can only be used for commutative operations! "); /* Find displacements and the like */ disps = (int*) xbt_malloc(sizeof(int) * size); @@ -87,7 +92,13 @@ smpi_coll_tuned_reduce_scatter_ompi_basic_recursivehalving(void *sbuf, } /* Allocate temporary receive buffer. */ - recv_buf_free = (char*) xbt_malloc(buf_size); +#ifndef WIN32 + if(_xbt_replay_is_active()){ + recv_buf_free = (char*) SMPI_SHARED_MALLOC(buf_size); + }else +#endif + recv_buf_free = (char*) xbt_malloc(buf_size); + recv_buf = recv_buf_free - lb; if (NULL == recv_buf_free) { err = MPI_ERR_OTHER; @@ -95,7 +106,13 @@ smpi_coll_tuned_reduce_scatter_ompi_basic_recursivehalving(void *sbuf, } /* allocate temporary buffer for results */ - result_buf_free = (char*) xbt_malloc(buf_size); +#ifndef WIN32 + if(_xbt_replay_is_active()){ + result_buf_free = (char*) SMPI_SHARED_MALLOC(buf_size); + }else +#endif + result_buf_free = (char*) xbt_malloc(buf_size); + result_buf = result_buf_free - lb; /* copy local buffer into the temporary results */ @@ -285,9 +302,16 @@ smpi_coll_tuned_reduce_scatter_ompi_basic_recursivehalving(void *sbuf, cleanup: if (NULL != disps) xbt_free(disps); - if (NULL != recv_buf_free) xbt_free(recv_buf_free); - if (NULL != result_buf_free) xbt_free(result_buf_free); - + if (!_xbt_replay_is_active()){ + if (NULL != recv_buf_free) xbt_free(recv_buf_free); + if (NULL != result_buf_free) xbt_free(result_buf_free); + } +#ifndef WIN32 + else{ + if (NULL != recv_buf_free) SMPI_SHARED_FREE(recv_buf_free); + if (NULL != result_buf_free) SMPI_SHARED_FREE(result_buf_free); + } +#endif return err; }