Home
Add Document
Sign In
Create An Account
Parallel programming in R
Recommend Documents
No documents
Parallel programming in R
Download PDF
57 downloads
33004 Views
217KB Size
Report
Comment
Parallel programming in R. Bjørn-Helge Mevik. Research Infrastructure Services Group, USIT, UiO. RIS Course Week spring 2013. Bjørn-Helge Mevik (RIS).
Parallel programming in R Bjørn-Helge Mevik Research Infrastructure Services Group, USIT, UiO
RIS Course Week spring 2013
Bjørn-Helge Mevik (RIS)
Parallel programming in R
Course Week spring 2013
1 / 13
Introduction
Simple example
Practical use
The end. . .
Bjørn-Helge Mevik (RIS)
Parallel programming in R
Course Week spring 2013
2 / 13
Introduction
Background
I
R is single-threaded
I
There are several packages for parallel computation in R, some of which have existed a long time, e.g. Rmpi, nws, snow, sprint, foreach, multicore
I
As of 2.14.0, R ships with a package parallel
I
R can also be compiled against multi-threaded linear algebra libraries (BLAS, LAPACK) which can speed up calculations
Today’s focus is the parallel package.
Bjørn-Helge Mevik (RIS)
Parallel programming in R
Course Week spring 2013
3 / 13
Introduction
Overview of parallel I
Introduced in 2.14.0
I
Based on packages multicore and snow (slightly modified)
I
Includes a parallel random number generator (RNG); important for simulations
I
Particularly suitable for ’single program, multiple data’ (SPMD) problems
I
Main interface is parallel versions of lapply and similar
I
Can use the CPUs/cores on a single machine (multicore), or several machines, using MPI (snow)
I
MPI support depends on the Rmpi package (installed on Abel)
Bjørn-Helge Mevik (RIS)
Parallel programming in R
Course Week spring 2013
4 / 13
Simple example
Simple example: serial I
parallel provides substitutes for lapply, etc.
I
’Silly’ example for illustration: caluclate (1:100)ˆ2
Serial version: ## The worker function to do the calculation: workerFunc
×
Report "Parallel programming in R"
Your name
Email
Reason
-Select Reason-
Pornographic
Defamatory
Illegal/Unlawful
Spam
Other Terms Of Service Violation
File a copyright complaint
Description
×
Sign In
Email
Password
Remember me
Forgot password?
Sign In
Our partners will collect data and use cookies for ad personalization and measurement.
Learn how we and our ad partner Google, collect and use data
.
Agree & close