Hi All, I'm trying to parallelize some code using Rmpi and I've started with a sample 'hello world' program that's available at http://math.acadiau.ca/ACMMaC/Rmpi/sample.html. The code is as follows;
# Load the R MPI package if it is not already loaded. if (!is.loaded("mpi_initialize")) { library("Rmpi") } # Spawn as many slaves as possible mpi.spawn.Rslaves(nslaves=3) # In case R exits unexpectedly, have it automatically clean up # resources taken up by Rmpi (slaves, memory, etc...) .Last <- function(){ if (is.loaded("mpi_initialize")){ if (mpi.comm.size(1) > 0){ print("Please use mpi.close.Rslaves() to close slaves.") mpi.close.Rslaves() } print("Please use mpi.quit() to quit R") .Call("mpi_finalize") } } # Tell all slaves to return a message identifying themselves mpi.remote.exec(paste("I am",mpi.comm.rank(),"of",mpi.comm.size())) # Tell all slaves to close down, and exit the program mpi.close.Rslaves() mpi.quit() My output is as follows; > source("./test_Rmpi.R") 3 slaves are spawned successfully. 0 failed. master (rank 0, comm 1) of size 4 is running on: minanha slave1 (rank 1, comm 1) of size 4 is running on: minanha slave2 (rank 2, comm 1) of size 4 is running on: minanha slave3 (rank 3, comm 1) of size 4 is running on: minanha While trying to parallelize one of my other functions, I found that the master seems to be sending the messages and executing its portion of the program, but the slaves are not responding. However, the slaves do seem to send the initial message to the master that they are ready to receive a job, which prompts the master to send the job. So, noticing that problem, I tried to execute the 'hello world' program above and, as you can see, the slaves are spawned, but they won't print the text in the mpi.remote.exec() function. Any ideas? Chris ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.