第5回scdn - ruby summer of code: narray on opencl
TRANSCRIPT
![Page 1: 第5回SCDN - Ruby Summer of Code: NArray on OpenCL](https://reader034.vdocument.in/reader034/viewer/2022042601/554f8cacb4c905435d8b4e38/html5/thumbnails/1.jpg)
Ruby Summer of Code: NArray on OpenCL
Kazu@ktanimur
https://github.com/kazuyukitanimura
![Page 2: 第5回SCDN - Ruby Summer of Code: NArray on OpenCL](https://reader034.vdocument.in/reader034/viewer/2022042601/554f8cacb4c905435d8b4e38/html5/thumbnails/2.jpg)
Who is @ktanimur
• Ph.D. Student in computer science at UC Irvine• Research
o Embedded Systems / CAD / Security• Programing Languages
o Ruby+OpenCL Today's topic
o JavaScript (Node.js) Designo: twitter client
Demo: designo.pictshare.me Code: https://github.com/kazuyukitanimura
o Verilog-HDL, VHDLo C, C++o etc...
![Page 3: 第5回SCDN - Ruby Summer of Code: NArray on OpenCL](https://reader034.vdocument.in/reader034/viewer/2022042601/554f8cacb4c905435d8b4e38/html5/thumbnails/3.jpg)
Electric Design Automation
Source: EE Times
![Page 4: 第5回SCDN - Ruby Summer of Code: NArray on OpenCL](https://reader034.vdocument.in/reader034/viewer/2022042601/554f8cacb4c905435d8b4e38/html5/thumbnails/4.jpg)
DAC 2011
Keynote:Steve Wozniak Fusion-io
![Page 5: 第5回SCDN - Ruby Summer of Code: NArray on OpenCL](https://reader034.vdocument.in/reader034/viewer/2022042601/554f8cacb4c905435d8b4e38/html5/thumbnails/5.jpg)
![Page 6: 第5回SCDN - Ruby Summer of Code: NArray on OpenCL](https://reader034.vdocument.in/reader034/viewer/2022042601/554f8cacb4c905435d8b4e38/html5/thumbnails/6.jpg)
Why Ruby?
• One of my senpai is a rubyist• Ruby for making simulation framework of my research
o Easy to make prototypes• Ruby != Rails
• Ruby cannot handle muti-core CPUs• Wanted to contribute the Ruby community
![Page 7: 第5回SCDN - Ruby Summer of Code: NArray on OpenCL](https://reader034.vdocument.in/reader034/viewer/2022042601/554f8cacb4c905435d8b4e38/html5/thumbnails/7.jpg)
• 2010 Summer• Ruby version of Google Summer of Code
o Students propose projects 70 applicants 20 selected
o 3 mentors / studento $5,000 salary
Sponsored by Ruby communities
![Page 8: 第5回SCDN - Ruby Summer of Code: NArray on OpenCL](https://reader034.vdocument.in/reader034/viewer/2022042601/554f8cacb4c905435d8b4e38/html5/thumbnails/8.jpg)
![Page 9: 第5回SCDN - Ruby Summer of Code: NArray on OpenCL](https://reader034.vdocument.in/reader034/viewer/2022042601/554f8cacb4c905435d8b4e38/html5/thumbnails/9.jpg)
NArray
• N-dimensional Numerical Array for Ruby o https://github.com/masa16/narray
• Fixed-type datao sint, int, sloat, scomplex, float, complex
• Fast !!o Loop in C
• Applicationso Dennou Ruby, etc...
• Single Threado Do not scale in the multicore era
![Page 10: 第5回SCDN - Ruby Summer of Code: NArray on OpenCL](https://reader034.vdocument.in/reader034/viewer/2022042601/554f8cacb4c905435d8b4e38/html5/thumbnails/10.jpg)
OpenCL
• Open Standard for parallel programming of heterogeneous systems by Khronos groupo Similar to Nvidia CUDA
• OpenCL is a specification, not a technology
• Online & Offline compile• Hardware agnostic
o CPU, GPU, ASIP, FPGA, etc...
• AMD, Nvidia, Apple, Foxco Intel started the OpenCL support recently
![Page 11: 第5回SCDN - Ruby Summer of Code: NArray on OpenCL](https://reader034.vdocument.in/reader034/viewer/2022042601/554f8cacb4c905435d8b4e38/html5/thumbnails/11.jpg)
![Page 12: 第5回SCDN - Ruby Summer of Code: NArray on OpenCL](https://reader034.vdocument.in/reader034/viewer/2022042601/554f8cacb4c905435d8b4e38/html5/thumbnails/12.jpg)
Proposed Project
NArray on OpenCL• Want to use Ruby with NArray
o No need to worry about memory• It takes time to learn OpenCL
o Need to worry about memory model
• Main Idea: Translate NArray into OpenCL!!o Programmers can utilize the power of Multicore/GPU
using Ruby• Why OpenCL?
o Hardware agnostic Exploit the available hardware e.g. GPU, CPU
pthread, OpenMP cannot run on GPU
![Page 13: 第5回SCDN - Ruby Summer of Code: NArray on OpenCL](https://reader034.vdocument.in/reader034/viewer/2022042601/554f8cacb4c905435d8b4e38/html5/thumbnails/13.jpg)
Results
• Mac mini mid 2010, CPU:Intel Core 2 Duo 2.4GHz, Memory:DDR3 1067MHz 2GB
• Successfully received $5,000• https://github.com/kazuyukitanimura/narray/wiki
Original$ ruby bench/bench.rb scomplex atanh 1000000 1000Ruby NArray type=scomplex size=1000000 op=atanh repeat=1000 Time: 98.95 sec
OpenCL$ ruby bench/bench.rb scomplex atanh 1000000 1000Ruby NArray type=scomplex size=1000000 op=atanh repeat=1000 Time: 42.46 sec
![Page 14: 第5回SCDN - Ruby Summer of Code: NArray on OpenCL](https://reader034.vdocument.in/reader034/viewer/2022042601/554f8cacb4c905435d8b4e38/html5/thumbnails/14.jpg)
Future Work
• Currently Multicore CPUs only• GPU Support is delayed
o Explicit data transportation between main memory and GPU memory
o Overheado Applications
• Hope: AMD Fusion (APU) and Intel's GPU in Sandy Bridgeo Shared GPU/CPU memoery
• Post an article to the Ruby Magazine
![Page 15: 第5回SCDN - Ruby Summer of Code: NArray on OpenCL](https://reader034.vdocument.in/reader034/viewer/2022042601/554f8cacb4c905435d8b4e38/html5/thumbnails/15.jpg)
Q & A
Thank you!