X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/5c3fe220a3cc4a75f37d62a06138fdf6938b2f0e..b51da37243dc16575499f4cb7729fe8bdd7fa514:/src/smpi/smpi_base.cpp diff --git a/src/smpi/smpi_base.cpp b/src/smpi/smpi_base.cpp index 3a987711f9..d60b2bff16 100644 --- a/src/smpi/smpi_base.cpp +++ b/src/smpi/smpi_base.cpp @@ -773,16 +773,18 @@ int smpi_mpi_test(MPI_Request * request, MPI_Status * status) { int smpi_mpi_testany(int count, MPI_Request requests[], int *index, MPI_Status * status) { - xbt_dynar_t comms; + std::vector comms; + comms.reserve(count); + int i; int flag = 0; *index = MPI_UNDEFINED; - comms = xbt_dynar_new(sizeof(smx_synchro_t), nullptr); + std::vector map; /** Maps all matching comms back to their location in requests **/ for(i = 0; i < count; i++) { if ((requests[i] != MPI_REQUEST_NULL) && requests[i]->action && !(requests[i]->flags & PREPARED)) { - xbt_dynar_push(comms, &requests[i]->action); + comms.push_back(requests[i]->action); map.push_back(i); } } @@ -792,7 +794,7 @@ int smpi_mpi_testany(int count, MPI_Request requests[], int *index, MPI_Status * if(smpi_test_sleep > 0) simcall_process_sleep(nsleeps*smpi_test_sleep); - i = simcall_comm_testany(comms); // The i-th element in comms matches! + i = simcall_comm_testany(comms.data(), comms.size()); // The i-th element in comms matches! if (i != -1) { // -1 is not MPI_UNDEFINED but a SIMIX return code. (nothing matches) *index = map[i]; finish_wait(&requests[*index], status); @@ -809,7 +811,6 @@ int smpi_mpi_testany(int count, MPI_Request requests[], int *index, MPI_Status * flag = 1; smpi_empty_status(status); } - xbt_dynar_free(&comms); return flag; }