Package Tools | R Documentation |
These functions are designed to get or print MPI_COMM pointer and its address when the SPMD code in R be a foreign application of other applications.
get.mpi.comm.ptr(comm = .pbd_env$SPMD.CT$comm, show.msg = FALSE)
addr.mpi.comm.ptr(comm.ptr)
comm |
a communicator number. |
comm.ptr |
a communicator pointer. |
show.msg |
if showing message for debug only. |
get.mpi.comm.ptr()
returns an R external pointer that points
to the address of the comm.
addr.mpi.comm.ptr()
takes the R external points, and
prints the address of the comm. This function is mainly for debugging.
get.mpi.comm.ptr()
returns an R external pointer.
addr.mpi.comm.ptr()
prints the comm pointer address and the
address of MPI_COMM_WORLD.
Wei-Chen Chen wccsnow@gmail.com, George Ostrouchov, Drew Schmidt, Pragneshkumar Patel, and Hao Yu.
Programming with Big Data in R Website: https://pbdr.org/
### Save code in a file "demo.r" and run with 22processors by
### SHELL> mpiexec -np 2 Rscript demo.r
spmd.code <- "
### Initialize
suppressMessages(library(pbdMPI, quietly = TRUE))
ptr1 <- get.mpi.comm.ptr(1, show.msg = TRUE)
addr.mpi.comm.ptr(ptr1)
comm.split(color = as.integer(comm.rank()/2), key = comm.rank())
ptr1.new <- get.mpi.comm.ptr(1, show.msg = TRUE)
addr.mpi.comm.ptr(ptr1.new)
### Finish.
finalize()
"
pbdMPI::execmpi(spmd.code = spmd.code, nranks = 2L)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.