Learn R Programming

pbdMPI (version 0.5-2)

alltoall: All to All

Description

These functions make calls to MPI_Alltoall() and MPI_Alltoallv().

Usage

spmd.alltoall.integer(x.send, x.recv, send.count, recv.count,
                      comm = .pbd_env$SPMD.CT$comm)
spmd.alltoall.double(x.send, x.recv, send.count, recv.count,
                    comm = .pbd_env$SPMD.CT$comm)
spmd.alltoall.raw(x.send, x.recv, send.count, recv.count,
                  comm = .pbd_env$SPMD.CT$comm)

spmd.alltoallv.integer(x.send, x.recv, send.count, recv.count, sdispls, rdispls, comm = .pbd_env$SPMD.CT$comm) spmd.alltoallv.double(x.send, x.recv, send.count, recv.count, sdispls, rdispls, comm = .pbd_env$SPMD.CT$comm) spmd.alltoallv.raw(x.send, x.recv, send.count, recv.count, sdispls, rdispls, comm = .pbd_env$SPMD.CT$comm)

Value

These are very low level functions. Use with cautions. Neigher S4 method nor long vector is supported.

Arguments

x.send

an object to send.

x.recv

an object to receive

send.count

send counter

recv.count

recv counter

sdispls

send dis pls

rdispls

recv dis pls

comm

a communicator number.

Author

Wei-Chen Chen wccsnow@gmail.com, George Ostrouchov, Drew Schmidt, Pragneshkumar Patel, and Hao Yu.

Details

These are very low level functions. Use with cautions. Neigher S4 method nor long vector is supported.

References

Programming with Big Data in R Website: https://pbdr.org/

See Also

allgather(), allgatherv().

Examples

Run this code
if (FALSE) {
### Save code in a file "demo.r" and run with 2 processors by
### SHELL> mpiexec -np 2 Rscript --vanilla [...].r

spmd.code <- "
### Initialize
suppressMessages(library(pbdMPI, quietly = TRUE))
.comm.size <- comm.size()
.comm.rank <- comm.rank()

### Examples.
n <- as.integer(2)
x <- 1:(.comm.size * n)
comm.cat(\"Original x:\n\", quiet = TRUE)
comm.print(x, all.rank = TRUE)

x <- as.integer(x)
y <- spmd.alltoall.integer(x, integer(length(x)), n, n)
comm.cat(\"\nAlltoall y:\n\", quiet = TRUE)
comm.print(y, all.rank = TRUE)

### Finish.
finalize()
"
# execmpi(spmd.code, nranks = 2L)
}

Run the code above in your browser using DataLab