SlideShare ist ein Scribd-Unternehmen logo
1 von 42
Parallel Computing in R
      2010/05/09 Tsukuba.R#7
            id:mickey24
id: mickey24 (@mickey24)
Tsukuba.R
Tsukuba.R#4
   •R           Brainf*ck
     •   Brainf*ck

> hello <- "+++++++++[>++++++++>++++++++++
+>+++++<<<-]>.>++.+++++++..++
+.>-.------------.<++++++++.--------.++
+.------.--------.>+."
> brainfxxk(hello)
[1] "Hello, world!"

                        http://www.slideshare.net/mickey24/rbrainfck-1085191
Tsukuba.R#5
• Animation with R
 • library(animation)




                        http://d.hatena.ne.jp/mickey24/20090614
Tsukuba.R#6
• Extend R with C!!!
 •   C   R             (C             OpenCV                 )




                 http://d.hatena.ne.jp/mickey24/20091123/r_de_extension
Tsukuba.R#7
•
•n   snow

•
n
•

    •   CPU


          !"#!                 !"#!


                               !"#!
                 !!!!




                        !!!!




                               !!!!
                               !"#!
1CPU
sapply(1:8, function(x){ x^2 })



                  (function(x){x^2})(1)
                  (function(x){x^2})(2)
                  (function(x){x^2})(3)
                  (function(x){x^2})(4)
           !"#!   (function(x){x^2})(5)
                  (function(x){x^2})(6)
                  (function(x){x^2})(7)
                  (function(x){x^2})(8)




 [1]   1   4   9 16 25 36 49 64
4CPU
               sapply(1:8, function(x){ x^2 })




(function(x){x^2})(1)   (function(x){x^2})(3)   (function(x){x^2})(5)   (function(x){x^2})(7)
(function(x){x^2})(2)   (function(x){x^2})(4)   (function(x){x^2})(6)   (function(x){x^2})(8)


        !"#!                    !"#!                    !"#!                   !"#!




                   [1]      1      4     9 16 25 36 49 64
•
    •
•
    •      1CPU   1
    → 100CPU
    → 10
R
•   snow
    •   R

    •   http://cran.r-project.org/web/packages/snow/index.html

•   R       apply


•
    •   Socket PVM MPI
n
snow
snow
•   2CPU


    •
    •      CPU
•   snow



> install.packages("snow")


•
    •
matprod.R
•   1000


n <- 1000
A <- matrix(rnorm(n^2), n)
B <- matrix(rnorm(n^2), n)

C <- A %*% B


•
clmatprod.R
library(snow)

n <- 1000
A <- matrix(rnorm(n^2), n)
B <- matrix(rnorm(n^2), n)

cpu <- 2
hosts <- rep("localhost", cpu)

cl <- makeCluster(hosts, type="SOCK")
C <- parMM(cl, A, B) # C <- A %*% B
stopCluster(cl)
•
> source("clmatprod.R")


•
> head(C)
•
    •   parMM(cl, A, B)


•              apply
    •   parApply(cl, X, MARGIN, fun, ...)
    •   parLapply(cl, X, fun, ...)
    •   parSapply(cl, X, fun, ..., simplify=TRUE, USE.NAMES=TRUE)
    •   etc.


•
    •   clusterMap(cl, fun, ..., MoreArgs = NULL, RECYCLE = TRUE)
    •   clusterCall(cl, fun, ...)
    •   etc.


•              help       (?parApply,   ?clusterMap   )
snow
•
 • snow
     •    mCPU n

     •    O(n^3)
                                          #!
                $!


!"#!     !"#!   !"#!   !!!!   !"#!
                                     #!
                                          !!   "!
•   1CPU(        )

        system.time(A %*% B)



•   mCPU (   )

    system.time(parMM(cl, A, B))
•                 @DBCLS
    •
        •   Sun Grid Engine OpenMPI

    •
@DBCLS
        1          8
CPU         8CPU   64CPU
            16GB   128GB


      !"#$!        !"#$!


      !"#$!        !"#$!


      !"#$!        !"#$!


      !"#$!        !"#$!
1000
   (   )

3.00

2.50

2.00

1.50

1.00
                                     Faster!
0.50

  0
           1      4        8   16   CPU


               4CPU 1.14
3000
    (   )

40.00



30.00



20.00



10.00                                 Faster!

   0
            1      4        8   16   CPU


                8CPU 2.70
•   snow


•                                            C


    •         C R                      (40       50 )
              www
        http://d.hatena.ne.jp/
        syou6162/20090117/1232120983
