Safe parallel Ruby language based on BOP
Ruby Version 2.2 commit c5a6913
Master | Latest | Trunk | CBop Dependency |
---|---|---|---|
Several exaple scripts are included in ruby/test/bop. The simplest test is the simple_add.rb which adds a large set of numbers in parallel using arrays. The total sum is the first number passed in as an argument to the script. The difference between a sequential program (in regular Ruby) and the Rubybop equivalent is just adding a PPR call:
PPR{
arr.each{|n| $partial_sums[spec_group] += n**10 * n**20 - n**30 +1}
}
The programmer does not need to handle race conditions or any other problem from parallel programming since everything is handled by the runtime.
rake
rake test
to ensure everything is working (optional).rake install
. May require sudo
.Rubybop currently does not support:
A program using BOP will always be able to write to the terminal. Writing to the terminal is more tricky, and is not supported during PPR tasks. What happens a process tries to read from the terminal while in PPR (or in understudy -- any time multiple processes are reading from STDIN) is undefined.
IRB/IRBOP is supported in early stages. To run IRB with the Rubybop interpreter, Rubybop must be installed. To run the actual script, run the irb in
In addition, all ruby code that was executed without the GVL is now forced to use the GVL. The only exception to this rule is IO, since Ruby is too slow if IO requires the GVL. If a script attempts to enter a parallel region with multiple threads running, an ThreadError
is thrown and Rubybop will terminate. Although there are currently no checks, the data structures used by BOP do not support concurrent modification, so only one thread should be active inside a PPR region.
Any issues installing or running should be reported here.