Read<T> Comm::alltoallv(Read<T> sendbuf_dev, Read<LO> sendcounts_dev, Read<LO> sdispls_dev, Read<LO> recvcounts_dev, Read<LO> rdispls_dev) const { #ifdef OMEGA_H_USE_MPI HostRead<T> sendbuf(sendbuf_dev); HostRead<LO> sendcounts(sendcounts_dev); HostRead<LO> recvcounts(recvcounts_dev); HostRead<LO> sdispls(sdispls_dev); HostRead<LO> rdispls(rdispls_dev); CHECK(rdispls.size() == recvcounts.size() + 1); int nrecvd = rdispls.last(); HostWrite<T> recvbuf(nrecvd); CHECK(sendcounts.size() == host_dsts_.size()); CHECK(recvcounts.size() == host_srcs_.size()); CHECK(sdispls.size() == sendcounts.size() + 1); CHECK(sendbuf.size() == sdispls.last()); CALL(Neighbor_alltoallv(host_srcs_, host_dsts_, sendbuf.data(), sendcounts.data(), sdispls.data(), MpiTraits<T>::datatype(), recvbuf.data(), recvcounts.data(), rdispls.data(), MpiTraits<T>::datatype(), impl_)); return recvbuf.write(); #else (void)sendcounts_dev; (void)recvcounts_dev; (void)sdispls_dev; (void)rdispls_dev; return sendbuf_dev; #endif }
void dummy_operations::run_collective_dummy_operations() { int rank, size; MPI_Comm_rank( MPI_COMM_WORLD, &rank); MPI_Comm_size( MPI_COMM_WORLD, &size); // Run Broadcast { int x; MPI_Comm_rank( MPI_COMM_WORLD, &x); MPI_Bcast(&x, 1, MPI_INT, 0, MPI_COMM_WORLD); } // Run Allgather. { int x, size; MPI_Comm_rank( MPI_COMM_WORLD, &x); MPI_Comm_size( MPI_COMM_WORLD, &size); std::vector<int> rcv(size); MPI_Allgather(&x, 1, MPI_INT, &rcv[0], 1, MPI_INT, MPI_COMM_WORLD); } // Run Allreduce. { int x; MPI_Comm_rank( MPI_COMM_WORLD, &x); int y = 0; MPI_Allreduce(&x, &y, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD); } // Dummy Prefix Sum { int x = 1; int y = 0; MPI_Scan(&x, &y, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD); } // Run Alltoallv. { std::vector<int> snd(size); std::vector<int> rcv(size); std::vector<int> scounts(size, 1); std::vector<int> rcounts(size, 1); std::vector<int> sdispls(size); std::vector<int> rdispls(size); for (int i = 0, iend = sdispls.size(); i < iend; ++i) { sdispls[i] = rdispls[i] = i; } MPI_Alltoallv(&snd[0], &scounts[0], &sdispls[0], MPI_INT, &rcv[0], &rcounts[0], &rdispls[0], MPI_INT, MPI_COMM_WORLD); } }