-
Notifications
You must be signed in to change notification settings - Fork 437
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove npymath library from cython extensions #527
Conversation
|
||
#define DPY_PI NPY_PI | ||
|
||
/* From numpy npy_math.c.src */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe specify which version (commit hash?) of numpy, for future updaters.
Looks good to me. Omar - did you already try_branch these? |
I guess we should also remove the 'check_npymath' code from |
Yes, I tried yesterday on the two conflicting buildbots, and all the green ones, just to be sure we didn't break anything (we didn't). Now I'm trying with the new modifications.
What about explicitly requesting manifest creation to msvc? to prevent the checker from failing with versions 10.0+: |
Omar - sorry - I didn't see this until just now - I had done another fix - what do you think of this one? |
Please go ahead and merge / rebase if you like #530 . |
a1068cd
to
0fcd460
Compare
Rebased, thanks! |
Hey this is +1 here too. Don't wait for me to merge this. Go ahead and merge it when Travis is done. It's just getting a bit too late here. So, it seems that tomorrow if we are lucky we might be able to release... Thx for the hard work. |
ext_kwargs = get_info('npymath') | ||
|
||
# We use some defs from npymath, but we don't want to link against npymath lib | ||
ext_kwargs = {'include_dirs':get_info('npymath')['include_dirs']} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now we can go back to include_dirs=[np.get_include()]
- I think - and not call get_info('npymath')
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We still need some defs from numpy, like this:
https://github.com/nipy/dipy/pull/527/files#diff-e4efbbc259c0bf121fb79b7f40ed1cc1R65
Right now we just need a couple defs but if later on we need other npymath functions we may need more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean defs from the header files? Then won't include_dirs=[np.get_include()]
cover that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!, I didn't know about that =)
If travis-ci tests pass, let's merge this and see what the buildbots make of it. Thanks for your patience working through the comments. |
7bcdffd
to
bef4785
Compare
MRG: Remove npymath library from cython extensions npymath lib does not work for MSVC and numpy compiled with mingw. Rather than work round this, copy the functions we need into `dpy_math.h` and use those.
When numpy is built with mingw, the npy_* functions exported from libnpymath.a reference some runtime math functions whose name has a leading underscore, like:
...
000008E5 REL32 00000000 86 _asinf
000008F5 REL32 00000000 85 _acosf
00000905 REL32 00000000 84 _atanf
...
If we try to link this library with visual c by renaming it to npymath.lib it will fail because the corresponding functions in the msvc runtime don't contain that leading underscore:
...
00000281 REL32 00000000 4F asinf
00000291 REL32 00000000 51 acosf
000002A1 REL32 00000000 53 atanf
...
This means that the library compiled with mingw is not compatible with visual c, and we get these errors:
http://nipy.bic.berkeley.edu/builders/dipy-bdist32-34/builds/76/steps/shell_6/logs/stdio
This PR removes the npymath library from the linking step of the cython extensions, and defines the required subset of math functions in dpy_math.h (by borrowing some code directly from numpy).
With the proposed modification, the conflicting buildbots now pass:
http://nipy.bic.berkeley.edu/builders/dipy-bdist32-33/builds/78
http://nipy.bic.berkeley.edu/builders/dipy-bdist32-34/builds/80