[R] Installing Rmpi on Fedora Linux [was: Re: help installing Rmpi]
Allan Engelhardt
allane at cybaea.com
Fri Jun 12 11:59:58 CEST 2009
On 11/06/09 22:46, ALAN SMITH wrote:
> Hello R users and developers,
> I would like to install Rmpi so that I may take advantage of all of
> the CPUs in my computer
Package "multicore" *may* be easier for this.
> , but I cannot get it to install [...]
The configuration file for Rmpi is, unfortunately, completely
brain-damaged with hard-coded assumptions about which subdirectories
should contain header and library files and no way of overriding it.
This is what I did:
> [...]
> #I have tried two different ways to install openMPI in fedora in the linux shell
In any recent version of Fedora don't do any of what you suggest; instead do
# yum install openmpi openmpi-devel openmpi-libs
Then *download* the Rmpi package and unpack it using something like
$ tar xvf Rmpi_0.5-7.tar.gz
(version number may be different).
Then go into the Rmpi directory and change configure.ac. If you are on
a x86_64 platform, the following hack should work (for 32 bit try
s/64/32/g):
+++[cut here]+++
Process this file with autoconf to produce a configure script.
AC_INIT(DESCRIPTION)
AC_PROG_CC
MPI_LIBS=`pkg-config --libs openmpi-1.3.1-gcc-64`
MPI_INCLUDE=`pkg-config --cflags openmpi-1.3.1-gcc-64`
MPITYPE="OPENMPI"
MPI_DEPS="-DMPI2"
AC_CHECK_LIB(util, openpty, [ MPI_LIBS="$MPI_LIBS -lutil" ])
AC_CHECK_LIB(pthread, main, [ MPI_LIBS="$MPI_LIBS -lpthread" ])
PKG_LIBS="${MPI_LIBS} -fPIC"
PKG_CPPFLAGS="${MPI_INCLUDE} ${MPI_DEPS} -D${MPITYPE} -fPIC"
AC_SUBST(PKG_LIBS)
AC_SUBST(PKG_CPPFLAGS)
AC_SUBST(DEFS)
AC_OUTPUT(src/Makevars)
---[cut here]---
The number 1.3.1 may change in future updates to Fedora, I guess....
Now (still in Rmpi directory) do
$ autoconf
$ cd ..
$ tar zcvf Rmpi-0.5-7-F1.tar.gz Rmpi
$ R CMD INSTALL Rmpi-0.5-7-F1.tar.gz
Which more-or-less works in R:
> library("Rmpi")
> mpi.spawn.Rslaves(nslaves=2)
2 slaves are spawned successfully. 0 failed.
master (rank 0, comm 1) of size 3 is running on: server
slave1 (rank 1, comm 1) of size 3 is running on: server
slave2 (rank 2, comm 1) of size 3 is running on: server
> x=c(10,20)
> mpi.apply(x,runif)
[[1]]
[1] 0.25142616 0.93505554 0.03162852 0.71783194 0.35916139 0.85082154
[7] 0.35404191 0.14221315 0.60063773 0.71805190
[[2]]
[1] 0.84157864 0.63481773 0.38217188 0.67839089 0.27827728 0.35429266
[7] 0.04898744 0.96601584 0.25687905 0.77381186 0.69011927 0.37391028
[13] 0.19017369 0.51196594 0.51970563 0.15791524 0.21358237 0.69642478
[19] 0.12690207 0.44177656
>
Hope this helps!
Allan.
More information about the R-help
mailing list