Re: [R] problem with mpiexec and Rmpi

From: Martin Morgan <mtmorgan_at_fhcrc.org>
Date: Tue, 01 Jul 2008 16:55:43 -0700

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

______________________________________________
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.
Received on Tue 01 Jul 2008 - 23:59:07 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 02 Jul 2008 - 00:31:26 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive