X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/611d822b02f836d7abe031cced6adc4281ef4356..bad5891a4d5a2d97e1dea926cb640f516c1fae0c:/src/smpi/colls/bcast/bcast-scatter-LR-allgather.cpp diff --git a/src/smpi/colls/bcast/bcast-scatter-LR-allgather.cpp b/src/smpi/colls/bcast/bcast-scatter-LR-allgather.cpp index 5b1aaeda38..5ac3dc63e1 100644 --- a/src/smpi/colls/bcast/bcast-scatter-LR-allgather.cpp +++ b/src/smpi/colls/bcast/bcast-scatter-LR-allgather.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2013-2018. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2013-2019. 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. */ @@ -64,21 +64,20 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * Descrp: broadcasts using a scatter followed by LR allgather. - * Auther: MPIH / modified by Ahmad Faraj + * Author: MPIH / modified by Ahmad Faraj ****************************************************************************/ -namespace simgrid{ -namespace smpi{ -int -Coll_bcast_scatter_LR_allgather::bcast(void *buff, int count, - MPI_Datatype data_type, int root, - MPI_Comm comm) +namespace simgrid { +namespace smpi { +int bcast__scatter_LR_allgather(void *buff, int count, + MPI_Datatype data_type, int root, + MPI_Comm comm) { MPI_Aint extent; MPI_Status status; int i, src, dst, rank, num_procs; int mask, relative_rank, curr_size, recv_size, send_size, nbytes; - int scatter_size, left, right, next_src, *recv_counts, *disps; + int scatter_size, left, right, next_src; int tag = COLL_TAG_BCAST; rank = comm->rank(); @@ -139,8 +138,8 @@ Coll_bcast_scatter_LR_allgather::bcast(void *buff, int count, } // done scatter now do allgather - recv_counts = (int *) xbt_malloc(sizeof(int) * num_procs); - disps = (int *) xbt_malloc(sizeof(int) * num_procs); + int* recv_counts = new int[num_procs]; + int* disps = new int[num_procs]; for (i = 0; i < num_procs; i++) { recv_counts[i] = nbytes - i * scatter_size; @@ -172,9 +171,8 @@ Coll_bcast_scatter_LR_allgather::bcast(void *buff, int count, next_src = (num_procs + next_src - 1) % num_procs; } - - free(recv_counts); - free(disps); + delete[] recv_counts; + delete[] disps; return MPI_SUCCESS; }