第5回SCDN - Ruby Summer of Code: NArray on OpenCL

15
Ruby Summer of Code: NArray on OpenCL Kazu @ktanimur https://github.com/ kazuyukitanimura

Transcript of 第5回SCDN - Ruby Summer of Code: NArray on OpenCL

Page 1: 第5回SCDN - Ruby Summer of Code: NArray on OpenCL

Ruby Summer of Code: NArray on OpenCL

Kazu@ktanimur

https://github.com/kazuyukitanimura

Page 2: 第5回SCDN - Ruby Summer of Code: NArray on OpenCL

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

Electric Design Automation

Source: EE Times

Page 4: 第5回SCDN - Ruby Summer of Code: NArray on OpenCL

DAC 2011

Keynote:Steve Wozniak    Fusion-io

Page 5: 第5回SCDN - Ruby Summer of Code: NArray on OpenCL
Page 6: 第5回SCDN - Ruby Summer of Code: NArray on OpenCL

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

• 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

 

 

Page 9: 第5回SCDN - Ruby Summer of Code: NArray on OpenCL

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

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
Page 12: 第5回SCDN - Ruby Summer of Code: NArray on OpenCL

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

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

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

Q & A

Thank you!