-
-int PMPI_Ialltoall(void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, int recvcount,
- MPI_Datatype recvtype, MPI_Comm comm, MPI_Request *request)
-{
- int retval = 0;
- smpi_bench_end();
-
- if (comm == MPI_COMM_NULL) {
- retval = MPI_ERR_COMM;
- } else if ((sendbuf == nullptr && sendcount > 0) || (recvbuf == nullptr && recvcount > 0)) {
- retval = MPI_ERR_BUFFER;
- } else if ((sendbuf != MPI_IN_PLACE && sendtype == MPI_DATATYPE_NULL) || recvtype == MPI_DATATYPE_NULL) {
- retval = MPI_ERR_TYPE;
- } else if ((sendbuf != MPI_IN_PLACE && sendcount < 0) || recvcount < 0){
- retval = MPI_ERR_COUNT;
- } else if (request == nullptr){
- retval = MPI_ERR_ARG;
- } else {
- int rank = simgrid::s4u::this_actor::get_pid();
- void* sendtmpbuf = static_cast<char*>(sendbuf);
- int sendtmpcount = sendcount;
- MPI_Datatype sendtmptype = sendtype;
- if (sendbuf == MPI_IN_PLACE) {
- sendtmpbuf = static_cast<void*>(xbt_malloc(recvcount * comm->size() * recvtype->size()));
- memcpy(sendtmpbuf, recvbuf, recvcount * comm->size() * recvtype->size());
- sendtmpcount = recvcount;
- sendtmptype = recvtype;
- }
-
- TRACE_smpi_comm_in(rank, request==MPI_REQUEST_IGNORED?"PMPI_Alltoall":"PMPI_Ialltoall",
- new simgrid::instr::CollTIData(
- request==MPI_REQUEST_IGNORED ? "alltoall" : "ialltoall", -1, -1.0,
- sendtmptype->is_replayable() ? sendtmpcount : sendtmpcount * sendtmptype->size(),
- recvtype->is_replayable() ? recvcount : recvcount * recvtype->size(),
- simgrid::smpi::Datatype::encode(sendtmptype), simgrid::smpi::Datatype::encode(recvtype)));
- if(request == MPI_REQUEST_IGNORED)
- retval = simgrid::smpi::Colls::alltoall(sendtmpbuf, sendtmpcount, sendtmptype, recvbuf, recvcount, recvtype, comm);
- else
- retval = simgrid::smpi::Colls::ialltoall(sendtmpbuf, sendtmpcount, sendtmptype, recvbuf, recvcount, recvtype, comm, request);