Download Programming on Parallel Machines - matloff

Transcript
140
CHAPTER 8. INTRODUCTION TO PARALLEL R
8.2
Some Parallel R Packages
Here are a few parallel R packages:
• Message-passing or quasi-message passing: Rmpi, snow, foreach
• Shared-memory: Rdsm, bigmemory
• GPU: gputools, rgpu
A far more extensive list is at http://cran.r-project.org/web/views/HighPerformanceComputing.
html.
Some of these packages will be covered in the following sections.
8.3
Installing the Packages
With the exception of Rgpu, all of the packages above are downloadable/installable from CRAN, the official
R repository for contributed code. Here’s what to do, say for Rmpi:
Suppose you want to install in the directory /a/b/c/. The easiest way to do so is use R’s install.packages()
function, say:
> i n s t a l l . p a c k a g e s ( ” Rmpi ” , ” / a / b / c / ” )
This will install Rmpi in the directory /a/b/c/Rmpi.
You’ll need to arrange for the directory /a/b/c (not /a/b/c/Rmpi) to be added to your R library search path.
I recommend placing a line
. libPaths (”/ a /b/ c /”)
in a file .Rprofile in your home directory (this is an R startup file).
In some cases, due to issues such as locations of libraries, you may need to install a CRAN package “by
hand.” See Section 8.7.1 and 8.7.3 below.
8.4
Rmpi
The Rmpi package provides an interface from R to MPI. (MPI is covered in detail in Chapter 6. Its author
is Hao Yu of the University of Western Ontario.