NMatrix Compilation Instructions

Here are some compilation and installation instructions for Ubuntu that I wrote for the NMatrix gem which is part of the SciRuby project.

Make a working directory for this project: /home/$USER/ruby/sciruby

ATLAS needs CPU throttling to be disabled. On Ubuntu, install the package indicator-cpufreq. It will be an applet on the menu bar. Select “performance”.

Download the LAPACK tar file from http://www.netlib.org/lapack. Save it and unzip, but do not untar it. You do not actually need to compile LAPACK to compile ATLAS, but you do need the tar file.

To get ATLAS, go to http://math-atlas.sourceforge.net/ and bunzip2 the file in the working directory.

For some reason, you cannot run “configure” in the untarred directory. Create a new directory /home/$USER/ruby/sciruby/outputatlas.
Run the ATLAS configure command from there:

Then run “make” It takes about 20 minutes.

This will create a few *.a files. As root, make a directory /usr/local/atlas, copy the *.a files there, and create links as .so files

Go to https://github.com/SciRuby/nmatrix, get the github repo, and follow the directions.

When you run the command “gem install pkg/nmatrix-0.0.2.gem”, it will say:

It does take a while, and there is not a lot of feedback to the screen.

After that completes, run “rspec” or “rake spec”.

Notes:
When I ran rspec, I got some errors, but I posted them to the list, and they are all expected and/or being looked at.

The SciPy page has a section for Ubuntu. It says that I should go into the directory I created to build ATLAS, then go into lib, and run “make shared”. This would be /home/$USER/ruby/sciruby/outputatlas/lib This will create the .so files. I tried this, and I was not able to get it to work. I am googling to find out the answer, but so far no success. But by creating links to the .a files I got it to work. I will look into it, and hopefully get some feedback from the SciRuby list, but so far this seems to work.


More notes/commentary (will probably not appear on official SciRuby site):

It depends on some math libraries written in C and Fortran. The Linux installation instructions on the SciRuby site tell people to go to the SciPy site. I think this is bad for a couple of reasons. First off, the SciRuby project is a competitor to SciPy. It is not as advanced or ready for prime time, but if it really wants to compete it will need to handle things on its own. Plus I think some of the instructions on the SciPy site are out of date.

Ruby is a high-level language, so it is a bit odd to be dealing with C and Fortran. I like to deal with high-level languages to avoid having to deal with low-level details. But if you want to do some serious math, C and Fortran are part of the deal. SciPy is really just a wrapper around the C and Fortran libraries.