- if (comm == MPI_COMM_NULL) {
- retval = MPI_ERR_COMM;
- } 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)){
- retval = MPI_ERR_COUNT;
- } else if (recvcounts == nullptr || displs == nullptr) {
- retval = MPI_ERR_ARG;
- } else if (request == nullptr){
- retval = MPI_ERR_ARG;
- } else {
-
- if(sendbuf == MPI_IN_PLACE) {
- sendbuf=static_cast<char*>(recvbuf)+recvtype->get_extent()*displs[comm->rank()];
- sendcount=recvcounts[comm->rank()];
- sendtype=recvtype;
- }
- int rank = simgrid::s4u::this_actor::get_pid();
- int dt_size_recv = recvtype->is_replayable() ? 1 : recvtype->size();
-
- std::vector<int>* trace_recvcounts = new std::vector<int>;
- for (int i = 0; i < comm->size(); i++) // copy data to avoid bad free
- trace_recvcounts->push_back(recvcounts[i] * dt_size_recv);
-
- TRACE_smpi_comm_in(rank, request==MPI_REQUEST_IGNORED?"PMPI_Allgatherv":"PMPI_Iallgatherv",
- new simgrid::instr::VarCollTIData(
- request==MPI_REQUEST_IGNORED ? "allgatherv" : "iallgatherv", -1, sendtype->is_replayable() ? sendcount : sendcount * sendtype->size(),
- nullptr, dt_size_recv, trace_recvcounts, simgrid::smpi::Datatype::encode(sendtype),
- simgrid::smpi::Datatype::encode(recvtype)));
- if(request == MPI_REQUEST_IGNORED)
- simgrid::smpi::Colls::allgatherv(sendbuf, sendcount, sendtype, recvbuf, recvcounts, displs, recvtype, comm);
- else
- simgrid::smpi::Colls::iallgatherv(sendbuf, sendcount, sendtype, recvbuf, recvcounts, displs, recvtype, comm, request);
- retval = MPI_SUCCESS;
- TRACE_smpi_comm_out(rank);