The Art of R Programming

(WallPaper) #1

16


PARALLEL R


Since many R users have very large compu-
tational needs, various tools for some kind
of parallel operation of R have been devised.
This chapter is devoted to parallel R.
Many a novice in parallel processing has, with great anticipation, written
parallel code for some application only to find that the parallel version actu-
ally ran more slowly than the serial one. For reasons to be discussed in this
chapter, this problem is especially acute with R.
Accordingly, understanding the nature of parallel-processing hardware
and software is crucial to success in the parallel world. These issues will be
discussed here in the context of common platforms for parallel R.
We’ll start with a few code examples and then move to general perfor-
mance issues.

16.1 The Mutual Outlinks Problem.................................................


Consider a network graph of some kind, such as web links or links in a social
network. LetAbe theadjacency matrixof the graph, meaning that, say,A[3,8]
is 1 or 0, depending on whether there is a link from node 3 to node 8.
For any two vertices, say any two websites, we might be interested in
mutual outlinks—that is, outbound links that are common to two sites. Sup-
pose that we want to find the mean number of mutual outlinks, averaged
Free download pdf