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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Facilitate parallel build directories for meson-enabled commands? #171

Closed
lagru opened this issue Mar 18, 2024 · 5 comments · Fixed by #221
Closed

Facilitate parallel build directories for meson-enabled commands? #171

lagru opened this issue Mar 18, 2024 · 5 comments · Fixed by #221

Comments

@lagru
Copy link
Member

lagru commented Mar 18, 2024

While making scikit-image compatible with NumPy 2 I often had to switch back and forth between 2 environments with NumPy 1.x and 2 installed. I had to use spin build --clean each time I switched which even with ccache available took a bit of time. From the initial introduction of meson and it "breaking" inplace editable installs I remember that one of the arguments was that meson would allow having multiple build directories in parallel. Perhaps I missed an obvious way to achieve this with existing capabilities of spin?

If not and going forward, can we facilitate this workflow a bit more in spin? For my scenario I imagined something like a -t, --target TARGET switch. If not specified the default setup with build/skimage and build-install is used. With -t np2 meson-enabled spin commands would use build/np2/skimage and maybe build-install/np2?

UI and paths are of course up for discussion but I think it get's the workflow across that I'd like to have. It would enable faster switching and debugging with multiple environments that require recompilation.

@stefanv
Copy link
Member

stefanv commented Mar 21, 2024

This would require either storing some state ("last used build dir"), or specifying the builddir on each run. If you think the latter is acceptable, I can add it.

@rgommers
Copy link
Contributor

or specifying the builddir on each run

SciPy's dev.py does it this way, with a --build-dir flag that comes before the subcommand. It's quite usable when combined with a shell alias. E.g.:

$ alias dev="python dev.py --build-dir build"
$ alias dev-clang="python dev.py --build-dir build-clang"
$ # run the same tests for the two different builds:
$ dev test -s linalg
$ dev-clang test -s linalg

I'd suggest doing it the same way for spin, including documenting the alias trick.

@lagru
Copy link
Member Author

lagru commented Mar 21, 2024

Yeah, even a simple toggle would help with the workflow so it's not really worth it for spin to worry about saving state suddenly. There's also the option to use an environment variable in addition. But probably not worth it since the alias-approach also allows to configure the build dir per shell session or even longer.

@stefanv
Copy link
Member

stefanv commented May 22, 2024

We're releasing 0.10 today, aiming to get this into 0.11.

@stefanv
Copy link
Member

stefanv commented Jul 17, 2024

I'd suggest doing it the same way for spin, including documenting the alias

Thanks, Ralf, I've included this tip in the documentation in #221

stefanv added a commit that referenced this issue Aug 15, 2024
Closes #171

- Add `-C` flag to meson commands to set custom build dir
- Add tests and verify that compilation happens in correct location
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants