- CHECK_ARGS(comm == MPI_COMM_NULL, MPI_ERR_COMM, "Iscatterv: the communicator cannot be MPI_COMM_NULL");
- CHECK_ARGS((comm->rank() == root) && (sendcounts == nullptr), MPI_ERR_ARG,
- "Iscatterv: param 2 sendcounts cannot be NULL on the root rank");
- CHECK_ARGS((comm->rank() == root) && (displs == nullptr), MPI_ERR_ARG,
- "Iscatterv: param 3 displs cannot be NULL on the root rank");
- CHECK_ARGS((comm->rank() == root) && (sendtype == MPI_DATATYPE_NULL), MPI_ERR_TYPE,
- "Iscatterv: The sendtype cannot be NULL on the root rank");
- CHECK_ARGS((recvbuf != MPI_IN_PLACE) && (recvtype == MPI_DATATYPE_NULL), MPI_ERR_TYPE,
- "Iscatterv: the recvtype cannot be NULL when not receiving in place");
- CHECK_ARGS(request == nullptr, MPI_ERR_ARG, "Iscatterv: param 10 request cannot be NULL");
- CHECK_ARGS(recvbuf != MPI_IN_PLACE && recvcount < 0, MPI_ERR_COUNT,
- "Iscatterv: When not receiving in place, the recvcound cannot be negative");
- CHECK_ARGS(root < 0, MPI_ERR_ROOT, "Iscatterv: root cannot be negative");
- CHECK_ARGS(root >= comm->size(), MPI_ERR_ROOT, "Iscatterv: root (=%d) is larger than communicator size (=%d)", root,
- comm->size());
-
- if (comm->rank() == root) {
+ SET_BUF2(recvbuf)
+ CHECK_COMM(9)
+ int rank = comm->rank();
+ if(recvbuf != MPI_IN_PLACE){
+ CHECK_COUNT(5, recvcount)
+ CHECK_TYPE(7, recvtype)
+ CHECK_BUFFER(4, recvbuf, recvcount, recvtype)
+ }
+ CHECK_ROOT(9)
+ CHECK_REQUEST(10)
+ if (rank == root) {
+ SET_BUF1(sendbuf)
+ CHECK_NOT_IN_PLACE_ROOT(1, sendbuf)
+ CHECK_NULL(2, MPI_ERR_COUNT, sendcounts)
+ CHECK_NULL(3, MPI_ERR_ARG, displs)
+ CHECK_TYPE(4, sendtype)
+ for (int i = 0; i < comm->size(); i++){
+ CHECK_COUNT(2, sendcounts[i])
+ CHECK_BUFFER(1, sendbuf, sendcounts[i], sendtype)
+ }