finufft icon indicating copy to clipboard operation
finufft copied to clipboard

Remove reliance on extension modules

Open blackwer opened this issue 1 year ago • 11 comments

Following my frustrations at #389, I'm drafting this PR to just remove any extra shared library generation at install time for the python bindings. I'm basing this PR off of #393

blackwer avatar Dec 12 '23 16:12 blackwer

already done in this PR

On Tue, Dec 12, 2023 at 4:37 PM Joakim Andén @.***> wrote:

@.**** approved this pull request.

This looks good. Just feels a bit strange to include shared libraries as “data” files but seems to work.

Should we give finufft the same treatment, then?

— Reply to this email directly, view it on GitHub https://github.com/flatironinstitute/finufft/pull/394#pullrequestreview-1778477481, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACY7UWJV74WO7RW72VGUZDYJDFAVAVCNFSM6AAAAABARX3VWSVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMYTONZYGQ3TONBYGE . You are receiving this because you were assigned.Message ID: @.***>

blackwer avatar Dec 12 '23 22:12 blackwer

already done in this PR

Weird. Somehow missed it. Anyhow saw it now and it looks good.

Tried making the binary wheels using the docker image for cufinufft. Everything looks good there too. One interesting consequence is that we're now independent of the CPython ABI(?). In other words, we only need to ship a single binary wheel cufinufft-2.2.0.dev0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl. So that's a +1 for ctypes!

janden avatar Dec 12 '23 22:12 janden

you were blinded by all of my shiny force pushes

On Tue, Dec 12, 2023 at 5:36 PM Joakim Andén @.***> wrote:

already done in this PR

Weird. Somehow missed it. Anyhow saw it now and it looks good.

Tried making the binary wheels using the docker image for cufinufft. Everything looks good there too. One interesting consequence is that we're now independent of the CPython ABI(?). In other words, we only need to ship a single binary wheel cufinufft-2.2.0.dev0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl. So that's a +1 for ctypes!

— Reply to this email directly, view it on GitHub https://github.com/flatironinstitute/finufft/pull/394#issuecomment-1852922085, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACY7UV4PLQLQHOPCNY2R7DYJDL5RAVCNFSM6AAAAABARX3VWSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNJSHEZDEMBYGU . You are receiving this because you were assigned.Message ID: @.***>

blackwer avatar Dec 12 '23 22:12 blackwer

This still needs a bit of hardening for macs. In some instances macs get a dylib and others a so. Can't rely solely on the platform.

blackwer avatar Dec 13 '23 15:12 blackwer

Maybe related, but the wheel names are the same (finufft-2.2.0.dev0-py3-none-any.whl) for both win and mac, which I assume would cause problems.

janden avatar Dec 13 '23 16:12 janden

Maybe related, but the wheel names are the same (finufft-2.2.0.dev0-py3-none-any.whl) for both win and mac, which I assume would cause problems.

The python version is not encoded in name either. The master branch ci generates finufft-2.2.0.dev0-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl finufft-2.2.0.dev0-cp38-cp38m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl etc after changing, it generates finufft-2.2.0.dev0-py3-none-any.whl for all python versions. https://github.com/flatironinstitute/finufft/actions/runs/7185113178/job/19567673308#step:6:407 Not sure how to fix.

lu1and10 avatar Dec 13 '23 17:12 lu1and10

Maybe related, but the wheel names are the same (finufft-2.2.0.dev0-py3-none-any.whl) for both win and mac, which I assume would cause problems.

The python version is not encoded in name either. The master branch ci generates finufft-2.2.0.dev0-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl finufft-2.2.0.dev0-cp38-cp38m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl etc after changing, it generates finufft-2.2.0.dev0-py3-none-any.whl for all python versions. https://github.com/flatironinstitute/finufft/actions/runs/7185113178/job/19567673308#step:6:407 Not sure how to fix.

maybe it's fine, building extension module is python version dependent while ship with .so as data does not require python version? the .so, .dylib or .dll file may be os dependent, maybe there is a way to tell package_data, it's os dependent so the wheel name will be named accordingly..

lu1and10 avatar Dec 13 '23 17:12 lu1and10

maybe it's fine, building extension module is python version dependent while ship with .so as data does not require python version?

Right. Since we don't depend on the Python ABI, it makes sense that the wheel should be independent of Python version.

the .so, .dylib or .dll file may be os dependent, maybe there is a way to tell package_data, it's os dependent so the wheel name will be named accordingly..

Yes this is an issue. Right now, Linux has a different tag (manylinux) but macOS and Windows have the same names.

janden avatar Dec 13 '23 18:12 janden

I'm a little worried this may introduce new bugs that we don't completely have a handle on relatively close to a release. At the end of the day, the old way (C extension with rpath and friends) works except for certain corner cases and we expect most people to install the binary wheels anyhow where this wouldn't be an issue. Besides, wouldn't some of these issues (compiler incompatibility, etc.) be resolved once we move to scikit-build (integrating the library building inside the pip install process)?

janden avatar Dec 13 '23 20:12 janden

I'm a little worried this may introduce new bugs that we don't completely have a handle on relatively close to a release. At the end of the day, the old way (C extension with rpath and friends) works except for certain corner cases and we expect most people to install the binary wheels anyhow where this wouldn't be an issue. Besides, wouldn't some of these issues (compiler incompatibility, etc.) be resolved once we move to scikit-build (integrating the library building inside the pip install process)?

I'm not sure I'd recommend scikit-build here necessarily. This solution is showing a fair amount of benefits so far. We also don't need to merge it before release. I was having issues with the ubuntu cython fix, so I opted to try a different method as a trial to completely circumvent it. Currently this PR is more of a playground, but I'm relatively confident as of right now it's a good long-term solution.

That said, I think I can get a handle on the bugs (I can actually test the binaries on a lot of platforms directly). If the wheels work, which is what this is mostly designed to deal with, then I don't see much of an issue with merging it.

blackwer avatar Dec 13 '23 20:12 blackwer

This will get taken care of by #429

ahbarnett avatar May 07 '24 20:05 ahbarnett

closing this 2023 PR since superceded by #429 @janden @blackwer @lu1and10 @DiamonDinoia

ahbarnett avatar Jun 24 '24 17:06 ahbarnett