Fix build with use_gpu=true#221
Merged
Merged
Conversation
Owner
|
Thanks for doing this! |
bodono
added a commit
that referenced
this pull request
Jul 22, 2026
Neither the use_gpu build nor the cuBLAS/cuSPARSE linking (fixed in #221) was covered by CI. Add a build_gpu job that installs the CUDA toolkit libraries from conda-forge and builds with -Duse_gpu=true. Linking against cuBLAS/cuSPARSE needs the toolkit but not a physical GPU, so the job builds and link-checks without running the solver. A shared library links successfully even with undefined symbols, so the job asserts via readelf that _scs_gpu records libcublas and libcusparse as NEEDED entries -- the #221 bug was a missing link that only surfaced at import time as `undefined symbol: cusparseDestroySpMat`. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
bodono
added a commit
that referenced
this pull request
Jul 22, 2026
The GPU backend requires 32-bit integers; meson errors out otherwise (meson.build:173). Match the documented use_gpu build invocation from #221. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
bodono
added a commit
that referenced
this pull request
Jul 22, 2026
* Scope CUDA link deps to their targets in meson.build The use_gpu block appended cuda/cublas/cusparse to the shared `_deps` list, so those libraries leaked into every extension module defined afterwards (_scs_mkl, _scs_accelerate, _scs_cudss) when use_gpu was combined with those backends. link_cudss had the same issue with cuda/cudss. Build a per-target dependency list (mirroring the existing `_mkl_deps = _deps + [...]` pattern) instead of mutating `_deps`. Also note in a comment that the GPU sources are listed explicitly because Meson's fs module has no glob(), and must be kept in sync with the .c files in the submodule. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * ci: add build-only GPU job to validate use_gpu link path Neither the use_gpu build nor the cuBLAS/cuSPARSE linking (fixed in #221) was covered by CI. Add a build_gpu job that installs the CUDA toolkit libraries from conda-forge and builds with -Duse_gpu=true. Linking against cuBLAS/cuSPARSE needs the toolkit but not a physical GPU, so the job builds and link-checks without running the solver. A shared library links successfully even with undefined symbols, so the job asserts via readelf that _scs_gpu records libcublas and libcusparse as NEEDED entries -- the #221 bug was a missing link that only surfaced at import time as `undefined symbol: cusparseDestroySpMat`. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * ci: build GPU with int32=true (required by GPU backend) The GPU backend requires 32-bit integers; meson errors out otherwise (meson.build:173). Match the documented use_gpu build invocation from #221. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * ci: locate installed _scs_gpu via sysconfig, not import Importing scs from the repo root resolved the local ./scs source directory (a namespace package, __file__ is None) instead of the installed package, leaving the .so path empty. Find the extension under sysconfig platlib instead. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * ci: find installed _scs_gpu via shell, avoid nested-quote issue pixi run stripped the inner single quotes from the python -c snippet, so sysconfig.get_path('platlib') became a bare name (NameError). Locate the .so with find over the pixi env lib dir instead of invoking python. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When building with
python -m pip install -Csetup-args=-Duse_gpu=true -Csetup-args=-Dint32=true ., I get the errorIndeed the meson documentation for fs doesn't seem to have a glob function. The first commit unfurles the globs.
Next, when I run the
GPU_INDIRECTsolver, I getIt seems it's not linked against
cusparse(andcublas). The second commit adds these dependencies, and the solver runs in my testing. If I'm somehow building the library wrong, please let me know.Fixes #168. (While writing this PR I just noticed #168 (comment)... :p)