Closed sam0x17 closed 6 years ago
Hi Sam! As far as I know, no one ever tried to install or use NMatrix in Rubinius. We developed it with MRI in mind. I'm not familiar with Rubinius to assert how hard it would be, but having NMatrix work with other Ruby implementations seems definitely a good thing.
Can you tell us more about why you want to use NMatrix in Rubinius?
By the way, @wlevine is a Google Summer of Code student working on improving the installation process of NMatrix (among other things) and might be interested in this discussion. :)
Hey thanks for reaching out. I am doing some computer vision research and would like to be able to use the easy-to-use syntax of ruby with my research without sacrificing too much performance (in particular, I need support for true parallel threading unlike what MRI has). Rubinius meets my needs in this respect (as does JRuby, but for now it looks like Rubinius is easier to use). I want to use the high performance oily_png library in conjunction with nmatrix to compute some information about a data set containing millions of PNG images.
My understanding is that Rubinius is the closest thing the Ruby community has to a high performance language appropriate for research. Since matrices and linear algebra frequently come up in research-oriented contexts, I think it would be natural for nmatrix to support Rubinius as well as JRuby out of the box.
It would be greatly appreciated if someone could get nmatrix working on the latest Rubinius :)
@wlevine would be great if you could work on this it would be much appreciated!
I think @mohawkjohn and @cjfuller will find this discussion interesting as well.
My memory of this is hazy, so don't hold me to this, but I think I did actually try to get it to work on a much earlier version of rubinius (years ago), and concluded it was maybe possible. At least back then, their goal was to maintain compatibility for C extensions (haven't checked in on rubinius in a while, so I don't know if this is still true).
Beyond just getting it to compile, one thing that I have (unfortunately) added since then is a bunch of code for marking NMatrix data structures to prevent errant garbage collection. This uses a static C structure and is decidedly not thread-safe. We'd probably need to conditionally compile in locking logic. Shouldn't be too bad so long as rubinius's threading model is something that we can easily deal with from C, but I don't know enough about it to say for sure. (All this also assumes the garbage collection is roughly the same between the two implementations. It could be especially tricky if there's the possibility of it being concurrent with running NMatrix.)
If someone does manage to get it to compile, though, I'm happy to look into the details of thread-safety/gc here.
Hey folks, I can give you some pointers to get this working with Rubinius:
RSTRING(obj)->ptr
, etc. Rubinius implements the core classes in Ruby. Things like Hash
have no representation in C code and we don't support most of the RHASH
interfaces in MRI.Please do ping us with specific questions if we can help.
Awesome, thanks for the detailed pointers! We'll have to do some more investigation before we can figure out how hard this would be (in particular exactly how often we're relying on what the internal structures look like), but this is a great help.
By the way, in my use case, I won't be needing to do any synchronization on nmatrix matrices... I'll have a few shared matrices that are used by multiple threads but in a read-only fashion.
On Wed, May 27, 2015 at 1:26 PM, Colin J. Fuller notifications@github.com wrote:
Awesome, thanks for the detailed pointers! We'll have to do some more investigation before we can figure out how hard this would be (in particular exactly how often we're relying on what the internal structures look like), but this is a great help.
Reply to this email directly or view it on GitHub https://github.com/SciRuby/nmatrix/issues/363#issuecomment-106004560.
Not seeing very much demand for this, so closing for now.
Is nmatrix compatible with rubinius? Following the installation guide on the wiki and using Ubuntu 14.04 and rubinius 2.5.2, the following error is occurring for me. When I use ruby 2.2.0, I am able to install nmatrix just fine.