[R] problem with mpiexec and Rmpi

Martin Morgan mtmorgan at fhcrc.org
Wed Jul 2 01:55:43 CEST 2008


Hi Erin --

"Erin Hodgess" <erinm.hodgess at gmail.com> writes:

> Dear R People:
>
> I'm having some trouble with mpiexec and Rmpi.
>
> I would like to be able to pass in the number of "children" via the
> mpiexec command (from the command line).
>
> this is in SUSE10.1, with R-2.7.1
>
> Here are my files:
>  cat eb.R
> library(Rmpi)
> mpi.remote.exec(paste("i am",mpi.comm.rank(),"of",mpi.comm.size()))
> mpi.quit()
> hodgesse at erinstoy:~/Desktop/R-2.7.1/bin> cat e.in
> source("eb.R")
>
> hodgesse at erinstoy:~/Desktop/R-2.7.1/bin> mpiexec -n 3 ./R --no-save -q
> -f e.in >e.out

With a hostfile
<<hostfile>>
localhost slots=4

You can start 1 process and have access to a defined universe
<<batch0.R>>
library(Rmpi)
mpi.universe.size()
mpi.spawn.Rslaves()
unlist(mpi.remote.exec(paste(mpi.comm.rank())))
mpi.quit()

mtmorgan at lamprey:~/tmp> mpirun -np 1 --hostfile hostfile R --slave -f batch0.R
[1] 4
        4 slaves are spawned successfully. 0 failed.
master (rank 0, comm 1) of size 5 is running on: lamprey 
slave1 (rank 1, comm 1) of size 5 is running on: lamprey 
slave2 (rank 2, comm 1) of size 5 is running on: lamprey 
slave3 (rank 3, comm 1) of size 5 is running on: lamprey 
slave4 (rank 4, comm 1) of size 5 is running on: lamprey 
slave1 slave2 slave3 slave4
   "1"    "2"    "3"    "4"

A different style of programming (single program multiple data) is

<<batch1.R>>
## everybody does this...
library("Rmpi")
id <- mpi.comm.rank(0) ## different data!
allIds <- mpi.gather.Robj(id, 0, 0)

## rank 0 does this...
if (mpi.comm.rank(0) == 0)
    print(allIds)

## everybody does this...
mpi.quit()

mtmorgan at lamprey:~/tmp> mpirun -np 10 R --slave -f batch1.R
 [1] 0 1 2 3 4 5 6 7 8 9

Note the '0' argument for comm, overriding 1 (the default; a more
robust program would manage the communicators better).

mtmorgan at lamprey:~/tmp> mpirun --version
mpirun (Open MPI) 1.2

Martin

> Error in mpi.remote.exec(paste("i am", mpi.comm.rank(), "of",
> mpi.comm.size())) :
>   It seems no slaves running.
> Calls: source -> eval.with.vis -> eval.with.vis -> mpi.remote.exec
> Error in mpi.remote.exec(paste("i am", mpi.comm.rank(), "of",
> mpi.comm.size())) :
>   It seems no slaves running.
> Calls: source -> eval.with.vis -> eval.with.vis -> mpi.remote.exec
> Error in mpi.remote.exec(paste("i am", mpi.comm.rank(), "of",
> mpi.comm.size())) :
>   It seems no slaves running.
> Calls: source -> eval.with.vis -> eval.with.vis -> mpi.remote.exec
> hodgesse at erinstoy:~/Desktop/R-2.7.1/bin>
>
> Does anyone have any suggestions, please?  The scary part:  I can get
> this to work on Windows but not on SUSE10.1
>
> thanks in advance,
> Sincerely,
> Erin
>
>
> Erin Hodgess
> Associate Professor
> Department of Computer and Mathematical Sciences
> University of Houston - Downtown
> mailto: erinm.hodgess at gmail.com
>
> ______________________________________________
> R-help at 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.

-- 
Martin Morgan
Computational Biology / Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N.
PO Box 19024 Seattle, WA 98109

Location: Arnold Building M2 B169
Phone: (206) 667-2793



More information about the R-help mailing list