Closed tjbencomo closed 5 months ago
Hi @tjbencomo,
Thank you for your detailed report and for using our software.
This is not a bug but an inherent property of floating-point values. Unlike integers, floats are approximations of the real value, meaning that with every computational step, some form of rounding occurs. When you add parallel processing into the mix, this rounding happens asynchronously, which can also cause slight changes in the results.
Therefore, achieving exact matches between CPU and GPU computations with 32-bit floating-point (FP32) precision is generally not possible. In testing, we typically verify that values are roughly the same, usually within a tolerance of 1e-5.
If you require more precision, you might consider switching to 64-bit floats (FP64). However, be aware that this comes with a significant increase in computational cost and memory usage.
I hope this clears up your issue.
Best regards, Severin
Thanks for the explanation!
Describe the bug Hi - thanks for making this software! Very much needed, especially as single cell datasets get very large with spatial transcriptomics platforms. I've noticed some differences between
scanpy
andrapids_singlecell
that are significantly affecting my results so I went back and started to compare how output from the two packages differed.I've noticed that
normalize_total
seems to produce different results betweenrapids_singlecell
andscanpy
. I realize that not all functions are expected to produce the exact same results, but figured that normalization should be equivalent since it's such a deterministic and basic step. I've tried my best to create a good head to head comparison below where parameters are the same for both function calls.Thanks in advance for the help!
Steps/Code to reproduce bug I downloaded the example dataset used in the Demo Workflow and Decoupler notebook using this URL from the
data_downloader
notebook that accompanies the demo notebook.I then ran the following code:
Expected behavior I expect the expression matrices to be equivalent after normalization by the two libraries.
np.sum(cpudata.X != gpudata.X)
should produce a value of 0.Environment details (please complete the following information):
Additional context A similar problem happens with my own datasets