Wednesday, January 14, 2009
Rmpi on a multiple-cpu pc under linux system
RMPI: An R package that can execute message passing interface, which allows parellel computaion in R enviroment.
On an multiple cpu computer such as Dell insprion 530, on can run RMPI for parellel compution. Suppose Rmpi has been
installed completely in R following the instruction (rmpi README file).
Open a Terminal, type
greenlinux4r@greenlinux4r-desktop:~$ lamclean
greenlinux4r@greenlinux4r-desktop:~$ lamboot -v
LAM 7.1.2/MPI 2 C++/ROMIO - Indiana University
n-1<6366> ssi:boot:base:linear: booting n0 (localhost)
n-1<6366> ssi:boot:base:linear: finished
greenlinux4r@greenlinux4r-desktop:~$ mpiexec -n 4 R --no-save -q
master (rank 0, comm 1) of size 4 is running on: greenlinux4r-desktop
slave1 (rank 1, comm 1) of size 4 is running on: greenlinux4r-desktop
slave2 (rank 2, comm 1) of size 4 is running on: greenlinux4r-desktop
slave3 (rank 3, comm 1) of size 4 is running on: greenlinux4r-desktop
One master and three co-working CPUs have been activated for use.
Now, run R code to let the co-working CPUS to identify themselves.
mpi.remote.exec(paste("I am",mpi.comm.rank(),"of",mpi.comm.size()))
$slave1
[1] "I am 1 of 4"
$slave2
[1] "I am 2 of 4"
$slave3
[1] "I am 3 of 4"
All co-working CPUS can be closed and Rmpi can be exited using
> mpi.close.Rslaves()
[1] 1
> mpi.quit([saving=yes/no])
type in yes to save workplace, otherwise no.
Subscribe to:
Posts (Atom)