-
-
Notifications
You must be signed in to change notification settings - Fork 551
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
Tracking issue: migrate to scikit-build-core
#3564
Comments
Personally I would prefer to work with CMake over Ninja, but that could just be my bias from spending most of my career as a C++ dev |
Yes, CMake is the easier of the two overall and requires less effort since the compilation will still be controlled via the Nevertheless, this can be a potential GSoC project for someone who wants to tackle Python packaging since the changes would revolve a lot around that area, if not entirely around it. |
Hello! I was going through the GSOC 2024 Idealist and encountered this project. I am interested in learning and working on the Python backend, and this project will significantly help develop my skills. In the same route, I can help contribute to PyBaMM! As a starter, I would like to discuss whether we should decide on I would prefer Also, I would also like to discuss some technical aspects of the project. Thank you! |
Thanks for sharing, @cringeyburger. I would agree that The Ninja build system should be able to handle the IDAKLU solver's compilation, but I am unsure whether it can do so for the prerequisites (SuiteSparse and SUNDIALS) – they might require a pure CMake build or perhaps calling CMake from inside However, Windows builds are significantly long and take ~20 minutes overall, without caching which would be a problem on editable installations. It looks like microsoft/vcpkg#36885 will get merged soon which could provide some benefits (I'm unsure whether it is the SUNDIALS compilation or the SuiteSparse's component's compilation that takes longer on Windows). This might require bumping SUNDIALS to v6.7.0, we use v6.5.0 – it doesn't look like there are many changes to the IDAS component that we use (here are the release notes) and subsequently perhaps SuiteSparse from v6.0.3 to a later version (which would require changes to the C++ solver code). We should be able to forego |
+1 for scikit-build-core |
Bumping the priority to medium since this will now be worked on this year |
I did a quick test and I notice that on macOS, |
On windows x64 architecture laptop,
On WSL running Ubuntu
Does As you have said, if that PR with vcpkg is merged, then having I am interested in learning more about For large packages like ours, the incremental build feature of Assuming that majority of our team is familiar with NOTE: My network speed (measured using Google's speed test) is ~100mbps |
You mention that We should still use the GitHub releases for SuiteSparse on Linux and macOS though – they seem to be faster than I am not sure about parallelism in I do not know much about P.S. I see that you have a Windows system configured already – could you test how long it takes to do |
Sorry for the late reply! I tried doing a lot of things for component-based installation of Here is the link to the issue. As for Here is the procedure I followed:
After this (I will reproduce the names of the files if you want) And the final statement: Despite the warnings, Please let me know if there is any issue from my side! |
2.8 minutes should be reasonable, thanks – this confirms that the SuiteSparse installation is the slowest of all. 2.8 minutes is of course significantly slower than installing CasADi from its Python wheel, which is a matter of seconds – we were using the wheel earlier but had to resort to using the registry afterwards due to upstream changes. We have an issue open (#3603) for restoring this behaviour, which no one has been able to get to yet. It looks like the SuiteSparse issue will be dormant for a long time – I noticed that I had seen it before because I was already subscribed to it :) The CasADi installation from |
I tried fixing the warnings by changing the portfile. I followed the instructions given through warnings when I built it.
|
Oh, by "good to look how to clear the warnings" I didn't mean doing so just now – I do not think it is the biggest of deals currently and can definitely be picked up at a later time (maybe CasADi can be added as a The gist of the discussion that entailed here should be that despite and regardless of the build backend we end up choosing, reducing the Windows installation time would be great. We don't compile the IDAKLU solver on PR workflows because of that – that is an area where reducing CI time is important. But then we don't compile it when running the Windows scheduled tests either (#3664) where we don't need to bother how long the test runs. Being able to speed things up would benefit us in other ways too, say, identifying issues such as #3783 early on. |
I'm interested in this project too. I'm in the process of making a proposal |
scikit-build-core
or meson-python
scikit-build-core
Now that we have a declarative format for build metadata provided by
pyproject.toml
and build isolation enabling a more stable installation procedure via PEP 517/518, it eases the migration to either thescikit-build-core
or themeson-python
build-backend(s). Both of them include support for editable installations and are slowly becoming more mature for downstream users, considering that NumPy1 and SciPy2 have successfully transitioned this year.The
scikit-build-core
build backend would still use CMake as a build system as we do currently, butmeson-python
requiresninja
as a build system, which would render the IDAKLU target compilation procedure radically different from the current one.Some advantages of these new build-backends:
distutils
orsetuptools
at all)Task list
These tasks will be useful to look at, but not all of them might end up being needed or valid – subject to further discussion:
sundials_installed/
or similar by adjustingCMAKE_INSTALL_PREFIX
instead of modifying the.local/
folder in the HOME directory` for a userpybind11
as a build-time dependency inpyproject.toml
libomp.dylib
that's set with the correctMACOSX_DEPLOYMENT_TARGET
at least when deploying the wheels (not the Homebrew one). The reason for this is that Apple Clang does not come with the OpenMP specification – however, other compilers such as LLVM and GCC do. See also: Fortnightly build for wheels failed / PyBaMM import kills process on macOS M-series #4091, Use wider-compatible LLVM-OpenMP, bundlelibgfortran
dylibs for macOS wheels #4092.sdist
is used to install PyBaMM, and the IDAKLU solver which is optional cannot be installed unless one is installing from source or usingpip install pybamm --no-binary pybamm
to force installing from the sdist on PyPI. To provide a means to attempt IDAKLU compilation, a--config-settings
command-line flag can be added to thepip install pybamm
command that can be parsed by the build backend (scikit-build-core
in this case). Therefore, users should have to manually opt-in to the compilation (the build option should be off by default). For this,pybind11
should be a build-time dependency (see above).nox -s pybamm-requires
on macOS and Linux, possibly remove this command) and add docs on how to do this on WindowsCMakeLists.txt
(includedCMakeLists.txt
#4101) and other relevant files such asFindSuiteSparse.cmake
andFindSUNDIALS.cmake
to the SDist via theMANIFEST.in
file, otherwise, CMake will raise an error about a missing project status. This needs to be done as a part of the migration and a job could be added that tests building a wheel from the sdist nightly (and/or we can use the scheduled tests).Footnotes
https://rgoswami.me/posts/numpy-meson-f2py/ ↩
https://labs.quansight.org/blog/building-scipy-with-flang ↩
https://labs.quansight.org/blog/2021/07/moving-scipy-to-meson ↩
The text was updated successfully, but these errors were encountered: