-/* Copyright (c) 2013-2019. The SimGrid Team.
+/* Copyright (c) 2013-2023. The SimGrid Team.
* All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
/*Naive and simple basic alltoall implementation. */
+namespace simgrid::smpi {
-namespace simgrid{
-namespace smpi{
-
-
-int Coll_alltoall_basic_linear::alltoall(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
- void *recvbuf, int recvcount, MPI_Datatype recvtype, MPI_Comm comm)
+int alltoall__basic_linear(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
+ void *recvbuf, int recvcount, MPI_Datatype recvtype, MPI_Comm comm)
{
int system_tag = COLL_TAG_ALLTOALL;
int i;
int count;
MPI_Aint lb = 0, sendext = 0, recvext = 0;
- MPI_Request *requests;
/* Initialize. */
int rank = comm->rank();
static_cast<char *>(recvbuf) + rank * recvcount * recvext, recvcount, recvtype);
if (err == MPI_SUCCESS && size > 1) {
/* Initiate all send/recv to/from others. */
- requests = xbt_new(MPI_Request, 2 * (size - 1));
+ auto* requests = new MPI_Request[2 * (size - 1)];
/* Post all receives first -- a simple optimization */
count = 0;
for (i = (rank + 1) % size; i != rank; i = (i + 1) % size) {
if(requests[i]!=MPI_REQUEST_NULL)
Request::unref(&requests[i]);
}
- xbt_free(requests);
+ delete[] requests;
}
return err;
}
-}
-}
+} // namespace simgrid::smpi