Skip to content

Share primary CUDA context on the same device#10

Merged
lohedges merged 6 commits intodevelfrom
feature_primary_context
Feb 3, 2026
Merged

Share primary CUDA context on the same device#10
lohedges merged 6 commits intodevelfrom
feature_primary_context

Conversation

@lohedges
Copy link
Contributor

@lohedges lohedges commented Feb 3, 2026

This PR refactors the code so that the primary CUDA context is shared when multiple GCMCSamplers are created on the same GPU device, i.e. we use reatain_primary_context() rather than make_context(). This reduces GPU memory overhead by roughly ~230 MiB per additional sampler.

The kernel code has also been refactored to avoid the use of compile-time constants, meaning that the kernel code now only needs to be compiled once, regardless of the system topology, allowing it to be cached and re-used across samplers.

@lohedges
Copy link
Contributor Author

lohedges commented Feb 3, 2026

Looks like anaconda.org is down at the moment. Will try again in a bit.

@lohedges lohedges merged commit 213961b into devel Feb 3, 2026
4 of 8 checks passed
@lohedges lohedges deleted the feature_primary_context branch February 3, 2026 16:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant