NMatrix instructions

53 views
Skip to first unread message

Eric MacAdie

unread,
Jul 31, 2012, 10:03:55 PM7/31/12
to sciru...@googlegroups.com
I got NMatrix installed on my machine. I sort of followed the instructions on SciRuby. But instead of going to the SciPy site and installing the ATLAS from source I used the Ubuntu packages. I also had to make a couple of symlinks. Personally I prefer using packages over compiling and installing libraries myself. 

I will write something up later and post it here and on my website.

- Eric MacAdie

Daniel Carrera

unread,
Aug 1, 2012, 2:49:48 AM8/1/12
to sciru...@googlegroups.com
The reason for compiling ATLAS is to get a set of BLAS and LAPACK that is optimized for your system. That is something that an Ubuntu package cannot do. ATLAS will probe your CPU, figure out what features it has, and edit the compile system so that you get BLAS designed to squeeze every ounce out of architecture. In contrast, pre-compiled packages from Ubuntu have to assume nothing about your CPU and only use the features that are common to all CPUs, including 10 year-old CPUs.


Basically, for simple calculations it just doesn't matter, and if your work doesn't involve linear algebra then the BLAS don't matter either. But if you want to invert large matrices, compiling ATLAS makes a world of a difference. Alternatively, you can use the MKL from Intel which contain BLAS optimized by Intel for its own CPUs, so they are really good. Because the BLAS are such an important core of a lot of scientific work, every CPU manufacturer will give you BLAS that are optimized for its CPUs.

Cheers,
Daniel.

John Prince

unread,
Aug 1, 2012, 11:08:56 AM8/1/12
to sciru...@googlegroups.com
Eric, I'm really interested in the steps you took (I've not been successful so far, but it was very early on when I last tried).

That's also a great point Daniel.  Even though the project is under active development, we ought to have a wiki page with step by step instructions on installation (both compiling and with packages since both are highly useful).  Then, the README could just point to the wiki page...  This should be done sooner rather than later because folks can't really contribute until they can compile.

Of course, I'm happy to post to the wiki the instructions once I actually get it to work.

Eric MacAdie

unread,
Aug 1, 2012, 11:21:43 AM8/1/12
to sciru...@googlegroups.com
I put it on my blog:

http://www.MacAdie.net/2012/07/31/installing-nmatrix-from-sciruby/

I am running on Ubuntu.

The summary is:
I installed a couple of packages first: libatlas-dev and libatlas3gf-base.
Then I ran these two commands:

ln
-s /usr/lib/libgslcblas.so.0.0.0 /usr/lib/libcblas.so
ln -s /usr/lib/atlas-base/libatlas.so.3gf.0 /usr/lib/libatlas.so


That seemed to do the trick.  Running "gem install nmatrix" worked after that.

- Eric MacAdie

John Prince

unread,
Aug 1, 2012, 11:45:55 AM8/1/12
to sciru...@googlegroups.com

Carlos Agarie

unread,
Aug 2, 2012, 1:19:32 AM8/2/12
to sciru...@googlegroups.com
I'm trying to compile NMatrix here (OS X 10.7.4). I downloaded ATLAS, but there's a problem in the make install step... First of all, the error I get from nmatrix compilation:

(...)
checking for cblas_dgemm() in -lcblas... yes
checking for ATL_dgemmNN() in -latlas... no
checking for cblas.h in /usr/local/include,/usr/local/atlas/include... no
checking for main() in -lf2c... no
checking for f2c.h... no
creating nmatrix_config.h
creating Makefile
(...)

It can't find cblas.h and I thought it'd be a good idea to install atlas and lapack from source. (wtf was I thinking?) 

So I followed this blog post:


The make check step is failing with this error:

ar r /Users/carlosagarie/Downloads/tmp/ATLAS/build/lib/libatlas.a ATL_sMBJBmm.o ATL_sIBNBmm.o ATL_sIBJBmm.o ATL_sgemm.o ATL_sGetNB.o ATL_sGetNCNB.o ATL_sgemmNN.o ATL_sgemmNT.o ATL_sgemmTN.o ATL_sgemmTT.o ATL_sNCmmIJK.o ATL_sNCmmJIK.o ATL_sNCmmIJK_c.o ATL_sNCmmJIK_c.o ATL_saliased_gemm.o ATL_sAgemmNN.o ATL_sAgemmNT.o ATL_sAgemmTN.o ATL_sAgemmTT.o ATL_smmJIK.o ATL_smmIJK.o ATL_smmJKI.o ATL_smmK.o ATL_smmBPP.o ATL_smmJITcp.o ATL_scol2blk_aX.o ATL_srow2blkT_aX.o ATL_scol2blk_a1.o ATL_srow2blkT_a1.o ATL_sputblk_bX.o ATL_sputblk_b1.o ATL_sputblk_bn1.o ATL_sputblk_b0.o
 
ar: fatal error in /usr/bin/ranlib

It's very late here and I have some stuff to do tomorrow, but I'd like to hear how you all installed atlas/lapack in your systems. Reading Eric's blog, I think that I need to find and symlink the current install from OS X so nmatrix will find it. But it'd be great to *know* how to compile and everything - more information for the wiki etc.

John Woods

unread,
Aug 6, 2012, 2:27:21 PM8/6/12
to sciru...@googlegroups.com
Hey Carlos,

I see that no one has replied yet.

Sometimes it's not problematic that cblas.h isn't found, particularly if you *have* cblas.h. It may be a problem with extconf.rb.

But I've never seen this particular error. Were you able to find it on Google?

John

Carlos Agarie

unread,
Aug 6, 2012, 8:22:56 PM8/6/12
to sciru...@googlegroups.com
I edited it directly on cblas.c and nmatrix.inc.h files, so the #include <cblas.h> points to OS X's specific installation. I've read extconf.rb (the first time I read one!) and it appears like this type of installation issue can be solved adding the directories there.

Don't worry, I've already solved it - to test Daniel's code and my rand() method to create the pull request I sent you. I'll try to replicate this error and try to solve it some other ways when I have enough time. All the results will be reported here :)

2012/8/6 John Woods <john.o...@gmail.com>



--
Carlos Agarie
Control engineering student
Polytechnic School
University of São Paulo

Eric MacAdie

unread,
Aug 15, 2012, 10:01:03 AM8/15/12
to sciru...@googlegroups.com
I may try compiling from source, and post instructions on that if I am successful.

- Eric MacAdie
Reply all
Reply to author
Forward
0 new messages