@@ -14,55 +14,86 @@ using .TestSuite
1414
1515is_buildkite = get (ENV , " BUILDKITE" , " false" ) == " true"
1616
17- for T in (BLASFloats... , GenericFloats... ), m in (0 , 54 ), n in (0 , 37 , m, 63 )
18- TestSuite. seed_rng! (123 )
19- if T ∈ BLASFloats
20- if CUDA. functional ()
21- TestSuite. test_svd (CuMatrix{T}, (m, n))
22- CUDA_SVD_ALGS = (
23- CUSOLVER_QRIteration (),
24- CUSOLVER_SVDPolar (),
25- CUSOLVER_Jacobi (),
26- )
27- TestSuite. test_svd_algs (CuMatrix{T}, (m, n), CUDA_SVD_ALGS)
28- k = 5
29- p = min (m, n) - k - 2
30- min (m, n) > k + 2 && TestSuite. test_randomized_svd (CuMatrix{T}, (m, n), (MatrixAlgebraKit. TruncatedAlgorithm (CUSOLVER_Randomized (; k, p, niters = 20 ), truncrank (k)),))
31- if n == m
32- TestSuite. test_svd (Diagonal{T, CuVector{T}}, m)
33- TestSuite. test_svd_algs (Diagonal{T, CuVector{T}}, m, (DiagonalAlgorithm (),))
34- end
35- end
36- if AMDGPU. functional ()
37- TestSuite. test_svd (ROCMatrix{T}, (m, n))
38- AMD_SVD_ALGS = (
39- ROCSOLVER_QRIteration (),
40- ROCSOLVER_Jacobi (),
41- )
42- TestSuite. test_svd_algs (ROCMatrix{T}, (m, n), AMD_SVD_ALGS)
43- if n == m
44- TestSuite. test_svd (Diagonal{T, ROCVector{T}}, m)
45- TestSuite. test_svd_algs (Diagonal{T, ROCVector{T}}, m, (DiagonalAlgorithm (),))
46- end
47- end
17+ # CPU tests
18+ # ---------
19+ if ! is_buildkite
20+ # LAPACK algorithms:
21+ for T in BLASFloats, m in (0 , 54 ), n in (0 , 37 , m, 63 )
22+ TestSuite. seed_rng! (123 )
23+ LAPACK_SVD_ALGS = (
24+ LAPACK_QRIteration (),
25+ LAPACK_DivideAndConquer (),
26+ LAPACK_SafeDivideAndConquer (; fixgauge = true ),
27+ )
28+ TestSuite. test_svd (T, (m, n))
29+ TestSuite. test_svd_algs (T, (m, n), LAPACK_SVD_ALGS)
4830 end
49- if ! is_buildkite
50- if T ∈ BLASFloats
51- LAPACK_SVD_ALGS = (
52- LAPACK_QRIteration (),
53- LAPACK_DivideAndConquer (),
54- LAPACK_SafeDivideAndConquer (; fixgauge = true ),
55- )
56- TestSuite. test_svd (T, (m, n))
57- TestSuite. test_svd_algs (T, (m, n), LAPACK_SVD_ALGS)
58- elseif T ∈ GenericFloats
59- TestSuite. test_svd (T, (m, n))
60- TestSuite. test_svd_algs (T, (m, n), (GLA_QRIteration (),))
61- end
62- if m == n
63- AT = Diagonal{T, Vector{T}}
64- TestSuite. test_svd (AT, m)
65- TestSuite. test_svd_algs (AT, m, (DiagonalAlgorithm (),))
66- end
31+
32+ # Generic floats:
33+ for T in GenericFloats, m in (0 , 54 ), n in (0 , 37 , m, 63 )
34+ TestSuite. seed_rng! (123 )
35+ TestSuite. test_svd (T, (m, n))
36+ TestSuite. test_svd_algs (T, (m, n), (GLA_QRIteration (),))
37+ end
38+
39+ # Diagonal:
40+ for T in (BLASFloats... , GenericFloats... ), m in (0 , 54 )
41+ TestSuite. seed_rng! (123 )
42+ AT = Diagonal{T, Vector{T}}
43+ TestSuite. test_svd (AT, m)
44+ TestSuite. test_svd_algs (AT, m, (DiagonalAlgorithm (),))
45+ end
46+ end
47+
48+ # CUDA tests
49+ # ------------
50+ if CUDA. functional ()
51+ # LAPACK algorithms:
52+ for T in BLASFloats, m in (0 , 23 ), n in (0 , 17 , m, 27 )
53+ TestSuite. seed_rng! (123 )
54+ TestSuite. test_svd (CuMatrix{T}, (m, n))
55+ CUDA_SVD_ALGS = (
56+ CUSOLVER_QRIteration (),
57+ CUSOLVER_SVDPolar (),
58+ CUSOLVER_Jacobi (),
59+ )
60+ TestSuite. test_svd_algs (CuMatrix{T}, (m, n), CUDA_SVD_ALGS)
61+ end
62+
63+ # Randomized SVD:
64+ for T in BLASFloats, m in (0 , 23 ), n in (0 , 17 , m, 27 )
65+ TestSuite. seed_rng! (123 )
66+ k = 5
67+ p = min (m, n) - k - 2
68+ p > 0 || continue
69+ TestSuite. test_randomized_svd (CuMatrix{T}, (m, n), (MatrixAlgebraKit. TruncatedAlgorithm (CUSOLVER_Randomized (; k, p, niters = 20 ), truncrank (k)),))
70+ end
71+
72+ # Diagonal:
73+ for T in BLASFloats, m in (0 , 23 )
74+ TestSuite. seed_rng! (123 )
75+ AT = Diagonal{T, CuVector{T}}
76+ TestSuite. test_svd (AT, m)
77+ TestSuite. test_svd_algs (AT, m, (DiagonalAlgorithm (),))
78+ end
79+ end
80+
81+ # AMDGPU tests
82+ # ------------
83+ if AMDGPU. functional ()
84+ # LAPACK algorithms:
85+ for T in BLASFloats, m in (0 , 23 ), n in (0 , 17 , m, 27 )
86+ TestSuite. seed_rng! (123 )
87+ TestSuite. test_svd (ROCMatrix{T}, (m, n))
88+ AMD_SVD_ALGS = (ROCSOLVER_QRIteration (), ROCSOLVER_Jacobi ())
89+ TestSuite. test_svd_algs (ROCMatrix{T}, (m, n), AMD_SVD_ALGS)
90+ end
91+
92+ # Diagonal:
93+ for T in BLASFloats, m in (0 , 23 )
94+ TestSuite. seed_rng! (123 )
95+ AT = Diagonal{T, ROCVector{T}}
96+ TestSuite. test_svd (AT, m)
97+ TestSuite. test_svd_algs (AT, m, (DiagonalAlgorithm (),))
6798 end
6899end
0 commit comments