•   snow

    •   snow Simplified
        http://www.sfu.ca/~sblay/R/snow.html
    •   RjpWiki - R
        http://www.okada.jp.org/RWiki/?R%A4%C7%CA%C2%CE%F3%B7%D7%BB%BB
    •   RjpWiki - L.Tierney    snow
        http://www.okada.jp.org/RWiki/?L.%20Tierney%BB%E1%A4%CEsnow
        %A5%D1%A5%C3%A5%B1%A1%BC%A5%B8%A4%C7%A5%AF
        %A5%E9%A5%B9%A5%BF%B7%D7%BB%BB%A4%F2%B9%D4%A4%A6#scce80a1
•   Rmpi + snow + Sun Grid Engine
    •   Scheduled Parallel Computing with R: R + Rmpi + OpenMPI + Sun Grid Engine
        (SGE)
        http://blog.nguyenvq.com/2010/01/20/scheduled-parallel-computing-with-r-r-rmpi-
        openmpi-sun-grid-engine-sge/
R+
Sun Grid Engine +
  Open MPI +
     snow
•                    @DBCLS


    •   Sun Grid Engine

    •   OpenMPI
        •   mpirun        R

    •   Rmpi    snow OpenMPI


•
    •
•
       •   Rmpi   OpenMPI

       •   snow    Rmpi

> install.packages("Rmpi", configure.args=
"/path/to/mpidir")
> install.packages("snow")
gmatprod.R
library(Rmpi)
library(snow)

n <- 1000
A <- matrix(rnorm(n^2), n)
B <- matrix(rnorm(n^2), n)

cl <- makeCluster()    #
C <- parMM(cl, A, B)   # C <- A %*% B
stopCluster(cl)
gmatprod.sh
#!/bin/bash

#$ -S /bin/bash    #               /bin/bash
#$ -j y            # stdout   stderr   -o
#$ -o gmatprod.log # stdout   stderr
#$ -pe openmpi 8   #


export PATH=[path to R & snow_install_dir & mpirun]:$PATH
export LD_LIBRARY_PATH=/path/to/mpidir/lib:$LD_LIBRARY_PATH

MPIRUN_PATH=/path/to/mpirun
MPIRUN_OPTS="-np ${NSLOTS} -machinefile ${TMPDIR}/machines"

RSCRIPT=gmatprod.R
RPATH=/path/to/snow_install_dir/RMPISNOW
CMD="${RPATH} CMD BATCH --no-save ${RSCRIPT}"

${MPIRUN_PATH} ${MPIRUN_OPTS} ${CMD}
• qsub      Grid Engine


$ qsub gmatprod.sh
•
    •   Scheduled Parallel Computing with R: R + Rmpi + OpenMPI +
        Sun Grid Engine (SGE)
        http://blog.nguyenvq.com/2010/01/20/scheduled-parallel-
        computing-with-r-r-rmpi-openmpi-sun-grid-engine-sge/


• Sun Grid Engine                  MPI               R

Weitere ähnliche Inhalte

Was ist angesagt?

Queue in swift
Queue in swiftQueue in swift
Queue in swiftjoonjhokil
 
Query History of a Software Project
Query History of a Software ProjectQuery History of a Software Project
Query History of a Software Projectstevensreinout
 
Bytes in the Machine: Inside the CPython interpreter
Bytes in the Machine: Inside the CPython interpreterBytes in the Machine: Inside the CPython interpreter
Bytes in the Machine: Inside the CPython interpreterakaptur
 
"A 1,500 line (!!) switch statement powers your Python!" - Allison Kaptur, !!...
"A 1,500 line (!!) switch statement powers your Python!" - Allison Kaptur, !!..."A 1,500 line (!!) switch statement powers your Python!" - Allison Kaptur, !!...
"A 1,500 line (!!) switch statement powers your Python!" - Allison Kaptur, !!...akaptur
 
Wprowadzenie do technologi Big Data i Apache Hadoop
Wprowadzenie do technologi Big Data i Apache HadoopWprowadzenie do technologi Big Data i Apache Hadoop
Wprowadzenie do technologi Big Data i Apache HadoopSages
 
OCamlOScope: a New OCaml API Search
OCamlOScope: a New OCaml API SearchOCamlOScope: a New OCaml API Search
OCamlOScope: a New OCaml API SearchJun Furuse
 
Powered by Python - PyCon Germany 2016
Powered by Python - PyCon Germany 2016Powered by Python - PyCon Germany 2016
Powered by Python - PyCon Germany 2016Steffen Wenz
 
Something about Golang
Something about GolangSomething about Golang
Something about GolangAnton Arhipov
 
Data Types and Processing in ES6
Data Types and Processing in ES6Data Types and Processing in ES6
Data Types and Processing in ES6m0bz
 
Event Loop in Javascript
Event Loop in JavascriptEvent Loop in Javascript
Event Loop in JavascriptDiptiGandhi4
 
Apache Hadoop for System Administrators
Apache Hadoop for System AdministratorsApache Hadoop for System Administrators
Apache Hadoop for System AdministratorsAllen Wittenauer
 
RxJS 5 in Depth
RxJS 5 in DepthRxJS 5 in Depth
RxJS 5 in DepthC4Media
 
ggExtra Package-ggMarginal and Example -Shiny and Shinyjs
ggExtra Package-ggMarginal and Example -Shiny and ShinyjsggExtra Package-ggMarginal and Example -Shiny and Shinyjs
ggExtra Package-ggMarginal and Example -Shiny and ShinyjsDr. Volkan OBAN
 
Rubyconfindia2018 - GPU accelerated libraries for Ruby
Rubyconfindia2018 - GPU accelerated libraries for RubyRubyconfindia2018 - GPU accelerated libraries for Ruby
Rubyconfindia2018 - GPU accelerated libraries for RubyPrasun Anand
 
The Art of Command Line (2021)
The Art of Command Line (2021)The Art of Command Line (2021)
The Art of Command Line (2021)Kenta Yamamoto
 

Was ist angesagt? (20)

Queue in swift
Queue in swiftQueue in swift
Queue in swift
 
Query History of a Software Project
Query History of a Software ProjectQuery History of a Software Project
Query History of a Software Project
 
Bytes in the Machine: Inside the CPython interpreter
Bytes in the Machine: Inside the CPython interpreterBytes in the Machine: Inside the CPython interpreter
Bytes in the Machine: Inside the CPython interpreter
 
"A 1,500 line (!!) switch statement powers your Python!" - Allison Kaptur, !!...
"A 1,500 line (!!) switch statement powers your Python!" - Allison Kaptur, !!..."A 1,500 line (!!) switch statement powers your Python!" - Allison Kaptur, !!...
"A 1,500 line (!!) switch statement powers your Python!" - Allison Kaptur, !!...
 
Jan 2012 HUG: RHadoop
Jan 2012 HUG: RHadoopJan 2012 HUG: RHadoop
Jan 2012 HUG: RHadoop
 
Recognize Godzilla
Recognize GodzillaRecognize Godzilla
Recognize Godzilla
 
Wprowadzenie do technologi Big Data i Apache Hadoop
Wprowadzenie do technologi Big Data i Apache HadoopWprowadzenie do technologi Big Data i Apache Hadoop
Wprowadzenie do technologi Big Data i Apache Hadoop
 
OCamlOScope: a New OCaml API Search
OCamlOScope: a New OCaml API SearchOCamlOScope: a New OCaml API Search
OCamlOScope: a New OCaml API Search
 
Powered by Python - PyCon Germany 2016
Powered by Python - PyCon Germany 2016Powered by Python - PyCon Germany 2016
Powered by Python - PyCon Germany 2016
 
Something about Golang
Something about GolangSomething about Golang
Something about Golang
 
Hadoop I/O Analysis
Hadoop I/O AnalysisHadoop I/O Analysis
Hadoop I/O Analysis
 
Data Types and Processing in ES6
Data Types and Processing in ES6Data Types and Processing in ES6
Data Types and Processing in ES6
 
Event Loop in Javascript
Event Loop in JavascriptEvent Loop in Javascript
Event Loop in Javascript
 
Tracing and awk in ns2
Tracing and awk in ns2Tracing and awk in ns2
Tracing and awk in ns2
 
Apache Hadoop for System Administrators
Apache Hadoop for System AdministratorsApache Hadoop for System Administrators
Apache Hadoop for System Administrators
 
RxJS 5 in Depth
RxJS 5 in DepthRxJS 5 in Depth
RxJS 5 in Depth
 
Deep Learning for Developers
Deep Learning for DevelopersDeep Learning for Developers
Deep Learning for Developers
 
ggExtra Package-ggMarginal and Example -Shiny and Shinyjs
ggExtra Package-ggMarginal and Example -Shiny and ShinyjsggExtra Package-ggMarginal and Example -Shiny and Shinyjs
ggExtra Package-ggMarginal and Example -Shiny and Shinyjs
 
Rubyconfindia2018 - GPU accelerated libraries for Ruby
Rubyconfindia2018 - GPU accelerated libraries for RubyRubyconfindia2018 - GPU accelerated libraries for Ruby
Rubyconfindia2018 - GPU accelerated libraries for Ruby
 
The Art of Command Line (2021)
The Art of Command Line (2021)The Art of Command Line (2021)
The Art of Command Line (2021)
 

Andere mochten auch

Not anti government but irrelevant government
Not anti government but irrelevant governmentNot anti government but irrelevant government
Not anti government but irrelevant governmentChristopher Wilson
 
TOI Integrated Business Intelligence Review 06-02 solutions team
TOI Integrated Business Intelligence Review 06-02 solutions teamTOI Integrated Business Intelligence Review 06-02 solutions team
TOI Integrated Business Intelligence Review 06-02 solutions teamDonald Hume
 
Cis017 6 revision-parallel_2015
Cis017 6 revision-parallel_2015Cis017 6 revision-parallel_2015
Cis017 6 revision-parallel_2015abdullah al-Thani
 
Cuadro comparativo modelos y teorías de la psicología
Cuadro comparativo modelos y teorías de la psicologíaCuadro comparativo modelos y teorías de la psicología
Cuadro comparativo modelos y teorías de la psicologíareinamontilla0601
 
Global Medical Cures™ | DIABETES RISK FACTORS
Global Medical Cures™ | DIABETES RISK FACTORSGlobal Medical Cures™ | DIABETES RISK FACTORS
Global Medical Cures™ | DIABETES RISK FACTORSGlobal Medical Cures™
 
17.05.11_Game for visual field deffect
17.05.11_Game for visual field deffect17.05.11_Game for visual field deffect
17.05.11_Game for visual field deffectEri Shiroyama
 
Présentation de la protection des données dans SharePoint - Global Conférence...
Présentation de la protection des données dans SharePoint - Global Conférence...Présentation de la protection des données dans SharePoint - Global Conférence...
Présentation de la protection des données dans SharePoint - Global Conférence...Joris Faure
 
Disorders of consciousness
Disorders of consciousnessDisorders of consciousness
Disorders of consciousnessHena Jawaid
 
Sarah Varian resume 2
Sarah Varian resume 2Sarah Varian resume 2
Sarah Varian resume 2Sarah Varian
 
Origin of India (India Renaissance)
Origin of India (India Renaissance)Origin of India (India Renaissance)
Origin of India (India Renaissance)Trinity Dwarka
 
Module rh de l'ERP Odoo (ex OpenERP)
Module rh de l'ERP Odoo (ex OpenERP)Module rh de l'ERP Odoo (ex OpenERP)
Module rh de l'ERP Odoo (ex OpenERP)Hassan WAHSISS
 
110627 soutenance memoire
110627 soutenance memoire110627 soutenance memoire
110627 soutenance memoireJeenuuke
 
Rapport sur quelques fonctionnalités du module de gestion des ressources huma...
Rapport sur quelques fonctionnalités du module de gestion des ressources huma...Rapport sur quelques fonctionnalités du module de gestion des ressources huma...
Rapport sur quelques fonctionnalités du module de gestion des ressources huma...Hassan WAHSISS
 
ESTUDIO DE LA BIODIVERSIDAD EN COLOMBIA
ESTUDIO DE LA BIODIVERSIDAD EN COLOMBIAESTUDIO DE LA BIODIVERSIDAD EN COLOMBIA
ESTUDIO DE LA BIODIVERSIDAD EN COLOMBIAmdcarvajalm
 

Andere mochten auch (20)

Efruzhu anti̇cancer drug hu north cyprus 29
Efruzhu  anti̇cancer  drug  hu  north  cyprus  29Efruzhu  anti̇cancer  drug  hu  north  cyprus  29
Efruzhu anti̇cancer drug hu north cyprus 29
 
Not anti government but irrelevant government
Not anti government but irrelevant governmentNot anti government but irrelevant government
Not anti government but irrelevant government
 
TOI Integrated Business Intelligence Review 06-02 solutions team
TOI Integrated Business Intelligence Review 06-02 solutions teamTOI Integrated Business Intelligence Review 06-02 solutions team
TOI Integrated Business Intelligence Review 06-02 solutions team
 
Le 18/20 de l'APACOM
Le 18/20 de l'APACOMLe 18/20 de l'APACOM
Le 18/20 de l'APACOM
 
Cis017 6 revision-parallel_2015
Cis017 6 revision-parallel_2015Cis017 6 revision-parallel_2015
Cis017 6 revision-parallel_2015
 
Cuadro comparativo modelos y teorías de la psicología
Cuadro comparativo modelos y teorías de la psicologíaCuadro comparativo modelos y teorías de la psicología
Cuadro comparativo modelos y teorías de la psicología
 
Tecnología educativa
Tecnología educativaTecnología educativa
Tecnología educativa
 
Global Medical Cures™ | DIABETES RISK FACTORS
Global Medical Cures™ | DIABETES RISK FACTORSGlobal Medical Cures™ | DIABETES RISK FACTORS
Global Medical Cures™ | DIABETES RISK FACTORS
 
17.05.11_Game for visual field deffect
17.05.11_Game for visual field deffect17.05.11_Game for visual field deffect
17.05.11_Game for visual field deffect
 
Présentation de la protection des données dans SharePoint - Global Conférence...
Présentation de la protection des données dans SharePoint - Global Conférence...Présentation de la protection des données dans SharePoint - Global Conférence...
Présentation de la protection des données dans SharePoint - Global Conférence...
 
Disorders of consciousness
Disorders of consciousnessDisorders of consciousness
Disorders of consciousness
 
Marka epilepsy
Marka epilepsyMarka epilepsy
Marka epilepsy
 
Sarah Varian resume 2
Sarah Varian resume 2Sarah Varian resume 2
Sarah Varian resume 2
 
Adenekan Adewunmi Isaac CV
Adenekan Adewunmi Isaac CVAdenekan Adewunmi Isaac CV
Adenekan Adewunmi Isaac CV
 
Origin of India (India Renaissance)
Origin of India (India Renaissance)Origin of India (India Renaissance)
Origin of India (India Renaissance)
 
Ubuntu 15.04
Ubuntu 15.04Ubuntu 15.04
Ubuntu 15.04
 
Module rh de l'ERP Odoo (ex OpenERP)
Module rh de l'ERP Odoo (ex OpenERP)Module rh de l'ERP Odoo (ex OpenERP)
Module rh de l'ERP Odoo (ex OpenERP)
 
110627 soutenance memoire
110627 soutenance memoire110627 soutenance memoire
110627 soutenance memoire
 
Rapport sur quelques fonctionnalités du module de gestion des ressources huma...
Rapport sur quelques fonctionnalités du module de gestion des ressources huma...Rapport sur quelques fonctionnalités du module de gestion des ressources huma...
Rapport sur quelques fonctionnalités du module de gestion des ressources huma...
 
ESTUDIO DE LA BIODIVERSIDAD EN COLOMBIA
ESTUDIO DE LA BIODIVERSIDAD EN COLOMBIAESTUDIO DE LA BIODIVERSIDAD EN COLOMBIA
ESTUDIO DE LA BIODIVERSIDAD EN COLOMBIA
 

Ähnlich wie Parallel Computing in R

Ensuring High Availability for Real-time Analytics featuring Boxed Ice / Serv...
Ensuring High Availability for Real-time Analytics featuring Boxed Ice / Serv...Ensuring High Availability for Real-time Analytics featuring Boxed Ice / Serv...
Ensuring High Availability for Real-time Analytics featuring Boxed Ice / Serv...MongoDB
 
スマートフォン勉強会@関東 #11 どう考えてもdisconなものをiPhoneに移植してみた
スマートフォン勉強会@関東 #11 どう考えてもdisconなものをiPhoneに移植してみたスマートフォン勉強会@関東 #11 どう考えてもdisconなものをiPhoneに移植してみた
スマートフォン勉強会@関東 #11 どう考えてもdisconなものをiPhoneに移植してみたTaro Matsuzawa
 
Attention-Based Adaptive Selection of Operations for Image Restoration in the...
Attention-Based Adaptive Selection of Operations for Image Restoration in the...Attention-Based Adaptive Selection of Operations for Image Restoration in the...
Attention-Based Adaptive Selection of Operations for Image Restoration in the...MasanoriSuganuma
 
Debugging Ruby Systems
Debugging Ruby SystemsDebugging Ruby Systems
Debugging Ruby SystemsEngine Yard
 
Emerging Languages: A Tour of the Horizon
Emerging Languages: A Tour of the HorizonEmerging Languages: A Tour of the Horizon
Emerging Languages: A Tour of the HorizonAlex Payne
 
Доклад Антона Поварова "Go in Badoo" с Golang Meetup
Доклад Антона Поварова "Go in Badoo" с Golang MeetupДоклад Антона Поварова "Go in Badoo" с Golang Meetup
Доклад Антона Поварова "Go in Badoo" с Golang MeetupBadoo Development
 
Performance tweaks and tools for Linux (Joe Damato)
Performance tweaks and tools for Linux (Joe Damato)Performance tweaks and tools for Linux (Joe Damato)
Performance tweaks and tools for Linux (Joe Damato)Ontico
 
Golang Performance : microbenchmarks, profilers, and a war story
Golang Performance : microbenchmarks, profilers, and a war storyGolang Performance : microbenchmarks, profilers, and a war story
Golang Performance : microbenchmarks, profilers, and a war storyAerospike
 
MongoDB - Monitoring and queueing
MongoDB - Monitoring and queueingMongoDB - Monitoring and queueing
MongoDB - Monitoring and queueingBoxed Ice
 
MongoDB - Monitoring & queueing
MongoDB - Monitoring & queueingMongoDB - Monitoring & queueing
MongoDB - Monitoring & queueingBoxed Ice
 
신뢰성 높은 클라우드 기반 서비스 운영을 위한 Chaos Engineering in Action (윤석찬, AWS 테크에반젤리스트) :: ...
신뢰성 높은 클라우드 기반 서비스 운영을 위한 Chaos Engineering in Action (윤석찬, AWS 테크에반젤리스트) :: ...신뢰성 높은 클라우드 기반 서비스 운영을 위한 Chaos Engineering in Action (윤석찬, AWS 테크에반젤리스트) :: ...
신뢰성 높은 클라우드 기반 서비스 운영을 위한 Chaos Engineering in Action (윤석찬, AWS 테크에반젤리스트) :: ...Amazon Web Services Korea
 
MongoDB: Optimising for Performance, Scale & Analytics
MongoDB: Optimising for Performance, Scale & AnalyticsMongoDB: Optimising for Performance, Scale & Analytics
MongoDB: Optimising for Performance, Scale & AnalyticsServer Density
 
marko_go_in_badoo
marko_go_in_badoomarko_go_in_badoo
marko_go_in_badooMarko Kevac
 
An Introduction to Go
An Introduction to GoAn Introduction to Go
An Introduction to GoCloudflare
 
Mcs011 solved assignment by divya singh
Mcs011 solved assignment by divya singhMcs011 solved assignment by divya singh
Mcs011 solved assignment by divya singhDIVYA SINGH
 
useR!2010 matome
useR!2010 matomeuseR!2010 matome
useR!2010 matomeybenjo
 
DevLove k8s nobusue 20180711
DevLove k8s nobusue 20180711DevLove k8s nobusue 20180711
DevLove k8s nobusue 20180711Nobuhiro Sue
 
Hotsos 2011: Mining the AWR repository for Capacity Planning, Visualization, ...
Hotsos 2011: Mining the AWR repository for Capacity Planning, Visualization, ...Hotsos 2011: Mining the AWR repository for Capacity Planning, Visualization, ...
Hotsos 2011: Mining the AWR repository for Capacity Planning, Visualization, ...Kristofferson A
 
Clojure: Practical functional approach on JVM
Clojure: Practical functional approach on JVMClojure: Practical functional approach on JVM
Clojure: Practical functional approach on JVMsunng87
 
JTF2018_B30_k8s_operator_nobusue
JTF2018_B30_k8s_operator_nobusueJTF2018_B30_k8s_operator_nobusue
JTF2018_B30_k8s_operator_nobusueNobuhiro Sue
 

Ähnlich wie Parallel Computing in R (20)

Ensuring High Availability for Real-time Analytics featuring Boxed Ice / Serv...
Ensuring High Availability for Real-time Analytics featuring Boxed Ice / Serv...Ensuring High Availability for Real-time Analytics featuring Boxed Ice / Serv...
Ensuring High Availability for Real-time Analytics featuring Boxed Ice / Serv...
 
スマートフォン勉強会@関東 #11 どう考えてもdisconなものをiPhoneに移植してみた
スマートフォン勉強会@関東 #11 どう考えてもdisconなものをiPhoneに移植してみたスマートフォン勉強会@関東 #11 どう考えてもdisconなものをiPhoneに移植してみた
スマートフォン勉強会@関東 #11 どう考えてもdisconなものをiPhoneに移植してみた
 
Attention-Based Adaptive Selection of Operations for Image Restoration in the...
Attention-Based Adaptive Selection of Operations for Image Restoration in the...Attention-Based Adaptive Selection of Operations for Image Restoration in the...
Attention-Based Adaptive Selection of Operations for Image Restoration in the...
 
Debugging Ruby Systems
Debugging Ruby SystemsDebugging Ruby Systems
Debugging Ruby Systems
 
Emerging Languages: A Tour of the Horizon
Emerging Languages: A Tour of the HorizonEmerging Languages: A Tour of the Horizon
Emerging Languages: A Tour of the Horizon
 
Доклад Антона Поварова "Go in Badoo" с Golang Meetup
Доклад Антона Поварова "Go in Badoo" с Golang MeetupДоклад Антона Поварова "Go in Badoo" с Golang Meetup
Доклад Антона Поварова "Go in Badoo" с Golang Meetup
 
Performance tweaks and tools for Linux (Joe Damato)
Performance tweaks and tools for Linux (Joe Damato)Performance tweaks and tools for Linux (Joe Damato)
Performance tweaks and tools for Linux (Joe Damato)
 
Golang Performance : microbenchmarks, profilers, and a war story
Golang Performance : microbenchmarks, profilers, and a war storyGolang Performance : microbenchmarks, profilers, and a war story
Golang Performance : microbenchmarks, profilers, and a war story
 
