[R-sig-hpc] Rmpi with Open MPI on Debian

Dirk Eddelbuettel edd at debian.org
Wed Feb 11 16:25:26 CET 2009


On 11 February 2009 at 13:49, Sklyar, Oleg \(London\) wrote:
| I had the same problem with RHEL5 and the main problem was the lack of
| documentation.

Yes, there is a bit of experimentation required which is why I hoped that my
'cookbook' examples in the tutorial would help.  They help me when I can't
remember how I did something two months prior ...

| What you might want is to look into
| /etc/openmpi-default-hostfile, which in my case had to be populated
| with:
| 
| mynode1 slots=7
| mynode2 slots=7 
| 
| etc. You might also want to try and create a local user-specific
| hostfile if default OpenMPI configuration on Debian supports that,
| pretty much with the same contents located in ~/.openmpi/hostfile

AFAIK ortrun allows you either do that on the cmd line or via the config
file. The config file is not mandatory/
 
| Both worked for me. However Rmpi still reports that the universe size is
| 1, i.e. in conctrast to LAM I could not rely on that value to get the
| number of CPUs I can use w/o LB.

Well as I mentioned to Ingeborg in private email (before I convinced her to
post here, many eyeballs principle etc):

edd at ron:~/src/latex/conferences/bocDec2008/scripts/parallel$ orterun -n 2 ./helloMPIworld.r
Hello, rank 0 size 2 on ron 
Hello, rank 1 size 2 on ron 
edd at ron:~/src/latex/conferences/bocDec2008/scripts/parallel$ cat helloMPIworld.r
#!/usr/bin/env r

library(Rmpi)	# calls MPI_Init

rk <- mpi.comm.rank(0)
sz <- mpi.comm.size(0)
name <- mpi.get.processor.name()
cat("Hello, rank", rk, "size", sz, "on", name, "\n")

#if (mpi.is.master()) mpi.finalize()
mpi.quit()
edd at ron:~/src/latex/conferences/bocDec2008/scripts/parallel$ 

The same works perfectly fine for me at work with multiple hosts (which I
can't do at home as the Ubuntu boxen still run OMPI 1.2.8 where my Debian
server runs 1.3).

I think Ingeborg's problem is in

   orterun --hostfile MYHOSTFILE -n CPUNUMBER Rslaves.sh RTest.R testlog needlog /PATH/TO/R

the direct use of Rslaves.sh.  This spawns n masters, not one master and in a
rank of n.  I had more luck with 'litter' scripts (easy for Ingeborg after
"apt-get install littler") and Rscript may work too.

All the invocations gets trickier once you put slurm of top of it -- but
there are ways to do it as the aforementioned tutorial shows.  My favourite
allows you say on the command-line how many nodes you have and everything
then just flows through. So no hard-coded number of slaves etc pp.

I'd love to hear what other tricks people have come up with.

Hth, Dirk

| 
| Dr Oleg Sklyar
| Research Technologist
| AHL / Man Investments Ltd
| +44 (0)20 7144 3107
| osklyar at maninvestments.com 
| 
| > -----Original Message-----
| > From: r-sig-hpc-bounces at r-project.org 
| > [mailto:r-sig-hpc-bounces at r-project.org] On Behalf Of Ingeborg Schmidt
| > Sent: 11 February 2009 13:33
| > To: r-sig-hpc at r-project.org
| > Subject: [R-sig-hpc] Rmpi with Open MPI on Debian
| > 
| > Hello,
| > I wish to use Rmpi with Open MPI on Debian. Slaves should be 
| > spawned on serveral computers which should be able to 
| > communicate with a single master. However, there does not 
| > seem to be a default hostfile for Open MPI that is used. So when I use
| > library(Rmpi)
| > mpi.spawn.Rslaves()
| > it only spawns one slaves on the localhost instead of several 
| > thereads on all my computers. I am unable to find any useful 
| > documentation of Open MPI (yes, I checked the FAQ on 
| > open-mpi.org). Is there such a thing as a default hostfile 
| > that is used when calling mpi.spawn.Rslaves() ? Or is there 
| > any other way to use mpi.spawn.Rslaves() with Open MPI so 
| > that slaves are spawned across multiple computers?
| > 
| > I am unsure about calling R via orterun. The only tutorials 
| > regarding orterun and R I found (e.g. 
| > http://dirk.eddelbuettel.com/papers/bocDec2008introHPCwithR.pd
| > f ) seemed to imply that there either is no master or the 
| > master identifies itself by looking at it's mpi.comm.rank() . 
| > Moreover running
| > paste("I am", mpi.comm.rank(), "of", mpi.comm.size())
| > via
| > orterun --hostfile MYHOSTFILE -n CPUNUMBER Rslaves.sh RTest.R 
| > testlog needlog /PATH/TO/R
| > results in
| > "I am 0 of 0"
| > on every node.
| > This is not what I want, I would like only the master to 
| > execute my R script and send relevant methods to the slaves 
| > via mpi.bcast.Robj2slave(). My code contains commands like 
| > mpi.remote.exec() which I would like to keep. I have not yet 
| > seen any examples that are able to combine calling R via 
| > orterun with communication between the slaves with 
| > mpi.remote.exec() etc.
| > 
| > By the way: Can you recommend a method to lower the thread 
| > priory of the R slaves so that other calculations done on the 
| > same computers are not disturbed? Is placing a nice (Linux 
| > command to lower thread priority) before R in the Rslaves.sh 
| > sufficient when using mpi.spawn.Rslaves()?
| > 
| > Cheers,
| > Ingeborg Schmidt
| > 
| > 
| > 
| > 
| > _______________________________________________
| > R-sig-hpc mailing list
| > R-sig-hpc at r-project.org
| > https://stat.ethz.ch/mailman/listinfo/r-sig-hpc
| > 
| 
| **********************************************************************
| Please consider the environment before printing this email or its attachments.
| The contents of this email are for the named addressees ...{{dropped:19}}
| 
| _______________________________________________
| R-sig-hpc mailing list
| R-sig-hpc at r-project.org
| https://stat.ethz.ch/mailman/listinfo/r-sig-hpc

-- 
Three out of two people have difficulties with fractions.



More information about the R-sig-hpc mailing list