Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃摎 todo: Provide compiled Cython/C/C++ binaries #596

Open
dcmvdbekerom opened this issue Jul 31, 2023 · 6 comments
Open

馃摎 todo: Provide compiled Cython/C/C++ binaries #596

dcmvdbekerom opened this issue Jul 31, 2023 · 6 comments
Assignees
Labels
ci-dev continum-integration, tests, and development workflow enhancement New feature or request todo in the short-term roadmap
Milestone

Comments

@dcmvdbekerom
Copy link
Member

dcmvdbekerom commented Jul 31, 2023

馃挱 Description

Over the past years RADIS has been heavily optimized. Some of these optimization rely on cython/c++ code which is compiled during installation of RADIS. However, we shouldn't expect all users to have a compiler installed, and we also don't want them to miss out on optimizations. The situation is even worse for GPU code, as it currently requires cupy, which requires the CUDA Toolkit (3GB), which requires Microsoft Visual Studio (10+GB).

To prevent users have to compile code, we should do it for them. The pre-built libraries should be "staged", because we also don't want developers to have to rebuild all code if they're only working on one thing. For example, if a dev works on a cython optimization, we shouldn't require them to also be able to compile GPU code (requiring CUDA Toolkit and MSVC).

Cython/C++ code could be compiled into pre-built wheels. The problem with Wheels is that we need a separate version for OS (windows/linux/macOS), architecture (32/64bit), and Python version. However, there is a package called cibuildwheels that let's the CI build all these different flavors. I propose we build these whenever a version is released to PyPy.

Currently all cython functions have a python backup in case compilation fails. It would be better if we provide the backup in the form of Wheels, because then everyone will be running the same code. The disadvantage is that the barrier for development is slightly higher, because it would require more code to be re-compiled during development.

Curious to hear thoughts & suggestions!

Edit: CUDA can be handled entirely without C/C++ compilation, so I made a separate thread here: #603)

@dcmvdbekerom dcmvdbekerom added the todo in the short-term roadmap label Jul 31, 2023
@erwanp erwanp added the enhancement New feature or request label Aug 1, 2023
@erwanp
Copy link
Member

erwanp commented Aug 1, 2023

I'm curious about how it is done and implemented in other packages. Do you know of any gpu-accelerated Python package that doesn't require the C++ compiler & CUDA Toolkit ? Their devs could help us make the right choices in terms of deployment

@dcmvdbekerom
Copy link
Member Author

dcmvdbekerom commented Aug 1, 2023

It seems at least for the C++ part, cibuildwheels is how some of the larger packages do it
For the GPU part, most packages I know of require the CUDA toolkit (e.g., Vaex is built on top of cupy, which requires the CUDA toolkit)

E: Looks like PyTorch has CUDA pre-compiled

@erwanp
Copy link
Member

erwanp commented Aug 1, 2023

Btw the deploy step of Radis (activated on pushes to the master branch) already builds a wheel https://github.com/radis/radis/blob/develop/.travis.yml#L84

@dcmvdbekerom
Copy link
Member Author

Btw the deploy step of Radis (activated on pushes to the master branch) already builds a wheel

That's interesting.. It seems it makes one wheel for all platforms and versions.
Unfortunately the build cython files (.pyd) are speficic to each python version and platform. This is where cibuildwheels is useful because it builds for all (selected) versions and platforms.

I'm thinking we could use cibuildwheels to compile cython code whenever it is modified during development, and then pack the .pyd files with the bdist_wheel built by travis.

@dcmvdbekerom dcmvdbekerom changed the title 馃摎 todo: Users should be able to get all features without having to compile any code 馃摎 todo: Provide compiled Cython/C/C++ binaries Aug 10, 2023
@erwanp
Copy link
Member

erwanp commented Aug 14, 2023

Said today : we'll release next version 0.15 with cibuildwheels and see if it works ! I'm taking this.

@erwanp erwanp added this to the 0.15 milestone Aug 14, 2023
@erwanp erwanp added the ci-dev continum-integration, tests, and development workflow label Aug 14, 2023
@erwanp erwanp self-assigned this Aug 14, 2023
@dcmvdbekerom dcmvdbekerom mentioned this issue Aug 27, 2023
18 tasks
@dcmvdbekerom
Copy link
Member Author

We will have to decide: what is the lowest python version we would want to support?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci-dev continum-integration, tests, and development workflow enhancement New feature or request todo in the short-term roadmap
Projects
None yet
Development

No branches or pull requests

2 participants