# Any HPC on Ruby?

**URL:** <https://www.ruby-forum.com/t/any-hpc-on-ruby/76480>\
**Category:** Ruby\
**Created:** [November 19, 2006, 1:40pm UTC](https://www.ruby-forum.com/t/any-hpc-on-ruby/76480 "2006-11-19T13:40:34Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![diego\_v](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/eb8c5e/32.png) [@diego\_v](https://www.ruby-forum.com/u/diego_v)\
**Post date:** [November 19, 2006, 1:40pm UTC](https://www.ruby-forum.com/t/any-hpc-on-ruby/76480/1 "2006-11-19T13:40:34Z")

</div>

Hello,  
I was wondering if someone here has had any experience in programming  
for HPC with Ruby, or it’s just not feasible.

Usually many scientific codes, for example, spend most of their time in  
only a few functions, which (from what I understood) could be  
programmed directly in C, letting you use Ruby for the remaining 90% of  
the code.

That’s why I thought it was feasible, or am I on the wrong track?

And if someone has tried this, how was the experience?

Diego

---

<div class="post-metadata">

**Author:** ![diego\_v](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/eb8c5e/32.png) [@diego\_v](https://www.ruby-forum.com/u/diego_v)\
**Post date:** [November 19, 2006, 9:07pm UTC](https://www.ruby-forum.com/t/any-hpc-on-ruby/76480/2 "2006-11-19T21:07:18Z")

</div>

Diego V. wrote:

> And if someone has tried this, how was the experience?
> 
> Diego

There are people doing this – head over to

[http://sciruby.codeforpeople.com/sr.cgi/FrontPage](http://sciruby.codeforpeople.com/sr.cgi/FrontPage)

The best approach for a “typical” HPC number crunching problem is most  
likely some form of distributed Ruby on a cluster, with the individuals  
nodes running processes built around the Ruby “narray” library. I don’t  
know much about non-numeric HPC problems, but I’d be willing to bet  
someone has implemented “MapReduce” in distributed Ruby for stuff like  
that.

[http://labs.google.com/papers/mapreduce.html](http://labs.google.com/papers/mapreduce.html)

–  
M. Edward (Ed) Borasky, FBG, AB, PTA, PGS, MS, MNLP, NST, ACMC(P)  
[http://borasky-research.blogspot.com/](http://borasky-research.blogspot.com/)

If God had meant for carrots to be eaten cooked, He would have given  
rabbits fire.

---

<div class="post-metadata">

**Author:** ![diego\_v](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/eb8c5e/32.png) [@diego\_v](https://www.ruby-forum.com/u/diego_v)\
**Post date:** [November 20, 2006, 7:45am UTC](https://www.ruby-forum.com/t/any-hpc-on-ruby/76480/3 "2006-11-20T07:45:42Z")

</div>

Diego V. wrote:

> Hello,  
> I was wondering if someone here has had any experience in programming  
> for HPC with Ruby, or it’s just not feasible.

I am trying to port mpi-ruby to bluegene. I do combinatorial  
optimization so it makes sense for me (cpu intensive, low  
communication). You still have to write your computation kernels in C,  
but it makes communication and high level operations way faster to code.

> Usually many scientific codes, for example, spend most of their time in  
> only a few functions, which (from what I understood) could be  
> programmed directly in C, letting you use Ruby for the remaining 90% of  
> the code.  
> Exactly.

> That’s why I thought it was feasible, or am I on the wrong track?
> 
> And if someone has tried this, how was the experience?  
> I see no slowdown, but then I do low communication high CPU codes. If  
> you have to pass a lot of data around, or need every megabyte of memory  
> ruby might not be the right choice for your application. You can always  
> write your app in ruby as a prototype, then re-write it in C chunk by  
> chunk until you get acceptable preformance.

---

<div class="post-metadata">

**Author:** ![diego\_v](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/eb8c5e/32.png) [@diego\_v](https://www.ruby-forum.com/u/diego_v)\
**Post date:** [November 20, 2006, 2:45pm UTC](https://www.ruby-forum.com/t/any-hpc-on-ruby/76480/4 "2006-11-20T14:45:45Z")

</div>

On Mon, Nov 20, 2006 at 05:07:09AM +0900, M. Edward (Ed) Borasky wrote:

> I don’t  
> know much about non-numeric HPC problems, but I’d be willing to bet  
> someone has implemented “MapReduce” in distributed Ruby for stuff like that.
> 
> [http://labs.google.com/papers/mapreduce.html](http://labs.google.com/papers/mapreduce.html)

Yep  
[http://www.rufy.com/starfish/doc/](http://www.rufy.com/starfish/doc/)

---

<div class="post-metadata">

**Author:** ![diego\_v](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/eb8c5e/32.png) [@diego\_v](https://www.ruby-forum.com/u/diego_v)\
**Post date:** [November 20, 2006, 2:46pm UTC](https://www.ruby-forum.com/t/any-hpc-on-ruby/76480/5 "2006-11-20T14:46:03Z")

</div>

Logan C. wrote:

> [http://www.rufy.com/starfish/doc/](http://www.rufy.com/starfish/doc/)

Hmmmm … someone a while back was looking for a way to deal with 60 GB  
of traceroute data in Ruby. If he’s still here, this might be what he  
needs!

–  
M. Edward (Ed) Borasky, FBG, AB, PTA, PGS, MS, MNLP, NST, ACMC(P)  
[http://borasky-research.blogspot.com/](http://borasky-research.blogspot.com/)

If God had meant for carrots to be eaten cooked, He would have given  
rabbits fire.

---

<div class="post-metadata">

**Author:** ![diego\_v](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/eb8c5e/32.png) [@diego\_v](https://www.ruby-forum.com/u/diego_v)\
**Post date:** [November 20, 2006, 2:46pm UTC](https://www.ruby-forum.com/t/any-hpc-on-ruby/76480/6 "2006-11-20T14:46:11Z")

</div>

Diego V. wrote:

> And if someone has tried this, how was the experience?

This is a good approach. You can do all the mundane stuff (files, ui,  
config) in ruby, and the interesting stuff in C. Also, ruby is very good  
for writing domain-specific languages (DSLs), which can make it easier  
to use your C library. For example, the DSL could specify your system  
(whatever it is), and that specification would be the input to your C  
functions. Or the specification could even be used to generate C code  
dynamically.

Can you tell us a little more about the area you are working in, the  
problems you want to solve, etc?

---

<div class="post-metadata">

**Author:** ![diego\_v](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/eb8c5e/32.png) [@diego\_v](https://www.ruby-forum.com/u/diego_v)\
**Post date:** [November 20, 2006, 8:37pm UTC](https://www.ruby-forum.com/t/any-hpc-on-ruby/76480/7 "2006-11-20T20:37:54Z")

</div>

> [http://sciruby.codeforpeople.com/sr.cgi/FrontPage](http://sciruby.codeforpeople.com/sr.cgi/FrontPage)

Thanks: I’ve checked it and it looks like a pretty large site. I’ll  
have something to read for a while. 🙂

See you

Diego

---

<div class="post-metadata">

**Author:** ![diego\_v](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/eb8c5e/32.png) [@diego\_v](https://www.ruby-forum.com/u/diego_v)\
**Post date:** [November 20, 2006, 2:47pm UTC](https://www.ruby-forum.com/t/any-hpc-on-ruby/76480/8 "2006-11-20T14:47:30Z")

</div>

> Can you tell us a little more about the area you are working in, the  
> problems you want to solve, etc?

I am interested in Computational science, but so far all my experience  
was on desktop computers. Now I’ve started to study HPC stuff… which  
arised the question.

I do not have a current specific need to fill, though, it was more of a  
general curiosity: something to keep in mind for the future program  
designs. If I know people have tried it and with success then I might  
attempt to do so myself. (I should choose a dissitation soon, so this  
_might_ be a possibility).

Thank you by the way. I had totally forgotten about the DSL potential  
of Ruby (I am still pretty much a Ruby newbie 🙂 ).

Diego
