Hi there!

I've been trying to get numpy to compile with ACML on and off for over a year now. When I first attempted this, I contacted this mailing list, however noone was able to help me and I lost interested without ever filing a bug report [1]. I'm assuming ACML is broken since then.

Today I had a bit of spare time and wanted to try again. And this time I finally managed to get numpy to compile with ACML.

The problem is that when using ACML, numpy does not build _dotblas.so because NO_ATLAS_INFO is set to 1. I manually disabled this check manually, but I'm guessing a more complete solution would be to add ACML support directly, as was done with OpenBLAS recently.

On my machine (AMD FX 8150) I see a speedup when going from OpenBLAS to ACML. Doing dot-product, determinant and matrix-inverse on a 1000x1000 matrix (I'm reporting the mean of 5 runs plus standard deviation):

With OpenBLAS
            test_dot :   298.7ms (sd: 9.0ms)
            test_det :    92.9ms (sd: 1.1ms)
            test_inv :   163.3ms (sd: 1.0ms)

ACML:
            test_dot :   261.8ms (sd: 8.0ms)
            test_det :    68.0ms (sd: 8.0ms)
            test_inv :   145.2ms (sd: 0.2ms)



For completeness' sake here are my installation notes (this was done on Ubuntu 13.04 and numpy 1.7.1). It would probably be a good idea to add this to http://www.scipy.org/scipylib/building/linux.html as well:


1. ACML needs CBLAS
Grab from http://www.netlib.org/blas/blast-forum/cblas.tgz, modify the Makefile.LINUX to contain the following lines, and rename it to Makefile.in

BLLIB = /opt/acml5.3.1/gfortran64_fma4/lib/libacml.a  # whatever your ACML path is
CFLAGS = -O3 -DADD_ -march=native -fPIC    #-fPIC is needed, -march is optional
FFLAGS = -O3  -march=native -fPIC


2. move CBLAS files to ACML files (optional)
sudo mv lib/cblas_LINUX.a /opt/acml5.3.1/gfortran64_fma4/lib/libcblas.a
sudo cp include/* /opt/acml5.3.1/gfortran64_fma4/include/


3. Edit site.cfg.example in the numpy folder and rename it to site.cfg:
[blas]
blas_libs = cblas, acml
library_dirs = /opt/acml5.3.1/gfortran64_fma4/lib
include_dirs = /opt/acml5.3.1/gfortran64_fma4/include

[lapack]
language = f77
lapack_libs = acml
library_dirs = /opt/acml5.3.1/gfortran64_fma4/lib
include_dirs = /opt/acml5.3.1/gfortran64_fma4/include

4. (this is where numpy is broken):

edit numpy/core/setup.py, towards the end of the file you will find a check that disables BLAS support if NO_ATLAS_INFO is set. Comment out this check so it reads:

    def get_dotblas_sources(ext, build_dir):
        if blas_info:
            #if ('NO_ATLAS_INFO',1) in blas_info.get('define_macros',[]):
            #    return None # dotblas needs ATLAS, Fortran compiled blas will not be sufficient.
            return ext.depends[:1]
        return None
   # ....


All the best


Thomas



[1] http://numpy-discussion.10968.n7.nabble.com/Problems-when-using-ACML-with-numpy-td18135.html
_______________________________________________
NumPy-Discussion mailing list
[email protected]
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to