X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/61427a88a76a2c2ef25d0d5b8132995c6f550e5c..e3771caa277bcafe6b67c9bfaf18ab8ee70001a7:/src/smpi/colls/bcast/bcast-NTSB.cpp diff --git a/src/smpi/colls/bcast/bcast-NTSB.cpp b/src/smpi/colls/bcast/bcast-NTSB.cpp index 9e1e974fa6..9a112c331a 100644 --- a/src/smpi/colls/bcast/bcast-NTSB.cpp +++ b/src/smpi/colls/bcast/bcast-NTSB.cpp @@ -1,10 +1,10 @@ -/* 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 * under the terms of the license (GNU LGPL) which comes with this package. */ -#include "../colls_private.h" +#include "../colls_private.hpp" int bcast_NTSB_segment_size_in_byte = 8192; namespace simgrid{ @@ -17,11 +17,6 @@ int Coll_bcast_NTSB::bcast(void *buf, int count, MPI_Datatype datatype, int rank, size; int i; - MPI_Request *send_request_array; - MPI_Request *recv_request_array; - MPI_Status *send_status_array; - MPI_Status *recv_status_array; - MPI_Aint extent; extent = datatype->get_extent(); @@ -97,16 +92,10 @@ int Coll_bcast_NTSB::bcast(void *buf, int count, MPI_Datatype datatype, // pipelining else { - send_request_array = - (MPI_Request *) xbt_malloc(2 * (size + pipe_length) * sizeof(MPI_Request)); - recv_request_array = - (MPI_Request *) xbt_malloc((size + pipe_length) * sizeof(MPI_Request)); - send_status_array = - (MPI_Status *) xbt_malloc(2 * (size + pipe_length) * sizeof(MPI_Status)); - recv_status_array = - (MPI_Status *) xbt_malloc((size + pipe_length) * sizeof(MPI_Status)); - - + MPI_Request* send_request_array = new MPI_Request[2 * (size + pipe_length)]; + MPI_Request* recv_request_array = new MPI_Request[size + pipe_length]; + MPI_Status* send_status_array = new MPI_Status[2 * (size + pipe_length)]; + MPI_Status* recv_status_array = new MPI_Status[size + pipe_length]; /* case: root */ if (rank == 0) { @@ -169,10 +158,10 @@ int Coll_bcast_NTSB::bcast(void *buf, int count, MPI_Datatype datatype, Request::waitall((2 * pipe_length), send_request_array, send_status_array); } - free(send_request_array); - free(recv_request_array); - free(send_status_array); - free(recv_status_array); + delete[] send_request_array; + delete[] recv_request_array; + delete[] send_status_array; + delete[] recv_status_array; } /* end pipeline */ /* when count is not divisible by block size, use default BCAST for the remainder */