MongoDB - Monitoring and queueing
MongoDB - Monitoring and queueingMongoDB - Monitoring and queueing
MongoDB - Monitoring and queueing
 
MongoDB - Monitoring & queueing
MongoDB - Monitoring & queueingMongoDB - Monitoring & queueing
MongoDB - Monitoring & queueing
 
신뢰성 높은 클라우드 기반 서비스 운영을 위한 Chaos Engineering in Action (윤석찬, AWS 테크에반젤리스트) :: ...
신뢰성 높은 클라우드 기반 서비스 운영을 위한 Chaos Engineering in Action (윤석찬, AWS 테크에반젤리스트) :: ...신뢰성 높은 클라우드 기반 서비스 운영을 위한 Chaos Engineering in Action (윤석찬, AWS 테크에반젤리스트) :: ...
신뢰성 높은 클라우드 기반 서비스 운영을 위한 Chaos Engineering in Action (윤석찬, AWS 테크에반젤리스트) :: ...
 
MongoDB: Optimising for Performance, Scale & Analytics
MongoDB: Optimising for Performance, Scale & AnalyticsMongoDB: Optimising for Performance, Scale & Analytics
MongoDB: Optimising for Performance, Scale & Analytics
 
marko_go_in_badoo
marko_go_in_badoomarko_go_in_badoo
marko_go_in_badoo
 
An Introduction to Go
An Introduction to GoAn Introduction to Go
An Introduction to Go
 
Mcs011 solved assignment by divya singh
Mcs011 solved assignment by divya singhMcs011 solved assignment by divya singh
Mcs011 solved assignment by divya singh
 
useR!2010 matome
useR!2010 matomeuseR!2010 matome
useR!2010 matome
 
DevLove k8s nobusue 20180711
DevLove k8s nobusue 20180711DevLove k8s nobusue 20180711
DevLove k8s nobusue 20180711
 
Hotsos 2011: Mining the AWR repository for Capacity Planning, Visualization, ...
Hotsos 2011: Mining the AWR repository for Capacity Planning, Visualization, ...Hotsos 2011: Mining the AWR repository for Capacity Planning, Visualization, ...
Hotsos 2011: Mining the AWR repository for Capacity Planning, Visualization, ...
 
Clojure: Practical functional approach on JVM
Clojure: Practical functional approach on JVMClojure: Practical functional approach on JVM
Clojure: Practical functional approach on JVM
 
JTF2018_B30_k8s_operator_nobusue
JTF2018_B30_k8s_operator_nobusueJTF2018_B30_k8s_operator_nobusue
JTF2018_B30_k8s_operator_nobusue
 

