- if(request == MPI_REQUEST_IGNORED)
- retval = simgrid::smpi::Colls::alltoallv(sendtmpbuf, sendtmpcounts, sendtmpdisps, sendtmptype, recvbuf, recvcounts,
- recvdisps, recvtype, comm);
- else
- retval = simgrid::smpi::Colls::ialltoallv(sendtmpbuf, sendtmpcounts, sendtmpdisps, sendtmptype, recvbuf, recvcounts,
- recvdisps, recvtype, comm, request);
- TRACE_smpi_comm_out(rank);
-
- if (sendbuf == MPI_IN_PLACE) {
- xbt_free(sendtmpbuf);
- xbt_free(sendtmpcounts);
- xbt_free(sendtmpdisps);
+int PMPI_Alltoallw(const void* sendbuf, const int* sendcounts, const int* senddisps, const MPI_Datatype* sendtypes, void* recvbuf,
+ const int* recvcounts, const int* recvdisps, const MPI_Datatype* recvtypes, MPI_Comm comm)
+{
+ return PMPI_Ialltoallw(sendbuf, sendcounts, senddisps, sendtypes, recvbuf, recvcounts, recvdisps, recvtypes, comm, MPI_REQUEST_IGNORED);
+}
+
+int PMPI_Ialltoallw(const void* sendbuf, const int* sendcounts, const int* senddisps, const MPI_Datatype* sendtypes, void* recvbuf,
+ const int* recvcounts, const int* recvdisps, const MPI_Datatype* recvtypes, MPI_Comm comm, MPI_Request* request)
+{
+ if (comm == MPI_COMM_NULL)
+ return MPI_ERR_COMM;
+ if (sendbuf == nullptr || recvbuf == nullptr)
+ return MPI_ERR_BUFFER;
+ if ((sendbuf != MPI_IN_PLACE && sendtypes == nullptr) || recvtypes == nullptr)
+ return MPI_ERR_TYPE;
+ if ((sendbuf != MPI_IN_PLACE && (sendcounts == nullptr || senddisps == nullptr)) || recvcounts == nullptr ||
+ recvdisps == nullptr)
+ return MPI_ERR_ARG;
+ if (request == nullptr)
+ return MPI_ERR_ARG;
+
+ smpi_bench_end();
+ int rank = simgrid::s4u::this_actor::get_pid();
+ int size = comm->size();
+ for (int i = 0; i < size; i++) {
+ if (recvcounts[i] < 0 || (sendbuf != MPI_IN_PLACE && sendcounts[i] < 0))
+ return MPI_ERR_COUNT;
+ }
+ int send_size = 0;
+ int recv_size = 0;
+ std::vector<int>* trace_sendcounts = new std::vector<int>;
+ std::vector<int>* trace_recvcounts = new std::vector<int>;
+
+ const void* real_sendbuf = sendbuf;
+ const int* real_sendcounts = sendcounts;
+ const int* real_senddisps = senddisps;
+ const MPI_Datatype* real_sendtypes = sendtypes;
+ unsigned long maxsize = 0;
+ for (int i = 0; i < size; i++) { // copy data to avoid bad free
+ if (recvtypes[i] == MPI_DATATYPE_NULL) {
+ delete trace_recvcounts;
+ delete trace_sendcounts;
+ return MPI_ERR_TYPE;