Add GPU support for compute_autocorrelations and compute_local_correlations#56
Merged
deto merged 7 commits intoYosefLab:masterfrom Mar 20, 2026
Merged
Add GPU support for compute_autocorrelations and compute_local_correlations#56deto merged 7 commits intoYosefLab:masterfrom
deto merged 7 commits intoYosefLab:masterfrom
Conversation
GPU support via CuPy for compute_autocorrelations and compute_local_correlations, enabled with use_gpu=True.
GPU support via CuPy for compute_autocorrelations and compute_local_correlations, enabled with use_gpu=True.
Remove section-header comments from GPU functions to match the bare style of their CPU counterparts. Remove benchmark image, add GPU/CPU equivalence scatter plot.
- Unify _build_sparse_weight_matrix with square parameter - Remove cp module parameter from GPU helpers (import locally) - Skip all_mu/all_x2 allocation when centered=True - Densify sparse counts once upfront instead of per-gene - Extract _postprocess_results to share between CPU and GPU paths - Fix pre-existing bug: none model branch in _compute_hs_pairs_inner fitted vals_x into mu_x instead of vals_y into mu_y - Replace inline model dispatch in _compute_hs_pairs_inner with _fit_gene
Member
|
This is great, Justin! Datasets have been growing much larger in recent years so the GPU acceleration is a welcome addition. |
Contributor
Author
|
Thanks @deto! I found Hotspot useful for my thesis so I thought I'd contribute to the package :) |
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.
Particularly with local correlations, the speed seems to be substantial once we get to scales applicable to realistic scenarios (hundreds of thousands of cells, thousands of genes).
Benchmark results comparing CPU vs GPU:

Equivalence results between CPU and GPU:
