#include <mpi.h>
library(Rmpi)
mpi.spawn.Rslaves(needlog = FALSE)
mpi.bcast.cmd( id <- mpi.comm.rank() )
mpi.bcast.cmd( np <- mpi.comm.size() )
mpi.bcast.cmd( host <- mpi.get.processor.name() )
result <- mpi.remote.exec(paste("I am", id, "of", np, "running on", host))
print(unlist(result))
mpi.close.Rslaves(dellog = FALSE)
CiNpbmNsdWRlIDxtcGkuaD4KbGlicmFyeShSbXBpKQptcGkuc3Bhd24uUnNsYXZlcyhuZWVkbG9nID0gRkFMU0UpCgptcGkuYmNhc3QuY21kKCBpZCA8LSBtcGkuY29tbS5yYW5rKCkgKQptcGkuYmNhc3QuY21kKCBucCA8LSBtcGkuY29tbS5zaXplKCkgKQptcGkuYmNhc3QuY21kKCBob3N0IDwtIG1waS5nZXQucHJvY2Vzc29yLm5hbWUoKSApCnJlc3VsdCA8LSBtcGkucmVtb3RlLmV4ZWMocGFzdGUoIkkgYW0iLCBpZCwgIm9mIiwgbnAsICJydW5uaW5nIG9uIiwgaG9zdCkpIAoKcHJpbnQodW5saXN0KHJlc3VsdCkpCgptcGkuY2xvc2UuUnNsYXZlcyhkZWxsb2cgPSBGQUxTRSkKbXBpLmV4aXQoKQoK