[SciPy-User] Linking to BLAS from an extension
Hjalmar Turesson
hturesson at gmail.com
Tue Oct 25 22:19:48 EDT 2011
I changed my code to use cblas instead. I include cblas.h and call
cblas_dgemm. It compiles ok, but I get the same import error:
ImportError: ./_C_fast_spikesort.so: undefined symbol: cblas_dgemm
What am I doing wrong?
Thanks,
Hjalmar
On Tue, Oct 25, 2011 at 9:51 PM, Hjalmar Turesson <hturesson at gmail.com>wrote:
> Hi,
>
> I'm trying to call dgemm (a BLAS routine) from a C extension. It compiles
> fine, but when I try to import my python file containing the extension, I
> get an import error:
>
>
> ImportError: ./_C_fast_spikesort.so: undefined symbol: dgemm_
>
>
> From http://www.math.utah.edu/software/lapack.html I got the impression
> that gcc doesn't automatically record the location of the BLAS libary, so
> that at runtime dgemm is not found. Thus, they recommend to put the LDFLAGS
> line in the make file. But this doesn't help. Make file below:
>
> # ---- Record the location of BLAS-----
> LDFLAGS = Wl, -rpath /usr/lib
>
> # ---- Link ---------------------------
> _C_fast_spikesort.so: C_fast_spikesort.o
> gcc -shared C_fast_spikesort.o -o _C_fast_spikesort.so
>
> # ---- gcc C compile ------------------
> C_fast_spikesort.o: C_fast_spikesort.c C_fast_spikesort.h
> gcc -c -fPIC C_fast_spikesort.c -I/usr/include/python2.7
> -I/usr/lib/python2.7/site-packages/numpy/core/include/numpy -L /usr/lib
> -lblas
>
> How should I fix it? Is it better to use cblas, and include cblas.h
> instead?
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20111025/587f8f04/attachment.html>
More information about the SciPy-User
mailing list