Skip to content

Split CUDA extension into cuSPARSE/cuBLAS for CUDA.jl 6.x#84

Open
albertomercurio wants to merge 1 commit into
JuliaSmoothOptimizers:mainfrom
albertomercurio:cuda6-split-extensions
Open

Split CUDA extension into cuSPARSE/cuBLAS for CUDA.jl 6.x#84
albertomercurio wants to merge 1 commit into
JuliaSmoothOptimizers:mainfrom
albertomercurio:cuda6-split-extensions

Conversation

@albertomercurio

Copy link
Copy Markdown

CUDA.jl 6.0 split the monolithic package into a CUDA meta-package plus standalone CUDACore, cuSPARSE, cuBLAS, ... The single extension keyed only on CUDA never activated when a package loaded just the split libraries (e.g. using cuSPARSE), and it went through the deprecated CUDA.CUSPARSE / CUDA.CUBLAS bindings.

Replace KrylovPreconditionersCUDAExt with two granular extensions:

  • KrylovPreconditionersCuSPARSEExt (triggers: CUDACore, cuSPARSE) — ic0, ilu0, operators, scaling
  • KrylovPreconditionersCuBLASExt (triggers: CUDACore, cuSPARSE, cuBLAS) — block Jacobi, which additionally needs batched LU/inverse from cuBLAS

using CUDA still activates both extensions since it loads the split libraries. This requires CUDA.jl 6.2 and drops the 5.x code path, so the package version is bumped to 0.4.0.

CUDA.jl 6.0 split the monolithic package into a `CUDA` meta-package plus
standalone `CUDACore`, `cuSPARSE`, `cuBLAS`, ... The single extension keyed
only on `CUDA` never activated when a package loaded just the split
libraries (e.g. `using cuSPARSE`), and it went through the deprecated
`CUDA.CUSPARSE` / `CUDA.CUBLAS` bindings.

Replace `KrylovPreconditionersCUDAExt` with two granular extensions:

- `KrylovPreconditionersCuSPARSEExt` (triggers: CUDACore, cuSPARSE) —
  ic0, ilu0, operators, scaling
- `KrylovPreconditionersCuBLASExt` (triggers: CUDACore, cuSPARSE, cuBLAS) —
  block Jacobi, which additionally needs batched LU/inverse from cuBLAS

`using CUDA` still activates both extensions since it loads the split
libraries. This requires CUDA.jl 6.2 and drops the 5.x code path, so the
package version is bumped to 0.4.0.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 1, 2026 20:27

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates KrylovPreconditioners’ NVIDIA/CUDA integration to work with CUDA.jl 6.x’s split packages by replacing the old single CUDA-keyed extension with separate cuSPARSE- and cuBLAS-keyed extensions, and bumps the package version accordingly.

Changes:

  • Split the CUDA extension into KrylovPreconditionersCuSPARSEExt and KrylovPreconditionersCuBLASExt keyed on CUDACore/cuSPARSE/cuBLAS.
  • Update CUDA-related weakdeps/compat entries for the split packages and bump version to 0.4.0.
  • Adjust GPU test imports and migrate block-Jacobi synchronization away from deprecated CUDA.@sync.

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
test/gpu/nvidia.jl Updates NVIDIA GPU test imports to use the CUDA.jl 6.x cuSPARSE submodule.
Project.toml Bumps version and replaces the old CUDA weakdep/extension with CUDACore/cuSPARSE/cuBLAS weakdeps and granular extensions.
ext/KrylovPreconditionersCuSPARSEExt.jl Defines the cuSPARSE-triggered extension and includes IC0/ILU0/operators/scaling CUDA implementations.
ext/KrylovPreconditionersCuBLASExt.jl Introduces the cuBLAS-triggered extension and includes the CUDA block-Jacobi implementation.
ext/CUDA/block_jacobi.jl Switches synchronization usage for batched LU/inversion calls in the CUDA block-Jacobi update path.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread ext/CUDA/block_jacobi.jl
Comment on lines +32 to +33
@sync pivot, info = CUBLAS.getrf_batched!(p.blocklist, true)
@sync pivot, info, p.blocklist = CUBLAS.getri_batched(p.blocklist, pivot)
Comment thread test/gpu/nvidia.jl
@@ -1,4 +1,4 @@
using CUDA, CUDA.CUSPARSE, CUDA.CUSOLVER
using CUDA, CUDA.cuSPARSE
@amontoison

Copy link
Copy Markdown
Member

Please only do one extension KrylovPreconditionersCUDAExt with CUDACore, cuSPARSE, cuBLAS. It will be easier to maintain.

@albertomercurio

Copy link
Copy Markdown
Author

Yes but I was wondering what if people only load CUDACore and cuSPARSE? The extension won't load, so people are forced to load CUDA.jl entirely

@amontoison

Copy link
Copy Markdown
Member

99.9% of the users will just install CUDA.jl.

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 this pull request may close these issues.

3 participants