Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

The Cython wrapper cannot find the symbols defined by BLAS #10

Closed
argoncloud opened this Issue · 3 comments

2 participants

Claudio A Andreoni Nicolas Pinto
Claudio A Andreoni
Collaborator

I am having an issue with cython. The cython file compiles correctly to C, and the C file also compiles correctly to .so (see first target of the Makefile on branch caa_devel). However, when I import the .so in python, python complains that
ImportError: ./pasgd.so: undefined symbol: cblas_sdsdot

I am not using cblas_sdsdot in python, and also the function is in fact defined (either in simple_blas.c or from libcblas.so). This sounds like a silly issue, like me not giving some necessary parameter to Python. Did you ever encounter something like this? Suggestions?

Nicolas Pinto
Owner

How did you link the shared library ?

Here is an example of setup.py (the one you call with python setup.py build_ext --inplace):


from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext

import numpy

ext_modules=[
    Extension("fbcorr_cython", ["fbcorr_cython.pyx"],
              include_dirs = [numpy.get_include(),'.'],
              libraries=['cblas'],
              extra_compile_args = \
              ["-O3", "-Wall",
               "-pthread",
               "-fopenmp",
               #"-ffast-math",
               #"-funroll-all-loops",
               "-msse2",
               "-msse3",
               "-msse4",
               #"-fomit-frame-pointer",
               "-march=native",
               "-mtune=native",
               "-ftree-vectorize",
               "-ftree-vectorizer-verbose=2",
               #"-fwrapv",
              ],
              ),
]

setup(
  cmdclass = {'build_ext': build_ext},
  ext_modules = ext_modules,
)

The relevant line is in the libraries kwarg.

Claudio A Andreoni
Collaborator
Nicolas Pinto
Owner

For Cython modules, please use setup.py or we'll have many issues in the future.

Nicolas Pinto npinto closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.