#939 ATLAS to Octave build/Matlab mex interface


Dear Clint and Tony,

I have poured over the documents at great length(1). The result is a set of scripts for building ATLAS, LAPACK, BLAS and Octave across versions, OSes and Linux distros. Fairly general, and I intend to make them available so that users of Octave can easily make use of the threaded tuned ATLAS library. The result of the snippet below is a successful ATLAS install. I have built libtatlas.so as below. I presume that the cblas and lapack routines are in there, but calling the shared library from both Octave and matlab compilations fails to find routines.

looks like an interface issue to me. What ATLAS says and what Octave/Matlab are listening for. Should I be building seperate shared libraries from the .a files? The more explicit would be deeply appreciated.

At wits end(2),

(1) ATLAS Installation Guide. You may wish to change footnote two to http://bit.csc.lsu.edu/~whaley/
(2) There are beers in London with your names on them should you ever come by. Seriously.

using ATLAS 3.10.1 (others yield the same result), gcc/g++/gfortran 4.7.3, Linux Kernal 3.11.0-12-generic, Linux Mint 16 Cinnamon 64 (Ubuntu 13.10 based)

../configure -b 64 -t 4 -D c -DPentiumCPS=3100 --prefix=/usr/local/atlas --with-netlib-lapack-tarfile=$AT_BUILD_DIR/$AT_LAPACKPACKAGE -Fa alg '-fPIC -DPIC -march=native -mieee-fp -fopenmp' -Si omp 1

# Do not use make –j. The build process uses it automatically where applicable.
sudo make || exit_code "ATLAS make failed." # tune and compile library
sudo make time || exit_code "ATLAS make time failed."
sudo make check || exit_code "ATLAS test serial routines failed."
sudo make ptcheck || exit_code "ATLAS test parallel routines failed."
#sudo rm -f $AT_LIB/*.so
sudo make install || exit_code "ATLAS make install failed."

# ATLAS shared library(.so)
cd lib
make ptshared cptshared || exit_code "ATLAS shared library files failed."
sudo cp *.so $AT_LIB
echo "ATLAS successfully installed."

ls of $BUILD/lib

libatlas.a libf77refblas.a libptclapack.a libtatlas.so
libcblas.a liblapack.a libptf77blas.a libtstatlas.a
libf77blas.a libptcblas.a libptlapack.a

Creates the shared threaded libtatlas.so

PROBLEM 1: Octave fails to build with:
checking for cheev_... no

/usr/local/lib $ nm -D --defined-only liblapack.so > /home/louis/code/tmp/tmplapack.txt
gedit of tmplapack.txt reveals:

000000000009ea80 T cheev_
000000000009e0c0 T cheevd_
000000000009f130 T cheevr_
00000000000a0b60 T cheevx_

but /usr/local/atlas/lib $ nm -D --defined-only libtatlas.so > /home/louis/code/tmp/tmpatlas.txt

cheev not found in tmpatlas.txt

The octave build process uses m4 macros, so very very difficult to alter. Just google "octave ax_lapack.m4" to see the file. I think if cheev were in the libtatlas.so everything would have gone well.

PROBLEM 2: matlab fails to build a mex file:
mex files only allow me to specifiy the library, not the PREFIX in PREFIX_routine below.

invChol_mex.o: In function mexFunction': invChol_mex.c:(.text+0xb8): undefined reference todpotrf_' as well as dpotri_, spotrf_ and spotri_

gedit tmpatlas.txt finds it as:

000000000006fcd0 T ATL_dpotrf
000000000006fd10 T ATL_dpotrfL
00000000000704e0 T ATL_dpotrfU
0000000000070cb0 T ATL_dpotrs
00000000000a4c20 T clapack_dpotrf
00000000000a4d80 T clapack_dpotri
00000000000a4ef0 T clapack_dpotrs


  • louis

    louis - 2014-02-17

    PROBLEM 2 is really just a simple interface change.
    Any mex file that uses the library can use a define statement:
    for example:
    #define dpotrf clapack_dpotrf
    #define spotrf clapack_spotrf
    #define dpotri clapack_dpotri
    #define spotri clapack_spotri

  • R. Clint Whaley

    R. Clint Whaley - 2014-05-29

    If you aren't sure they are using ATLAS, you can build xdl3blastst_pt in BLDdir/bin, and time GEMM (see doc/TestTime.txt for some basic instructions), and compare it what you get inside octave.

    You can verify that your ATLAS uses multiple threads, and then see if matlab does for the same size problem.

  • R. Clint Whaley

    R. Clint Whaley - 2014-07-02

    I'm assuming this has been fixed. Please reopen or open a new tickit if problems are still outstanding.


  • R. Clint Whaley

    R. Clint Whaley - 2014-07-02
    • status: open --> closed-fixed
    • assigned_to: R. Clint Whaley

Log in to post a comment.