From David.Teller at nielsen.com  Mon May 25 19:25:50 2015
From: David.Teller at nielsen.com (Teller, David)
Date: Mon, 25 May 2015 17:25:50 +0000
Subject: [Rd] foreach hangs when using doMPI on Windows with Microsoft MPI
Message-ID: <BY1PR0701MB187888302F4588EC635ACB3E95CD0@BY1PR0701MB1878.namprd07.prod.outlook.com>

??I installed Microsoft MPI.

Then installed the foreach and Rmpi packages.

Then built doMPI from source.


mpi.remote.exec works.

foreach hangs with the main process and all worker processes idle.


I launch my script with mpiexec:


"C:\Program Files\Microsoft MPI\Bin\mpiexec" -n 3 "C:\Program Files\R\R-3.2.0\bin\x64\Rterm.exe" --no-save -q -f "MPI Test.r"

The script is:


library(Rmpi)
library(doMPI)
library(foreach)


cl <- startMPIcluster()
print(cl)

registerDoMPI(cl)


mpi.remote.exec(paste(Sys.info()[['nodename']], Sys.getpid(), mpi.comm.rank(), "of", mpi.comm.size()))


# Hangs at this point

# Main process and worker processes are all idle

ni <- foreach(i=1:10) %dopar% {
  paste(Sys.info()[['nodename']], Sys.getpid(), mpi.comm.rank(), "of", mpi.comm.size())
}


mpi.close.Rslaves()
mpi.quit()

Prints:


C:\Users\dteller\Documents\MPI>"C:\Program Files\Microsoft MPI\Bin\mpiexec" -n 3
 "C:\Program Files\R\R-3.2.0\bin\x64\Rterm.exe" --no-save -q -f "MPI Test.r"
master (rank 0, comm 1) of size 3 is running on: dteller-dv7
slave1 (rank 1, comm 1) of size 3 is running on: dteller-dv7
slave2 (rank 2, comm 1) of size 3 is running on: dteller-dv7
> library(Rmpi)
> library(doMPI)
Loading required package: foreach
Loading required package: iterators
> library(foreach)
>
> cl <- startMPIcluster()
> print(cl)
$comm
[1] 0

$workerCount
[1] 2

$workerid
[1] 0

$verbose
[1] FALSE

$mtag
[1] 10

$wtag
[1] 11

attr(,"class")
[1] "mpicluster"   "dompicluster"
> registerDoMPI(cl)
>
> mpi.remote.exec(paste(Sys.info()[['nodename']], Sys.getpid(), mpi.comm.rank(),
 "of", mpi.comm.size()))
$slave1
[1] "DTELLER-DV7 1116 1 of 3"

$slave2
[1] "DTELLER-DV7 9436 2 of 3"

>
> ni <- foreach(i=1:10) %dopar% {
+   paste(Sys.info()[['nodename']], Sys.getpid(), mpi.comm.rank(), "of", mpi.com
m.size())
+ }



Thanks for any help.


Dave Teller



	[[alternative HTML version deleted]]



[Rd] foreach hangs when using doMPI on Windows with Microsoft MPI
Teller, David