Parallel Computing in R

  • 1. Parallel Computing in R 2010/05/09 Tsukuba.R#7 id:mickey24
  • 4. Tsukuba.R#4 •R Brainf*ck • Brainf*ck > hello <- "+++++++++[>++++++++>++++++++++ +>+++++<<<-]>.>++.+++++++..++ +.>-.------------.<++++++++.--------.++ +.------.--------.>+." > brainfxxk(hello) [1] "Hello, world!" http://www.slideshare.net/mickey24/rbrainfck-1085191
  • 5. Tsukuba.R#5 • Animation with R • library(animation) http://d.hatena.ne.jp/mickey24/20090614
  • 6. Tsukuba.R#6 • Extend R with C!!! • C R (C OpenCV ) http://d.hatena.ne.jp/mickey24/20091123/r_de_extension
  • 7.
  • 9. • •n snow •
  • 10. n
  • 11. • CPU !"#! !"#! !"#! !!!! !!!! !!!! !"#!
  • 12. 1CPU sapply(1:8, function(x){ x^2 }) (function(x){x^2})(1) (function(x){x^2})(2) (function(x){x^2})(3) (function(x){x^2})(4) !"#! (function(x){x^2})(5) (function(x){x^2})(6) (function(x){x^2})(7) (function(x){x^2})(8) [1] 1 4 9 16 25 36 49 64
  • 13. 4CPU sapply(1:8, function(x){ x^2 }) (function(x){x^2})(1) (function(x){x^2})(3) (function(x){x^2})(5) (function(x){x^2})(7) (function(x){x^2})(2) (function(x){x^2})(4) (function(x){x^2})(6) (function(x){x^2})(8) !"#! !"#! !"#! !"#! [1] 1 4 9 16 25 36 49 64
  • 14. • • • 1CPU 1 → 100CPU → 10
  • 15. R • snow • R • http://cran.r-project.org/web/packages/snow/index.html • R apply • • Socket PVM MPI
  • 17. snow • 2CPU • • CPU
  • 18. snow > install.packages("snow") • •
  • 19. matprod.R • 1000 n <- 1000 A <- matrix(rnorm(n^2), n) B <- matrix(rnorm(n^2), n) C <- A %*% B •
  • 20. clmatprod.R library(snow) n <- 1000 A <- matrix(rnorm(n^2), n) B <- matrix(rnorm(n^2), n) cpu <- 2 hosts <- rep("localhost", cpu) cl <- makeCluster(hosts, type="SOCK") C <- parMM(cl, A, B) # C <- A %*% B stopCluster(cl)
  • 22. • parMM(cl, A, B) • apply • parApply(cl, X, MARGIN, fun, ...) • parLapply(cl, X, fun, ...) • parSapply(cl, X, fun, ..., simplify=TRUE, USE.NAMES=TRUE) • etc. • • clusterMap(cl, fun, ..., MoreArgs = NULL, RECYCLE = TRUE) • clusterCall(cl, fun, ...) • etc. • help (?parApply, ?clusterMap )
  • 23. snow
  • 24. • • snow • mCPU n • O(n^3) #! $! !"#! !"#! !"#! !!!! !"#! #! !! "!
  • 25. 1CPU( ) system.time(A %*% B) • mCPU ( ) system.time(parMM(cl, A, B))
  • 26. @DBCLS • • Sun Grid Engine OpenMPI •
  • 27. @DBCLS 1 8 CPU 8CPU 64CPU 16GB 128GB !"#$! !"#$! !"#$! !"#$! !"#$! !"#$! !"#$! !"#$!
  • 28.
  • 29. 1000 ( ) 3.00 2.50 2.00 1.50 1.00 Faster! 0.50 0 1 4 8 16 CPU 4CPU 1.14
  • 30. 3000 ( ) 40.00 30.00 20.00 10.00 Faster! 0 1 4 8 16 CPU 8CPU 2.70
  • 31.
  • 32. snow • C • C R (40 50 ) www http://d.hatena.ne.jp/ syou6162/20090117/1232120983
  • 33. snow • snow Simplified http://www.sfu.ca/~sblay/R/snow.html • RjpWiki - R http://www.okada.jp.org/RWiki/?R%A4%C7%CA%C2%CE%F3%B7%D7%BB%BB • RjpWiki - L.Tierney snow http://www.okada.jp.org/RWiki/?L.%20Tierney%BB%E1%A4%CEsnow %A5%D1%A5%C3%A5%B1%A1%BC%A5%B8%A4%C7%A5%AF %A5%E9%A5%B9%A5%BF%B7%D7%BB%BB%A4%F2%B9%D4%A4%A6#scce80a1 • Rmpi + snow + Sun Grid Engine • Scheduled Parallel Computing with R: R + Rmpi + OpenMPI + Sun Grid Engine (SGE) http://blog.nguyenvq.com/2010/01/20/scheduled-parallel-computing-with-r-r-rmpi- openmpi-sun-grid-engine-sge/
  • 34.
  • 35.
  • 36. R+ Sun Grid Engine + Open MPI + snow
  • 37. @DBCLS • Sun Grid Engine • OpenMPI • mpirun R • Rmpi snow OpenMPI • •
  • 38. • Rmpi OpenMPI • snow Rmpi > install.packages("Rmpi", configure.args= "/path/to/mpidir") > install.packages("snow")
  • 39. gmatprod.R library(Rmpi) library(snow) n <- 1000 A <- matrix(rnorm(n^2), n) B <- matrix(rnorm(n^2), n) cl <- makeCluster() # C <- parMM(cl, A, B) # C <- A %*% B stopCluster(cl)
  • 40. gmatprod.sh #!/bin/bash #$ -S /bin/bash # /bin/bash #$ -j y # stdout stderr -o #$ -o gmatprod.log # stdout stderr #$ -pe openmpi 8 # export PATH=[path to R & snow_install_dir & mpirun]:$PATH export LD_LIBRARY_PATH=/path/to/mpidir/lib:$LD_LIBRARY_PATH MPIRUN_PATH=/path/to/mpirun MPIRUN_OPTS="-np ${NSLOTS} -machinefile ${TMPDIR}/machines" RSCRIPT=gmatprod.R RPATH=/path/to/snow_install_dir/RMPISNOW CMD="${RPATH} CMD BATCH --no-save ${RSCRIPT}" ${MPIRUN_PATH} ${MPIRUN_OPTS} ${CMD}
  • 41. • qsub Grid Engine $ qsub gmatprod.sh
  • 42. • Scheduled Parallel Computing with R: R + Rmpi + OpenMPI + Sun Grid Engine (SGE) http://blog.nguyenvq.com/2010/01/20/scheduled-parallel- computing-with-r-r-rmpi-openmpi-sun-grid-engine-sge/ • Sun Grid Engine MPI R

Hinweis der Redaktion