-
Notifications
You must be signed in to change notification settings - Fork 0
NUFFT + Installation fix #3
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
base: main
Are you sure you want to change the base?
Changes from all commits
88da59b
c09543a
5d2d797
efdb255
352bf36
b68a7cc
433fb6a
e4edf1b
11d067b
01232dc
c539469
41c50be
29ab1a9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,154 @@ | ||||||||||||||||||||||||||||||||||||||||||
| # Migration Plan: Self-contained finufft dependency in senpy | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| ## Context | ||||||||||||||||||||||||||||||||||||||||||
| `senpy/setup.py` hardcodes `/tmp/finufft/` paths and silently builds without NUFFT support if those paths don't exist. Getting a working build requires undocumented manual steps (clone finufft, run cmake with specific flags, build). This caused extensive debugging of the Dockerfile. The fix: make `setup.py` auto-fetch and build finufft if it's not present, so `pip install senpy` just works. | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| **Constraint**: finufft must link dynamically (shared `.so`). Static linking causes undefined symbol errors at import time. Use `-DFINUFFT_STATIC_LINKING=OFF`. | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| ## Critical Files | ||||||||||||||||||||||||||||||||||||||||||
| - [senpy/setup.py](../sensor_preprocessing_cpp/senpy/setup.py) — core rewrite | ||||||||||||||||||||||||||||||||||||||||||
| - [senpy/pyproject.toml](../sensor_preprocessing_cpp/senpy/pyproject.toml) — add cmake to build deps | ||||||||||||||||||||||||||||||||||||||||||
| - [senpy/.gitignore](../sensor_preprocessing_cpp/senpy/.gitignore) — add `_deps/` | ||||||||||||||||||||||||||||||||||||||||||
| - [Dockerfile](Dockerfile) — remove manual finufft build block | ||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+4
to
+12
|
||||||||||||||||||||||||||||||||||||||||||
| `senpy/setup.py` hardcodes `/tmp/finufft/` paths and silently builds without NUFFT support if those paths don't exist. Getting a working build requires undocumented manual steps (clone finufft, run cmake with specific flags, build). This caused extensive debugging of the Dockerfile. The fix: make `setup.py` auto-fetch and build finufft if it's not present, so `pip install senpy` just works. | |
| **Constraint**: finufft must link dynamically (shared `.so`). Static linking causes undefined symbol errors at import time. Use `-DFINUFFT_STATIC_LINKING=OFF`. | |
| ## Critical Files | |
| - [senpy/setup.py](../sensor_preprocessing_cpp/senpy/setup.py) — core rewrite | |
| - [senpy/pyproject.toml](../sensor_preprocessing_cpp/senpy/pyproject.toml) — add cmake to build deps | |
| - [senpy/.gitignore](../sensor_preprocessing_cpp/senpy/.gitignore) — add `_deps/` | |
| - [Dockerfile](Dockerfile) — remove manual finufft build block | |
| Before this work, `senpy/setup.py` relied on hardcoded `/tmp/finufft/` paths and could silently build without NUFFT support if those paths didn't exist, requiring undocumented manual steps (clone finufft, run cmake with specific flags, build) and causing extensive Dockerfile debugging. The implementation in this PR instead drives the existing top-level CMake configuration to build finufft into `../build`, avoiding `/tmp`-specific paths while keeping the build self-contained from a user perspective. | |
| **Constraint**: finufft must link dynamically (shared `.so`). Static linking causes undefined symbol errors at import time. Use `-DFINUFFT_STATIC_LINKING=OFF`. | |
| > Note: The detailed `_deps/finufft-…` auto-fetch flow described below was the original design; the current PR implementation builds finufft via the top-level CMake project into `../build` and assumes finufft sources are already present. Treat the auto-fetch logic as a future enhancement rather than a description of the current code. | |
| ## Critical Files | |
| - [senpy/setup.py](../sensor_preprocessing_cpp/senpy/setup.py) — updated to invoke the top-level CMake build (outputting to `../build`) instead of using hardcoded `/tmp/finufft/` paths | |
| - [senpy/pyproject.toml](../sensor_preprocessing_cpp/senpy/pyproject.toml) — currently unchanged with respect to build dependencies (does **not** add `cmake`); consider adding `cmake` here in a follow-up if we want to enforce it as a build requirement | |
| - [senpy/.gitignore](../sensor_preprocessing_cpp/senpy/.gitignore) — add `_deps/` if/when the auto-fetch flow is implemented | |
| - [Dockerfile](Dockerfile) — remove manual finufft build block so it relies on the `setup.py`/top-level CMake integration |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -16,8 +16,23 @@ include_directories(${CPP_DIR}) | |||||||||||||||||||
| # Find pybind11 | ||||||||||||||||||||
| find_package(pybind11 REQUIRED) | ||||||||||||||||||||
|
|
||||||||||||||||||||
| # Finufft configuration | ||||||||||||||||||||
| set(FINUFFT_INCLUDE_DIR "/tmp/finufft/include") | ||||||||||||||||||||
| set(FINUFFT_LIB "/tmp/finufft/build/src/libfinufft.a") | ||||||||||||||||||||
| set(FFTW3_LIB "/tmp/finufft/build/_deps/fftw3-build/libfftw3.a") | ||||||||||||||||||||
| set(FFTW3F_LIB "/tmp/finufft/build/_deps/fftw3f-build/libfftw3f.a") | ||||||||||||||||||||
|
Comment on lines
+20
to
+23
|
||||||||||||||||||||
| set(FINUFFT_INCLUDE_DIR "/tmp/finufft/include") | |
| set(FINUFFT_LIB "/tmp/finufft/build/src/libfinufft.a") | |
| set(FFTW3_LIB "/tmp/finufft/build/_deps/fftw3-build/libfftw3.a") | |
| set(FFTW3F_LIB "/tmp/finufft/build/_deps/fftw3f-build/libfftw3f.a") | |
| # These paths can be provided by the user or a parent CMake project. | |
| set(FINUFFT_INCLUDE_DIR "" CACHE PATH "Path to FINUFFT headers") | |
| set(FINUFFT_LIB "" CACHE FILEPATH "Path to the FINUFFT static library") | |
| set(FFTW3_LIB "" CACHE FILEPATH "Path to the FFTW3 static library") | |
| set(FFTW3F_LIB "" CACHE FILEPATH "Path to the FFTW3F static library") |
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.
On Apple platforms this unconditionally runs
brew --prefix libomp. If Homebrew isn’t installed (common on CI or non-brew setups), configuration will fail. Consider guarding withfind_program(brew)and/or usingfind_package(OpenMP)first, only falling back to Homebrew-specific hints when needed.