From f134a7f822dabbe6a524891df4a6fbf9c70c583b Mon Sep 17 00:00:00 2001 From: Intron7 Date: Tue, 1 Sep 2026 23:40:24 +0200 Subject: [PATCH] set the correct noise floor Signed-off-by: Intron7 --- tests/test_pca.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tests/test_pca.py b/tests/test_pca.py index 0ae0b9d98..91c9ef0de 100644 --- a/tests/test_pca.py +++ b/tests/test_pca.py @@ -923,10 +923,13 @@ def test_svd_sign_determinism(self, svd_func): U1, s1, Vt1 = svd_func(X_gpu, k=k, rng=0) U2, s2, Vt2 = svd_func(X_gpu, k=k, rng=0) - # Results should be identical (atol for GPU floating-point rounding variations) - np.testing.assert_allclose(U1.get(), U2.get(), rtol=1e-10, atol=1e-14) - np.testing.assert_allclose(s1.get(), s2.get(), rtol=1e-10, atol=1e-14) - np.testing.assert_allclose(Vt1.get(), Vt2.get(), rtol=1e-10, atol=1e-14) + # Results should be identical up to cuSPARSE noise: A.T @ u SpMV uses + # atomics with no bitwise-determinism guarantee, and Lanczos restarts + # amplify the ULP differences to ~1e-9 rel / ~5e-14 abs (measured on + # T4 and Blackwell), so tolerances sit 10-20x above that noise floor. + np.testing.assert_allclose(U1.get(), U2.get(), rtol=1e-8, atol=1e-12) + np.testing.assert_allclose(s1.get(), s2.get(), rtol=1e-8, atol=1e-12) + np.testing.assert_allclose(Vt1.get(), Vt2.get(), rtol=1e-8, atol=1e-12) def test_mean_centered_operator(self): """Test that the mean-centered operator works correctly."""