Skip to content

Make CUDA a package extension - #68

Open
rsenne wants to merge 1 commit into
mainfrom
cuda-extension
Open

Make CUDA a package extension#68
rsenne wants to merge 1 commit into
mainfrom
cuda-extension

Conversation

@rsenne

@rsenne rsenne commented Aug 26, 2026

Copy link
Copy Markdown
Owner

Closes #59.

CUDA moves from [deps] to [weakdeps] behind a new CUDAExt, so installing and
loading ParallelMCMC no longer drags the CUDA stack onto machines that cannot use
it. using ParallelMCMC on its own now leaves CUDA unloaded; GPU runs are
unchanged apart from needing using CUDA alongside it, which they already did to
build the CuArrays in the first place.

CUDA moves from `[deps]` to `[weakdeps]` behind a new `CUDAExt`, so installing
and loading ParallelMCMC no longer drags the CUDA stack onto machines that
cannot use it. `using ParallelMCMC` alone now leaves CUDA unloaded.

The samplers were already array-type-agnostic everywhere but the random fills
— MALA's normal noise and DEER's Rademacher probes — which cannot be written
into device memory one element at a time. Those four `isa CuArray` checks all
asked the same question, so they collapse into one trait,
`needs_host_staging(x)`, defaulting to `false`. `_rademacher!` loses its two
`CuArray` dispatches for a trait branch in the generic method.

The extension is a single method setting that trait for `CuArray`, which also
drops the NVIDIA-only assumption: an AMDGPU or Metal user adds one method
rather than waiting on another extension.
Copilot AI lite review requested due to automatic review settings August 26, 2026 16:03

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@rsenne rsenne mentioned this pull request Aug 27, 2026
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.

Use CUDA as extensions?

2 participants