cancel
Showing results for 
Search instead for 
Did you mean: 

General Discussions

agilent
Journeyman III

Compiling numpy with AMD AOCL

Hi all,

My workplace recently switched some of the nodes of our cluster to AMD Milan from Intel CPUs. Several of us use python, so on Intel CPUs, I had compiled numpy against MKL libraries following the instructions at this link, which sped up my linear algebra calculations significantly. 

Is there a similar guide for linking numpy to AMD's AOCL implementation of BLIS and FLAME? I compiled python with `aocc`, then  tried linking against AOCL's BLIS and FLAME folders by changing numpy's `site.cfg` as follows:

 

 

 

 

[blis]
libraries = blis-mt
library_dirs = /path/to/aocl/4.1.0/aocc/lib
include_dirs = /path/to/aocl/4.1.0/aocc/include
runtime_library_dirs = /path/to/aocl/4.1.0/aocc/lib
[flame]
libraries = flame
library_dirs = /path/to/aocl/4.1.0/aocc/lib
runtime_library_dirs = /path/to/aocl/4.1.0/aocc/lib

 

 

 

 

 And then I compiled with 

 

 

 

 

export NPY_BLAS_ORDER=blis
export NPY_LAPACK_ORDER=flame
pip3 install .

 

 

 

 

The environment variables CC, CXX and FC were already set to point to the AOCC compilers. However, even though numpy compiles, it fails to load with the error

 

 

 

 

undefined symbol: mkl_blas_dgemm

 

 

 

 

Which makes me think that the AOCL libraries are not being linked to. Any help would be appreciated.

0 Likes
4 Replies
agilent
Journeyman III

OK, I've now managed to compile with aocc and link against aocl's libflame so that it doesn't complain about missing mkl symbols any more. However, the binary installation of libflame seems to have a lot of undefined symbols:

$ ldd -r /path/to/aocl/4.1.0/aocc/lib/libflame.so.4
...
...
undefined symbol: cscal_	(/path/to/aocl/4.1.0/aocc/lib/libflame.so.4)
undefined symbol: cswap_	(/path/to/aocl/4.1.0/aocc/lib/libflame.so.4)
undefined symbol: csrot_	(/path/to/aocl/4.1.0/aocc/lib/libflame.so.4)
undefined symbol: csscal_	(/path/to/aocl/4.1.0/aocc/lib/libflame.so.4)
...
...

and all of these are triggered when I try to import numpy compiled against this libflame.

0 Likes

By the way, I tried running the same command on libflame.so.4 on my machine and all seems to be ok:

ldd -r /opt/aocl/aocc/lib/libflame.so.4
        linux-vdso.so.1 (0x00007ffeaf722000)
        /opt/aocl/aocc/lib_LP64/libblis-mt.so (0x00007fed18200000)
        libflang.so => /opt/aocc/lib/libflang.so (0x00007fed17c00000)
        libstdc++.so.6 => /usr/lib64/libstdc++.so.6 (0x00007fed17800000)
        libomp.so => /opt/aocc/lib/libomp.so (0x00007fed17400000)
        libgcc_s.so.1 => /usr/lib64/libgcc_s.so.1 (0x00007fed19e01000)
        libpthread.so.0 => /usr/lib64/libpthread.so.0 (0x00007fed19dfa000)
        libc.so.6 => /usr/lib64/libc.so.6 (0x00007fed1721e000)
        /usr/lib64/ld-linux-x86-64.so.2 (0x00007fed19e28000)
        libm.so.6 => /usr/lib64/libm.so.6 (0x00007fed19d0d000)
        librt.so.1 => /usr/lib64/librt.so.1 (0x00007fed19d08000)
        libquadmath.so.0 => /usr/lib64/libquadmath.so.0 (0x00007fed19cbf000)
        libflangrti.so => /opt/aocc/lib/libflangrti.so (0x00007fed19cb2000)
        libpgmath.so => /opt/aocc/lib/libpgmath.so (0x00007fed16e00000)
        libdl.so.2 => /usr/lib64/libdl.so.2 (0x00007fed19cab000)
0 Likes
Telephonmaster
Journeyman III

Hello, I am trying to compile numpy with AOCC/AOCL, but I can't even get to the stage where I library compiles. During the compilation no BLIS was found, I disabled all other options for BLAS to prevent linking with MKL or OpenBLAS. How did you make the package compile, may I ask for help with this?

0 Likes
Telephonmaster
Journeyman III

Ok I made some progress with the compilation, but it is not completely functional. For example some linalg functions (actually all of the lapack ones) lead to segfault or linalg error complaining about singular matrix. I am trying to figure out what I might be doing wrong. This is quite strange, I will keep trying to figure out why this is happening. Also I noticed that there is scalapack.so in the AOCL distributive, maybe it can be utilized?

0 Likes