PythonPackage: add RPATHs, parallel builds#20765
PythonPackage: add RPATHs, parallel builds#20765adamjstewart wants to merge 2 commits intospack:developfrom
Conversation
|
Problems I've encountered so far:
I'm hoping that most of these problems are package-specific and infrequent enough that we can fix those libraries by upstreaming patches. Definitely needs more testing to see what other issues this could cause. |
|
@adamjstewart great work! this might affect the Cartopy example, but if you look at the implementation of On Linux, we ask |
"The Python 3.8 + macOS multiprocessing fiasco" makes me think of #14102, which was resolved by #18205. Are you seeing other issues with creating processes on Mac? It sounds like the issue is with |
|
@scheibelp cython/cython#3973 is the main multiprocessing problem I've encountered so far. Basically, Cython implements its own multiprocessing, so when you do So this isn't a Spack bug. The only remaining Spack + Python 3.8 + macOS bug that I know of is #20025. |
|
@adamjstewart using this branch |
|
At this point I'm pretty confident in the parallel build logic. Cython is the only build failure I've seen so far, but we can add a workaround for that. What I'm less confident in is the RPATH logic. If that doesn't actually work, there's no point in adding this additional complexity. We can still use |
|
@adamjstewart how can we test the rpath logic? I’m happy to help testing if I know how to test it. I’d never used RPATH before spack, so I don’t know how to test it at all. |
|
@robertu94 In my mind, there's 3 different kinds of tests.
|
|
Before this can be merged, I want to make sure a sizeable portion of Python packages don't break. Personally, I use the following spack:
specs:
- py-black
- py-cartopy
- py-cmocean
- py-codecov
- py-fiona
- py-flake8
- py-geopandas
- py-geoplot
- py-jupyterlab
- py-matplotlib
- py-mypy
- py-numpy
- py-pandas
- py-pygeos
- py-pyinstrument
- py-pytest
- py-pytest-cov
- py-pytest-mock
- py-pyyaml
- py-rasterio
- py-scikit-learn
- py-scipy
- py-setuptools
- py-shapely
- py-sphinx
- py-sphinx-rtd-theme
- py-sphinxcontrib-programoutput
- py-tables
- py-torch
- py-torchvision
- py-twine
- py-verminOther users may have more packages they care about, but this is probably enough for testing. |
|
Ok, I've setup a mass build and test script with this information to run. I'll let you know how it goes. |
|
@adamjstewart Here are the high level results:
I'll have to dig into the results more carefully to know exactly what worked/didn't. |
|
Hmm, so there are some packages that this doesn't help. Are there any packages that this hurts? Are there any packages that this does help? |
|
@adamjstewart I've had more time to read the build logs, this change breaks the build for matplotolib and py-tables and a possibly a few of their dependents; scipy's build time nearly doubled with this patch. |
|
Let me investigate some of these examples a bit. In the meantime, I may open a separate PR that only includes the parallel build changes. |
@robertu94 I was unable to reproduce this locally.
I do notice the following warning message: If I set |
|
@adamjstewart in my testing it was about 11m for the parallel build, and 7m40s for the serial build on a 40core node on my schools cluster. The file system is served to the nodes over NFS, so perhaps I hit several load spikes on the file system that pushed the build time higher. |
|
Hmm, so even building in parallel might be problematic. Do you encounter that same issue with non-Python packages? Does limiting the parallelism to 4 help? |
|
I do occasionally hit that with non python packages as well — it seems to be a feature of our cluster from time to time. I don’t blame spack for NFS being slow. |
|
Hi all, sorry for being late to join the discussion. @adamjstewart mentioned at the start that the compiler wrappers are filtered out of python installations, and I'm wondering if that is the cause of many problems mentioned here. I can't remember the reason for filtering out the wrappers, but I'm guessing one reason is that users want to install python packages outside of spack commands. If so, would it be possible to enhance the wrappers so they behave correctly outside of spack commands? |
|
I believe #21149 is designed to do just that. |
This is a reboot of #4545
Some Python packages depend on non-Python dependencies. For example,
py-pillowdepends on several imaging libraries. When building these Python packages, Python uses whatever compiler it was built with. Since we filter the compiler wrappers out of the Python installation, this means that we are not using Spack's compiler wrappers when installing Python packages, and hence we are not RPATHing dependencies. Even worse, some packages likepy-torchwill use a mix ofCCand the compiler Python was built with, meaning that some parts of the build can find dependencies while others can't.Previously, we were building with:
Now, we build with:
@robertu94 @mjwoods @trws @skosukhin