Closed argoncloud closed 12 years ago
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.
Nevermind, the problem is that I accidentally misnamed the shared library as .o instead of .so - changing that solved it.
I am not using setup.py, I am compiling the files manually via Makefile with the same calls specified at http://wiki.cython.org/tutorials/numpy it's more convenient because with the Makefile variables you can use the same parameters for compiling everything.
On 11/13/2011 10:56 PM, Nicolas Pinto wrote:
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.
Reply to this email directly or view it on GitHub: https://github.com/npinto/asgd/issues/10#issuecomment-2726461
For Cython modules, please use setup.py or we'll have many issues in the future.
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?