Skip to content
Prev 1972 / 2152 Next

I can do mpi.apply but not foreach with doMPI

Great, thank you Stephen! Yes, we use Open MPI. The reason I used the Rprofile way is that it was the only way to do MPI related R stuff the existing guides here mentioned. That lead me to believe that it was what I should do, but ok, that's what I need to understand next (and then prompt for better guides!)

And thank you George as well, you've answered questions I didn't yet know how to formulate :) Very much appreciated.

BR,
Seija S.

----- Original Message -----
From: "Stephen Weston" <stephen.b.weston at gmail.com>
To: "Seija Sirki?" <seija.sirkia at csc.fi>
Cc: "r-sig-hpc" <r-sig-hpc at r-project.org>
Sent: Wednesday, 26 August, 2015 16:35:14
Subject: Re: [R-sig-hpc] I can do mpi.apply but not foreach with doMPI

Hi Seija,

To use doMPI, you shouldn't start the workers in an Rprofile as
described in the Rmpi documentation since those workers can only be
used by functions in the Rmpi package such as mpi.apply. In other
words, you don't want to see messages like:

  master (rank 0, comm 1) of size 4 is running on: c1
  slave1 (rank 1, comm 1) of size 4 is running on: c1

When using doMPI from an interactive R session, the workers shouldn't
be started until you execute "startMPIcluster()":

 > cl <- startMPIcluster(3)
         3 slaves are spawned successfully. 0 failed.

What MPI implementation are you using?  I believe the only reason to
start the workers in an Rprofile is if your MPI implementation doesn't
have spawn support. Open MPI has great spawn support and is able to
spawn workers from an interactive R session.  MPICH2 has spawn
support, but I believe it can only spawn workers if the R session was
started via mpirun, so I think that Open MPI is preferable for use
with Rmpi.

Even if you're using an MPI implementation without spawn support,
doMPI can use workers that are all started by mpirun. However, you do
need spawn support to start workers from an interactive R with doMPI.

Regards,

Steve Weston
On Wed, Aug 26, 2015 at 4:12 AM, Seija Sirki? <seija.sirkia at csc.fi> wrote: