You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
PCA fails with CUDA out-of-memory on large datasets (2.7M cells) despite sufficient VRAM #5
I'm scalesc to run a big-scale spatial transcriptomic data using it's GPU supported. My data is ~2.7 million cells x 6,175 genes. However, when I tried to run PCA, it would always return me the CUDA memory error. More specifically, I suspect that it's due to the process when it tries to convert the sparse data to dense. Please see the detailed version and error message below. I'm wondering if the team has any insights in fixing this?
Environment
ScaleSC version: 0.1.0
CuPy version: 13.6.0
GPU: NVIDIA L40S (47.67GB VRAM × 2)
CUDA: 13.0, Driver: 580.159.03
Dataset
2,702,045 cells × 6,157 genes
Sparse CSR float32
3,000 HVGs selected via seurat_v3
Note on initialization
I'm using a custom wrapper to initialize ScaleSC due to a separate shape reader issue on large datasets:
normalize_log1p and highly_variable_genes both complete successfully. The full pipeline also ran without issues on smaller datasets.
Problem
pca() consistently fails with:
MemoryError: std::bad_alloc: out_of_memory: CUDA error at: /gscratch/stf/wz34/envs/ScaleSC/include/rmm/mr/device/cuda_memory_resource.hpp
I noticed
1 — allocation is always exactly ~17GB
The allocation request is consistently 17383920128B (~17GB) regardless of max_cell_batch value (tested with 100,000, 50,000, 25,000, and 1,000). This suggests the ~17GB is a fixed overhead unrelated to batch size, making max_cell_batch ineffective as a workaround.
only GPU 0 is used
Your findings are correct. The memory used to store the sparse matrix has an upper limit of 17 GB due to the limitation of scipy.sparse. Currently, our ScaleSC supports only a single GPU and does not utilize multiple GPU cards.
Activity
wx-guyue commentedon May 23, 2026
Hi,
Your findings are correct. The memory used to store the sparse matrix has an upper limit of 17 GB due to the limitation of scipy.sparse. Currently, our ScaleSC supports only a single GPU and does not utilize multiple GPU cards.
Best,
Wenxing
wx-guyue commentedon May 23, 2026
@wzeng96 Could you provide more details about your HVG and PCA steps? Sharing the full script would be even better.