X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/2807fde4fd1f59c230d69a934634c5dfb77905f2..9b5c287fbf93c2ae7c3d18c8584647ef9920fe87:/src/smpi/colls/allgather/allgather-smp-simple.cpp diff --git a/src/smpi/colls/allgather/allgather-smp-simple.cpp b/src/smpi/colls/allgather/allgather-smp-simple.cpp index 3d666a7a76..c11d643ba4 100644 --- a/src/smpi/colls/allgather/allgather-smp-simple.cpp +++ b/src/smpi/colls/allgather/allgather-smp-simple.cpp @@ -1,4 +1,4 @@ -/* 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 @@ -10,7 +10,7 @@ namespace simgrid{ namespace smpi{ -int Coll_allgather_smp_simple::allgather(void *send_buf, int scount, +int Coll_allgather_smp_simple::allgather(const void *send_buf, int scount, MPI_Datatype stype, void *recv_buf, int rcount, MPI_Datatype rtype, MPI_Comm comm) @@ -27,7 +27,9 @@ int Coll_allgather_smp_simple::allgather(void *send_buf, int scount, } if(comm_size%num_core) - THROWF(arg_error,0, "allgather SMP simple algorithm can't be used with non multiple of NUM_CORE=%d number of processes ! ", num_core); + throw std::invalid_argument(xbt::string_printf( + "allgather SMP simple algorithm can't be used with non multiple of NUM_CORE=%d number of processes!", + num_core)); rank = comm->rank(); MPI_Aint rextent, sextent; @@ -73,12 +75,10 @@ int Coll_allgather_smp_simple::allgather(void *send_buf, int scount, if (intra_rank == 0) { - MPI_Request *reqs, *req_ptr; int num_req = (inter_comm_size - 1) * 2; - reqs = (MPI_Request *) xbt_malloc(num_req * sizeof(MPI_Request)); - req_ptr = reqs; - MPI_Status *stat; - stat = (MPI_Status *) xbt_malloc(num_req * sizeof(MPI_Status)); + MPI_Request* reqs = new MPI_Request[num_req]; + MPI_Request* req_ptr = reqs; + MPI_Status* stat = new MPI_Status[num_req]; for (i = 1; i < inter_comm_size; i++) { @@ -105,9 +105,8 @@ int Coll_allgather_smp_simple::allgather(void *send_buf, int scount, //MPIC_Irecv((recv_buf+recv_offset), (rcount * num_core), rtype, src, tag, comm, req_ptr++); } Request::waitall(num_req, reqs, stat); - free(reqs); - free(stat); - + delete[] reqs; + delete[] stat; } //INTRA-BCAST (use flat tree)