Last active
August 29, 2015 14:06
-
-
Save moorepants/088c3673df50bbf26684 to your computer and use it in GitHub Desktop.
Demonstration of missing symbols in anaconda's libm library when using the --ffast-math flag.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (inverted-pendulum-id)moorepants@moorepants-2170p:inverted-pendulum-sys-id(master)$ conda info | |
| Current conda install: | |
| platform : linux-64 | |
| conda version : 3.6.4 | |
| conda-build version : 1.3.3 | |
| python version : 2.7.8.final.0 | |
| requests version : 2.4.1 | |
| root environment : /home/moorepants/anaconda (writable) | |
| default environment : /home/moorepants/anaconda/envs/inverted-pendulum-id | |
| envs directories : /home/moorepants/anaconda/envs | |
| package cache : /home/moorepants/anaconda/pkgs | |
| channel URLs : http://repo.continuum.io/pkgs/free/linux-64/ | |
| https://conda.binstar.org/moorepants/linux-64/ | |
| config file : /home/moorepants/.condarc | |
| is foreign system : False | |
| (inverted-pendulum-id)moorepants@moorepants-2170p:inverted-pendulum-sys-id(master)$ conda list | |
| # packages in environment at /home/moorepants/anaconda/envs/inverted-pendulum-id: | |
| # | |
| backports.ssl-match-hostname 3.4.0.2 <pip> | |
| cairo 1.12.2 2 | |
| coverage 3.7.1 py27_0 | |
| cython 0.20.2 py27_0 | |
| dateutil 2.1 py27_2 | |
| docopt 0.6.2 <pip> | |
| freetype 2.4.10 0 | |
| hdf5 1.8.9 1 | |
| ipopt 0.1.4 <pip> | |
| ipython 2.1.0 py27_2 | |
| ipython-notebook 2.1.0 py27_0 | |
| jinja2 2.7.3 py27_1 | |
| libpng 1.5.13 1 | |
| libsodium 0.4.5 0 | |
| line-profiler 1.0 <pip> | |
| markupsafe 0.18 py27_0 | |
| matplotlib 1.3.1 np18py27_1 | |
| nose 1.3.3 py27_0 | |
| numexpr 2.3.1 np18py27_0 | |
| numpy 1.8.1 py27_0 | |
| odelab 0.0.0 <pip> | |
| odespy 0.2.0 <pip> | |
| openssl 1.0.1h 0 | |
| pandas 0.14.1 np18py27_0 | |
| pip 1.5.6 py27_0 | |
| pixman 0.26.2 0 | |
| py 1.4.20 py27_0 | |
| py2cairo 1.10.0 py27_1 | |
| pydy 0.2.1 <pip> | |
| pyparsing 2.0.1 py27_0 | |
| pyqt 4.10.4 py27_0 | |
| pytables 3.1.1 np18py27_1 | |
| pytest 2.5.2 py27_0 | |
| python 2.7.8 1 | |
| python-dateutil 1.5 <pip> | |
| pytz 2014.4 py27_0 | |
| pyzmq 14.3.1 py27_0 | |
| qt 4.8.5 0 | |
| readline 6.2 2 | |
| scipy 0.14.0 np18py27_0 | |
| setuptools 3.6 py27_0 | |
| sip 4.15.5 py27_0 | |
| six 1.7.3 py27_0 | |
| sqlite 3.8.4.1 0 | |
| ssl_match_hostname 3.4.0.2 py27_0 | |
| sympy (/home/moorepants/src/sympy) 0.7.5 git <pip> | |
| system 5.8 1 | |
| tables 3.1.1 <pip> | |
| tk 8.5.15 0 | |
| tornado 3.2.1 py27_0 | |
| wsgiref 0.1.2 <pip> | |
| zeromq 4.0.4 0 | |
| zlib 1.2.7 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (inverted-pendulum-id)moorepants@moorepants-2170p:inverted-pendulum-sys-id(master)$ python ufuncify_matrix_0_setup.py build_ext --inplace | |
| running build_ext | |
| skipping 'ufuncify_matrix_0.c' Cython extension (up-to-date) | |
| building 'ufuncify_matrix_0' extension | |
| gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/moorepants/anaconda/envs/inverted-pendulum-id/lib/python2.7/site-packages/numpy/core/include -I/home/moorepants/anaconda/envs/inverted-pendulum-id/include/python2.7 -c ufuncify_matrix_0.c -o build/temp.linux-x86_64-2.7/ufuncify_matrix_0.o -O3 -ffast-math | |
| In file included from /home/moorepants/anaconda/envs/inverted-pendulum-id/lib/python2.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1761:0, | |
| from /home/moorepants/anaconda/envs/inverted-pendulum-id/lib/python2.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:17, | |
| from /home/moorepants/anaconda/envs/inverted-pendulum-id/lib/python2.7/site-packages/numpy/core/include/numpy/arrayobject.h:4, | |
| from ufuncify_matrix_0.c:352: | |
| /home/moorepants/anaconda/envs/inverted-pendulum-id/lib/python2.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:15:2: warning: #warning "Using deprecated NumPy API, disable it by " "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp] | |
| #warning "Using deprecated NumPy API, disable it by " \ | |
| ^ | |
| In file included from /home/moorepants/anaconda/envs/inverted-pendulum-id/lib/python2.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:26:0, | |
| from /home/moorepants/anaconda/envs/inverted-pendulum-id/lib/python2.7/site-packages/numpy/core/include/numpy/arrayobject.h:4, | |
| from ufuncify_matrix_0.c:352: | |
| /home/moorepants/anaconda/envs/inverted-pendulum-id/lib/python2.7/site-packages/numpy/core/include/numpy/__multiarray_api.h:1629:1: warning: ‘_import_array’ defined but not used [-Wunused-function] | |
| _import_array(void) | |
| ^ | |
| In file included from /home/moorepants/anaconda/envs/inverted-pendulum-id/lib/python2.7/site-packages/numpy/core/include/numpy/ufuncobject.h:327:0, | |
| from ufuncify_matrix_0.c:353: | |
| /home/moorepants/anaconda/envs/inverted-pendulum-id/lib/python2.7/site-packages/numpy/core/include/numpy/__ufunc_api.h:241:1: warning: ‘_import_umath’ defined but not used [-Wunused-function] | |
| _import_umath(void) | |
| ^ | |
| gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/moorepants/anaconda/envs/inverted-pendulum-id/lib/python2.7/site-packages/numpy/core/include -I/home/moorepants/anaconda/envs/inverted-pendulum-id/include/python2.7 -c ufuncify_matrix_0_c.c -o build/temp.linux-x86_64-2.7/ufuncify_matrix_0_c.o -O3 -ffast-math | |
| gcc -pthread -shared build/temp.linux-x86_64-2.7/ufuncify_matrix_0.o build/temp.linux-x86_64-2.7/ufuncify_matrix_0_c.o -L/home/moorepants/anaconda/envs/inverted-pendulum-id/lib -lpython2.7 -o /home/moorepants/src/inverted-pendulum-sys-id/ufuncify_matrix_0.so | |
| (inverted-pendulum-id)moorepants@moorepants-2170p:inverted-pendulum-sys-id(master)$ ipython | |
| Python 2.7.8 |Continuum Analytics, Inc.| (default, Aug 21 2014, 18:22:21) | |
| Type "copyright", "credits" or "license" for more information. | |
| IPython 2.1.0 -- An enhanced Interactive Python. | |
| Anaconda is brought to you by Continuum Analytics. | |
| Please check out: http://continuum.io/thanks and https://binstar.org | |
| ? -> Introduction and overview of IPython's features. | |
| %quickref -> Quick reference. | |
| help -> Python's own help system. | |
| object? -> Details about 'object', use 'object??' for extra details. | |
| In [1]: import ufuncify_matrix_0 | |
| --------------------------------------------------------------------------- | |
| ImportError Traceback (most recent call last) | |
| <ipython-input-1-e70d4178a3f6> in <module>() | |
| ----> 1 import ufuncify_matrix_0 | |
| ImportError: ./ufuncify_matrix_0.so: undefined symbol: __pow_finite |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy as np | |
| cimport numpy as np | |
| cimport cython | |
| cdef extern from "ufuncify_matrix_0_h.h": | |
| void eval_matrix(double matrix[4], double a, | |
| double b, | |
| double c) | |
| @cython.boundscheck(False) | |
| @cython.wraparound(False) | |
| def eval_matrix_loop(np.ndarray[np.double_t, ndim=2] matrix, np.ndarray[np.double_t, ndim=1] a, | |
| np.ndarray[np.double_t, ndim=1] b, | |
| np.ndarray[np.double_t, ndim=1] c): | |
| cdef int n = matrix.shape[0] | |
| cdef int i | |
| for i in range(n): | |
| eval_matrix(&matrix[i, 0], a[i], | |
| b[i], | |
| c[i]) | |
| return matrix.reshape(n, 2, 2) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <math.h> | |
| #include "ufuncify_matrix_0_h.h" | |
| void eval_matrix(double matrix[4], double a, | |
| double b, | |
| double c) | |
| { | |
| double z_0 = pow(a, 2); | |
| double z_1 = a + b; | |
| matrix[0] = z_0*pow(cos(b), c); | |
| matrix[1] = pow(c, 4) + tan(b)/sin(z_1); | |
| matrix[2] = pow(b, 2) - sqrt(c) + z_0; | |
| matrix[3] = z_1*(c + z_1)*sin(b)/a; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void eval_matrix(double matrix[4], double a, | |
| double b, | |
| double c); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy | |
| from distutils.core import setup | |
| from distutils.extension import Extension | |
| from Cython.Distutils import build_ext | |
| extension = Extension(name="ufuncify_matrix_0", | |
| sources=["ufuncify_matrix_0.pyx", | |
| "ufuncify_matrix_0_c.c"], | |
| extra_compile_args=["-O3", "-ffast-math"], | |
| include_dirs=[numpy.get_include()]) | |
| setup(name="eval_matrix", | |
| cmdclass={'build_ext': build_ext}, | |
| ext_modules=[extension]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment