LLNL / libROM

Model reduction library with an emphasis on large scale parallelism and linear subspace methods
https://www.librom.net
Other
201 stars 36 forks source link

`test_RandomizedSVD` failure #193

Closed dreamer2368 closed 1 year ago

dreamer2368 commented 1 year ago

The unit test test_RandomizedSVD fails. This is observed from both docker container librom_env and quartz.

This needs more investigations, but the issue seems to be a peculiar setup within the test. For debug/test cases, rand_mat in RandomizedSVD::computeSVD is a matrix of 1. As a result, the projected snapshot matrix rand_proj becomes 1-rank matrix. The resulting Q matrix from qr factorization can have arbitrary orthonormal column basis except one column. The result of SVD will depend on these arbitrary column basis of Q, although the answer is fixed to one case.

If this is the case, then the test rand_mat and the corresponding answer should be adjusted so that it may have some randomness (probably under the fixed random seed).

Following output is the result from test_RandomizedSVD:

[==========] Running 5 tests from 2 test suites.
[----------] Global test environment set-up.
[----------] 1 test from GoogleTestFramework
[ RUN      ] GoogleTestFramework.GoogleTestFrameworkFound
[       OK ] GoogleTestFramework.GoogleTestFrameworkFound (0 ms)
[----------] 1 test from GoogleTestFramework (0 ms total)

[----------] 4 tests from RandomizedSVDTest
[ RUN      ] RandomizedSVDTest.Test_RandomizedSVD
Distribution of sampler's A and U:
Local data: (  0.5377   -1.3077   -1.3499  
               1.8339   -0.4336    3.0349  
              -2.2588    0.3426    0.7254  
               0.8622    3.5784   -0.0631  
               0.3188    2.7694    0.7147  
             )
Process rank 0
=================
A->ctxt = 1
A->(m, n) = (5, 3)
A->(nprow, npcol) = (1, 1)
A->(pi, pj) = (0, 0)
A->(mb, nb) = (5, 5)
A->(mm, mn) = (5, 3)

Distribution of sampler's V:
Local data: ( -0.9093   -0.1798   -0.3752  
               0.4131   -0.2823   -0.8658  
              -0.0498    0.9423   -0.3310  
             )
Process rank 0
=================
A->ctxt = 2
A->(m, n) = (3, 3)
A->(nprow, npcol) = (1, 1)
A->(pi, pj) = (0, 0)
A->(mb, nb) = (5, 5)
A->(mm, mn) = (3, 3)

Computed singular values: 4.7698E+00  3.6011E+00  1.4576E+00  
/g/g92/chung28/libROM/unit_tests/test_RandomizedSVD.cpp:111: Failure
The difference between abs(d_basis_vals[i]) and abs(basis_true_ans[row_offset[d_rank] * 3 + i]) is 0.1654678695838297, which exceeds 1e-7, where
abs(d_basis_vals[i]) evaluates to 0.29609110552784845,
abs(basis_true_ans[row_offset[d_rank] * 3 + i]) evaluates to 0.46155897511167815, and
1e-7 evaluates to 9.9999999999999995e-08.
/g/g92/chung28/libROM/unit_tests/test_RandomizedSVD.cpp:111: Failure
The difference between abs(d_basis_vals[i]) and abs(basis_true_ans[row_offset[d_rank] * 3 + i]) is 0.30832233292278777, which exceeds 1e-7, where
abs(d_basis_vals[i]) evaluates to 0.12904302167895709,
abs(basis_true_ans[row_offset[d_rank] * 3 + i]) evaluates to 0.43736535460174486, and
1e-7 evaluates to 9.9999999999999995e-08.
/g/g92/chung28/libROM/unit_tests/test_RandomizedSVD.cpp:111: Failure
The difference between abs(d_basis_vals[i]) and abs(basis_true_ans[row_offset[d_rank] * 3 + i]) is 0.77882650318085811, which exceeds 1e-7, where
abs(d_basis_vals[i]) evaluates to 0.94545421529976204,
abs(basis_true_ans[row_offset[d_rank] * 3 + i]) evaluates to 0.16662771211890387, and
1e-7 evaluates to 9.9999999999999995e-08.
/g/g92/chung28/libROM/unit_tests/test_RandomizedSVD.cpp:111: Failure
The difference between abs(d_basis_vals[i]) and abs(basis_true_ans[row_offset[d_rank] * 3 + i]) is 0.13884202231635007, which exceeds 1e-7, where
abs(d_basis_vals[i]) evaluates to 0.18626762787368634,
abs(basis_true_ans[row_offset[d_rank] * 3 + i]) evaluates to 0.3251096501900364, and
1e-7 evaluates to 9.9999999999999995e-08.
/g/g92/chung28/libROM/unit_tests/test_RandomizedSVD.cpp:111: Failure
The difference between abs(d_basis_vals[i]) and abs(basis_true_ans[row_offset[d_rank] * 3 + i]) is 0.20455937598306617, which exceeds 1e-7, where
abs(d_basis_vals[i]) evaluates to 0.9622878546191842,
abs(basis_true_ans[row_offset[d_rank] * 3 + i]) evaluates to 0.75772847863611803, and
1e-7 evaluates to 9.9999999999999995e-08.
/g/g92/chung28/libROM/unit_tests/test_RandomizedSVD.cpp:111: Failure
The difference between abs(d_basis_vals[i]) and abs(basis_true_ans[row_offset[d_rank] * 3 + i]) is 0.26120084453304221, which exceeds 1e-7, where
abs(d_basis_vals[i]) evaluates to 0.19065741811692377,
abs(basis_true_ans[row_offset[d_rank] * 3 + i]) evaluates to 0.45185826264996598, and
1e-7 evaluates to 9.9999999999999995e-08.
/g/g92/chung28/libROM/unit_tests/test_RandomizedSVD.cpp:111: Failure
The difference between abs(d_basis_vals[i]) and abs(basis_true_ans[row_offset[d_rank] * 3 + i]) is 0.17518683713505692, which exceeds 1e-7, where
abs(d_basis_vals[i]) evaluates to 0.18257233495826697,
abs(basis_true_ans[row_offset[d_rank] * 3 + i]) evaluates to 0.0073854978232100466, and
1e-7 evaluates to 9.9999999999999995e-08.
/g/g92/chung28/libROM/unit_tests/test_RandomizedSVD.cpp:111: Failure
The difference between abs(d_basis_vals[i]) and abs(basis_true_ans[row_offset[d_rank] * 3 + i]) is 0.44415745273978052, which exceeds 1e-7, where
abs(d_basis_vals[i]) evaluates to 0.037611622210901322,
abs(basis_true_ans[row_offset[d_rank] * 3 + i]) evaluates to 0.48176907495068183, and
1e-7 evaluates to 9.9999999999999995e-08.
/g/g92/chung28/libROM/unit_tests/test_RandomizedSVD.cpp:111: Failure
The difference between abs(d_basis_vals[i]) and abs(basis_true_ans[row_offset[d_rank] * 3 + i]) is 0.78549822817264658, which exceeds 1e-7, where
abs(d_basis_vals[i]) evaluates to 0.085985452566386622,
abs(basis_true_ans[row_offset[d_rank] * 3 + i]) evaluates to 0.87148368073903315, and
1e-7 evaluates to 9.9999999999999995e-08.
/g/g92/chung28/libROM/unit_tests/test_RandomizedSVD.cpp:111: Failure
The difference between abs(d_basis_vals[i]) and abs(basis_true_ans[row_offset[d_rank] * 3 + i]) is 0.088751412265948515, which exceeds 1e-7, where
abs(d_basis_vals[i]) evaluates to 0.71182477196996774,
abs(basis_true_ans[row_offset[d_rank] * 3 + i]) evaluates to 0.62307335970401923, and
1e-7 evaluates to 9.9999999999999995e-08.
/g/g92/chung28/libROM/unit_tests/test_RandomizedSVD.cpp:111: Failure
The difference between abs(d_basis_vals[i]) and abs(basis_true_ans[row_offset[d_rank] * 3 + i]) is 0.17705237494593254, which exceeds 1e-7, where
abs(d_basis_vals[i]) evaluates to 0.21447709666524431,
abs(basis_true_ans[row_offset[d_rank] * 3 + i]) evaluates to 0.037424721719311764, and
1e-7 evaluates to 9.9999999999999995e-08.
/g/g92/chung28/libROM/unit_tests/test_RandomizedSVD.cpp:111: Failure
The difference between abs(d_basis_vals[i]) and abs(basis_true_ans[row_offset[d_rank] * 3 + i]) is 0.135703802018661, which exceeds 1e-7, where
abs(d_basis_vals[i]) evaluates to 0.20561196161382506,
abs(basis_true_ans[row_offset[d_rank] * 3 + i]) evaluates to 0.069908159595164068, and
1e-7 evaluates to 9.9999999999999995e-08.
/g/g92/chung28/libROM/unit_tests/test_RandomizedSVD.cpp:111: Failure
The difference between abs(d_basis_vals[i]) and abs(basis_true_ans[row_offset[d_rank] * 3 + i]) is 0.039752393551045428, which exceeds 1e-7, where
abs(d_basis_vals[i]) evaluates to 0.58103981322401277,
abs(basis_true_ans[row_offset[d_rank] * 3 + i]) evaluates to 0.54128741967296734, and
1e-7 evaluates to 9.9999999999999995e-08.
/g/g92/chung28/libROM/unit_tests/test_RandomizedSVD.cpp:111: Failure
The difference between abs(d_basis_vals[i]) and abs(basis_true_ans[row_offset[d_rank] * 3 + i]) is 0.067161817549816108, which exceeds 1e-7, where
abs(d_basis_vals[i]) evaluates to 0.0996740903599522,
abs(basis_true_ans[row_offset[d_rank] * 3 + i]) evaluates to 0.032512272810136092, and
1e-7 evaluates to 9.9999999999999995e-08.
/g/g92/chung28/libROM/unit_tests/test_RandomizedSVD.cpp:111: Failure
The difference between abs(d_basis_vals[i]) and abs(basis_true_ans[row_offset[d_rank] * 3 + i]) is 0.081029550084531832, which exceeds 1e-7, where
abs(d_basis_vals[i]) evaluates to 0.14176141533283554,
abs(basis_true_ans[row_offset[d_rank] * 3 + i]) evaluates to 0.0607318652483037, and
1e-7 evaluates to 9.9999999999999995e-08.
/g/g92/chung28/libROM/unit_tests/test_RandomizedSVD.cpp:116: Failure
The difference between abs(d_basis_right_vals[i]) and abs(basis_right_true_ans[i]) is 0.072827062654433949, which exceeds 1e-7, where
abs(d_basis_right_vals[i]) evaluates to 0.29220118965151742,
abs(basis_right_true_ans[i]) evaluates to 0.21937412699708347, and
1e-7 evaluates to 9.9999999999999995e-08.
/g/g92/chung28/libROM/unit_tests/test_RandomizedSVD.cpp:116: Failure
The difference between abs(d_basis_right_vals[i]) and abs(basis_right_true_ans[i]) is 0.4337083177025543, which exceeds 1e-7, where
abs(d_basis_right_vals[i]) evaluates to 0.38701827790664817,
abs(basis_right_true_ans[i]) evaluates to 0.82072659560920247, and
1e-7 evaluates to 9.9999999999999995e-08.
/g/g92/chung28/libROM/unit_tests/test_RandomizedSVD.cpp:116: Failure
The difference between abs(d_basis_right_vals[i]) and abs(basis_right_true_ans[i]) is 0.34702342589123303, which exceeds 1e-7, where
abs(d_basis_right_vals[i]) evaluates to 0.8745486363447208,
abs(basis_right_true_ans[i]) evaluates to 0.52752521045348777, and
1e-7 evaluates to 9.9999999999999995e-08.
/g/g92/chung28/libROM/unit_tests/test_RandomizedSVD.cpp:116: Failure
The difference between abs(d_basis_right_vals[i]) and abs(basis_right_true_ans[i]) is 0.038844274799944456, which exceeds 1e-7, where
abs(d_basis_right_vals[i]) evaluates to 0.92250639604755147,
abs(basis_right_true_ans[i]) evaluates to 0.88366212124760701, and
1e-7 evaluates to 9.9999999999999995e-08.
/g/g92/chung28/libROM/unit_tests/test_RandomizedSVD.cpp:116: Failure
The difference between abs(d_basis_right_vals[i]) and abs(basis_right_true_ans[i]) is 0.041121452159888772, which exceeds 1e-7, where
abs(d_basis_right_vals[i]) evaluates to 0.35520511662783122,
abs(basis_right_true_ans[i]) evaluates to 0.39632656878771999, and
1e-7 evaluates to 9.9999999999999995e-08.
/g/g92/chung28/libROM/unit_tests/test_RandomizedSVD.cpp:116: Failure
The difference between abs(d_basis_right_vals[i]) and abs(basis_right_true_ans[i]) is 0.098097486849904242, which exceeds 1e-7, where
abs(d_basis_right_vals[i]) evaluates to 0.15103401727017279,
abs(basis_right_true_ans[i]) evaluates to 0.24913150412007704, and
1e-7 evaluates to 9.9999999999999995e-08.
/g/g92/chung28/libROM/unit_tests/test_RandomizedSVD.cpp:116: Failure
The difference between abs(d_basis_right_vals[i]) and abs(basis_right_true_ans[i]) is 0.16134988274320927, which exceeds 1e-7, where
abs(d_basis_right_vals[i]) evaluates to 0.25219122510031233,
abs(basis_right_true_ans[i]) evaluates to 0.4135411078435216, and
1e-7 evaluates to 9.9999999999999995e-08.
/g/g92/chung28/libROM/unit_tests/test_RandomizedSVD.cpp:116: Failure
The difference between abs(d_basis_right_vals[i]) and abs(basis_right_true_ans[i]) is 0.43940798994975394, which exceeds 1e-7, where
abs(d_basis_right_vals[i]) evaluates to 0.85090903020686104,
abs(basis_right_true_ans[i]) evaluates to 0.4115010402571071, and
1e-7 evaluates to 9.9999999999999995e-08.
/g/g92/chung28/libROM/unit_tests/test_RandomizedSVD.cpp:116: Failure
The difference between abs(d_basis_right_vals[i]) and abs(basis_right_true_ans[i]) is 0.35137060506876022, which exceeds 1e-7, where
abs(d_basis_right_vals[i]) evaluates to 0.46081819440514998,
abs(basis_right_true_ans[i]) evaluates to 0.81218879947391021, and
1e-7 evaluates to 9.9999999999999995e-08.
/g/g92/chung28/libROM/unit_tests/test_RandomizedSVD.cpp:120: Failure
The difference between sv->item(i) and sv_true_ans[i] is 0.023920151572226267, which exceeds 1e-7, where
sv->item(i) evaluates to 4.7698410058819114,
sv_true_ans[i] evaluates to 4.7459208543096851, and
1e-7 evaluates to 9.9999999999999995e-08.
/g/g92/chung28/libROM/unit_tests/test_RandomizedSVD.cpp:120: Failure
The difference between sv->item(i) and sv_true_ans[i] is 0.34746642981073617, which exceeds 1e-7, where
sv->item(i) evaluates to 3.6011164288318369,
sv_true_ans[i] evaluates to 3.2536499990211007, and
1e-7 evaluates to 9.9999999999999995e-08.
/g/g92/chung28/libROM/unit_tests/test_RandomizedSVD.cpp:120: Failure
The difference between sv->item(i) and sv_true_ans[i] is 0.68429221224446657, which exceeds 1e-7, where
sv->item(i) evaluates to 1.4575672872210159,
sv_true_ans[i] evaluates to 2.1418594994654825, and
1e-7 evaluates to 9.9999999999999995e-08.
[  FAILED  ] RandomizedSVDTest.Test_RandomizedSVD (7 ms)
[ RUN      ] RandomizedSVDTest.Test_RandomizedSVDTransposed
Distribution of sampler's A and U:
Local data: (  0.5377    1.8339   -2.2588    0.8622    0.3188  
              -1.3077   -0.4336    0.3426    3.5784    2.7694  
              -1.3499    3.0349    0.7254   -0.0631    0.7147  
             )
Process rank 0
=================
A->ctxt = 1
A->(m, n) = (3, 5)
A->(nprow, npcol) = (1, 1)
A->(pi, pj) = (0, 0)
A->(mb, nb) = (3, 3)
A->(mm, mn) = (3, 5)

Distribution of sampler's V:
Local data: ( -0.9093   -0.1798   -0.3752  
               0.4131   -0.2823   -0.8658  
              -0.0498    0.9423   -0.3310  
             )
Process rank 0
=================
A->ctxt = 2
A->(m, n) = (3, 3)
A->(nprow, npcol) = (1, 1)
A->(pi, pj) = (0, 0)
A->(mb, nb) = (3, 3)
A->(mm, mn) = (3, 3)

Computed singular values: 4.7698E+00  3.6011E+00  1.4576E+00  
/g/g92/chung28/libROM/unit_tests/test_RandomizedSVD.cpp:228: Failure
The difference between abs(d_basis_right_vals[i]) and abs(basis_right_true_ans[row_offset[d_rank] * 3 + i]) is 0.1654678695838297, which exceeds 1e-7, where
abs(d_basis_right_vals[i]) evaluates to 0.29609110552784845,
abs(basis_right_true_ans[row_offset[d_rank] * 3 + i]) evaluates to 0.46155897511167815, and
1e-7 evaluates to 9.9999999999999995e-08.
/g/g92/chung28/libROM/unit_tests/test_RandomizedSVD.cpp:228: Failure
The difference between abs(d_basis_right_vals[i]) and abs(basis_right_true_ans[row_offset[d_rank] * 3 + i]) is 0.30832233292278777, which exceeds 1e-7, where
abs(d_basis_right_vals[i]) evaluates to 0.12904302167895709,
abs(basis_right_true_ans[row_offset[d_rank] * 3 + i]) evaluates to 0.43736535460174486, and
1e-7 evaluates to 9.9999999999999995e-08.
/g/g92/chung28/libROM/unit_tests/test_RandomizedSVD.cpp:228: Failure
The difference between abs(d_basis_right_vals[i]) and abs(basis_right_true_ans[row_offset[d_rank] * 3 + i]) is 0.77882650318085811, which exceeds 1e-7, where
abs(d_basis_right_vals[i]) evaluates to 0.94545421529976204,
abs(basis_right_true_ans[row_offset[d_rank] * 3 + i]) evaluates to 0.16662771211890387, and
1e-7 evaluates to 9.9999999999999995e-08.
/g/g92/chung28/libROM/unit_tests/test_RandomizedSVD.cpp:228: Failure
The difference between abs(d_basis_right_vals[i]) and abs(basis_right_true_ans[row_offset[d_rank] * 3 + i]) is 0.13884202231635007, which exceeds 1e-7, where
abs(d_basis_right_vals[i]) evaluates to 0.18626762787368634,
abs(basis_right_true_ans[row_offset[d_rank] * 3 + i]) evaluates to 0.3251096501900364, and
1e-7 evaluates to 9.9999999999999995e-08.
/g/g92/chung28/libROM/unit_tests/test_RandomizedSVD.cpp:228: Failure
The difference between abs(d_basis_right_vals[i]) and abs(basis_right_true_ans[row_offset[d_rank] * 3 + i]) is 0.20455937598306617, which exceeds 1e-7, where
abs(d_basis_right_vals[i]) evaluates to 0.9622878546191842,
abs(basis_right_true_ans[row_offset[d_rank] * 3 + i]) evaluates to 0.75772847863611803, and
1e-7 evaluates to 9.9999999999999995e-08.
/g/g92/chung28/libROM/unit_tests/test_RandomizedSVD.cpp:228: Failure
The difference between abs(d_basis_right_vals[i]) and abs(basis_right_true_ans[row_offset[d_rank] * 3 + i]) is 0.26120084453304221, which exceeds 1e-7, where
abs(d_basis_right_vals[i]) evaluates to 0.19065741811692377,
abs(basis_right_true_ans[row_offset[d_rank] * 3 + i]) evaluates to 0.45185826264996598, and
1e-7 evaluates to 9.9999999999999995e-08.
/g/g92/chung28/libROM/unit_tests/test_RandomizedSVD.cpp:228: Failure
The difference between abs(d_basis_right_vals[i]) and abs(basis_right_true_ans[row_offset[d_rank] * 3 + i]) is 0.17518683713505692, which exceeds 1e-7, where
abs(d_basis_right_vals[i]) evaluates to 0.18257233495826697,
abs(basis_right_true_ans[row_offset[d_rank] * 3 + i]) evaluates to 0.0073854978232100466, and
1e-7 evaluates to 9.9999999999999995e-08.
/g/g92/chung28/libROM/unit_tests/test_RandomizedSVD.cpp:228: Failure
The difference between abs(d_basis_right_vals[i]) and abs(basis_right_true_ans[row_offset[d_rank] * 3 + i]) is 0.44415745273978052, which exceeds 1e-7, where
abs(d_basis_right_vals[i]) evaluates to 0.037611622210901322,
abs(basis_right_true_ans[row_offset[d_rank] * 3 + i]) evaluates to 0.48176907495068183, and
1e-7 evaluates to 9.9999999999999995e-08.
/g/g92/chung28/libROM/unit_tests/test_RandomizedSVD.cpp:228: Failure
The difference between abs(d_basis_right_vals[i]) and abs(basis_right_true_ans[row_offset[d_rank] * 3 + i]) is 0.78549822817264658, which exceeds 1e-7, where
abs(d_basis_right_vals[i]) evaluates to 0.085985452566386622,
abs(basis_right_true_ans[row_offset[d_rank] * 3 + i]) evaluates to 0.87148368073903315, and
1e-7 evaluates to 9.9999999999999995e-08.
/g/g92/chung28/libROM/unit_tests/test_RandomizedSVD.cpp:228: Failure
The difference between abs(d_basis_right_vals[i]) and abs(basis_right_true_ans[row_offset[d_rank] * 3 + i]) is 0.088751412265948515, which exceeds 1e-7, where
abs(d_basis_right_vals[i]) evaluates to 0.71182477196996774,
abs(basis_right_true_ans[row_offset[d_rank] * 3 + i]) evaluates to 0.62307335970401923, and
1e-7 evaluates to 9.9999999999999995e-08.
/g/g92/chung28/libROM/unit_tests/test_RandomizedSVD.cpp:228: Failure
The difference between abs(d_basis_right_vals[i]) and abs(basis_right_true_ans[row_offset[d_rank] * 3 + i]) is 0.17705237494593254, which exceeds 1e-7, where
abs(d_basis_right_vals[i]) evaluates to 0.21447709666524431,
abs(basis_right_true_ans[row_offset[d_rank] * 3 + i]) evaluates to 0.037424721719311764, and
1e-7 evaluates to 9.9999999999999995e-08.
/g/g92/chung28/libROM/unit_tests/test_RandomizedSVD.cpp:228: Failure
The difference between abs(d_basis_right_vals[i]) and abs(basis_right_true_ans[row_offset[d_rank] * 3 + i]) is 0.135703802018661, which exceeds 1e-7, where
abs(d_basis_right_vals[i]) evaluates to 0.20561196161382506,
abs(basis_right_true_ans[row_offset[d_rank] * 3 + i]) evaluates to 0.069908159595164068, and
1e-7 evaluates to 9.9999999999999995e-08.
/g/g92/chung28/libROM/unit_tests/test_RandomizedSVD.cpp:228: Failure
The difference between abs(d_basis_right_vals[i]) and abs(basis_right_true_ans[row_offset[d_rank] * 3 + i]) is 0.039752393551045428, which exceeds 1e-7, where
abs(d_basis_right_vals[i]) evaluates to 0.58103981322401277,
abs(basis_right_true_ans[row_offset[d_rank] * 3 + i]) evaluates to 0.54128741967296734, and
1e-7 evaluates to 9.9999999999999995e-08.
/g/g92/chung28/libROM/unit_tests/test_RandomizedSVD.cpp:228: Failure
The difference between abs(d_basis_right_vals[i]) and abs(basis_right_true_ans[row_offset[d_rank] * 3 + i]) is 0.067161817549816108, which exceeds 1e-7, where
abs(d_basis_right_vals[i]) evaluates to 0.0996740903599522,
abs(basis_right_true_ans[row_offset[d_rank] * 3 + i]) evaluates to 0.032512272810136092, and
1e-7 evaluates to 9.9999999999999995e-08.
/g/g92/chung28/libROM/unit_tests/test_RandomizedSVD.cpp:228: Failure
The difference between abs(d_basis_right_vals[i]) and abs(basis_right_true_ans[row_offset[d_rank] * 3 + i]) is 0.081029550084531832, which exceeds 1e-7, where
abs(d_basis_right_vals[i]) evaluates to 0.14176141533283554,
abs(basis_right_true_ans[row_offset[d_rank] * 3 + i]) evaluates to 0.0607318652483037, and
1e-7 evaluates to 9.9999999999999995e-08.
/g/g92/chung28/libROM/unit_tests/test_RandomizedSVD.cpp:233: Failure
The difference between abs(d_basis_vals[i]) and abs(basis_true_ans[i]) is 0.072827062654433949, which exceeds 1e-7, where
abs(d_basis_vals[i]) evaluates to 0.29220118965151742,
abs(basis_true_ans[i]) evaluates to 0.21937412699708347, and
1e-7 evaluates to 9.9999999999999995e-08.
/g/g92/chung28/libROM/unit_tests/test_RandomizedSVD.cpp:233: Failure
The difference between abs(d_basis_vals[i]) and abs(basis_true_ans[i]) is 0.4337083177025543, which exceeds 1e-7, where
abs(d_basis_vals[i]) evaluates to 0.38701827790664817,
abs(basis_true_ans[i]) evaluates to 0.82072659560920247, and
1e-7 evaluates to 9.9999999999999995e-08.
/g/g92/chung28/libROM/unit_tests/test_RandomizedSVD.cpp:233: Failure
The difference between abs(d_basis_vals[i]) and abs(basis_true_ans[i]) is 0.34702342589123303, which exceeds 1e-7, where
abs(d_basis_vals[i]) evaluates to 0.8745486363447208,
abs(basis_true_ans[i]) evaluates to 0.52752521045348777, and
1e-7 evaluates to 9.9999999999999995e-08.
/g/g92/chung28/libROM/unit_tests/test_RandomizedSVD.cpp:233: Failure
The difference between abs(d_basis_vals[i]) and abs(basis_true_ans[i]) is 0.038844274799944456, which exceeds 1e-7, where
abs(d_basis_vals[i]) evaluates to 0.92250639604755147,
abs(basis_true_ans[i]) evaluates to 0.88366212124760701, and
1e-7 evaluates to 9.9999999999999995e-08.
/g/g92/chung28/libROM/unit_tests/test_RandomizedSVD.cpp:233: Failure
The difference between abs(d_basis_vals[i]) and abs(basis_true_ans[i]) is 0.041121452159888772, which exceeds 1e-7, where
abs(d_basis_vals[i]) evaluates to 0.35520511662783122,
abs(basis_true_ans[i]) evaluates to 0.39632656878771999, and
1e-7 evaluates to 9.9999999999999995e-08.
/g/g92/chung28/libROM/unit_tests/test_RandomizedSVD.cpp:233: Failure
The difference between abs(d_basis_vals[i]) and abs(basis_true_ans[i]) is 0.098097486849904242, which exceeds 1e-7, where
abs(d_basis_vals[i]) evaluates to 0.15103401727017279,
abs(basis_true_ans[i]) evaluates to 0.24913150412007704, and
1e-7 evaluates to 9.9999999999999995e-08.
/g/g92/chung28/libROM/unit_tests/test_RandomizedSVD.cpp:233: Failure
The difference between abs(d_basis_vals[i]) and abs(basis_true_ans[i]) is 0.16134988274320927, which exceeds 1e-7, where
abs(d_basis_vals[i]) evaluates to 0.25219122510031233,
abs(basis_true_ans[i]) evaluates to 0.4135411078435216, and
1e-7 evaluates to 9.9999999999999995e-08.
/g/g92/chung28/libROM/unit_tests/test_RandomizedSVD.cpp:233: Failure
The difference between abs(d_basis_vals[i]) and abs(basis_true_ans[i]) is 0.43940798994975394, which exceeds 1e-7, where
abs(d_basis_vals[i]) evaluates to 0.85090903020686104,
abs(basis_true_ans[i]) evaluates to 0.4115010402571071, and
1e-7 evaluates to 9.9999999999999995e-08.
/g/g92/chung28/libROM/unit_tests/test_RandomizedSVD.cpp:233: Failure
The difference between abs(d_basis_vals[i]) and abs(basis_true_ans[i]) is 0.35137060506876022, which exceeds 1e-7, where
abs(d_basis_vals[i]) evaluates to 0.46081819440514998,
abs(basis_true_ans[i]) evaluates to 0.81218879947391021, and
1e-7 evaluates to 9.9999999999999995e-08.
/g/g92/chung28/libROM/unit_tests/test_RandomizedSVD.cpp:237: Failure
The difference between sv->item(i) and sv_true_ans[i] is 0.023920151572226267, which exceeds 1e-7, where
sv->item(i) evaluates to 4.7698410058819114,
sv_true_ans[i] evaluates to 4.7459208543096851, and
1e-7 evaluates to 9.9999999999999995e-08.
/g/g92/chung28/libROM/unit_tests/test_RandomizedSVD.cpp:237: Failure
The difference between sv->item(i) and sv_true_ans[i] is 0.34746642981073617, which exceeds 1e-7, where
sv->item(i) evaluates to 3.6011164288318369,
sv_true_ans[i] evaluates to 3.2536499990211007, and
1e-7 evaluates to 9.9999999999999995e-08.
/g/g92/chung28/libROM/unit_tests/test_RandomizedSVD.cpp:237: Failure
The difference between sv->item(i) and sv_true_ans[i] is 0.68429221224446657, which exceeds 1e-7, where
sv->item(i) evaluates to 1.4575672872210159,
sv_true_ans[i] evaluates to 2.1418594994654825, and
1e-7 evaluates to 9.9999999999999995e-08.
[  FAILED  ] RandomizedSVDTest.Test_RandomizedSVDTransposed (1 ms)
[ RUN      ] RandomizedSVDTest.Test_RandomizedSVDSmallerSubspace
Distribution of sampler's A and U:
Local data: (  0.5377   -1.3077   -1.3499  
               1.8339   -0.4336    3.0349  
              -2.2588    0.3426    0.7254  
               0.8622    3.5784   -0.0631  
               0.3188    2.7694    0.7147  
             )
Process rank 0
=================
A->ctxt = 1
A->(m, n) = (5, 3)
A->(nprow, npcol) = (1, 1)
A->(pi, pj) = (0, 0)
A->(mb, nb) = (5, 5)
A->(mm, mn) = (5, 3)

Distribution of sampler's V:
Local data: ( -0.9929   -0.1187  
               0.1187   -0.9929  
             )
Process rank 0
=================
A->ctxt = 2
A->(m, n) = (2, 2)
A->(nprow, npcol) = (1, 1)
A->(pi, pj) = (0, 0)
A->(mb, nb) = (5, 5)
A->(mm, mn) = (2, 2)

Computed singular values: 4.6133E+00  1.8448E+00  
/g/g92/chung28/libROM/unit_tests/test_RandomizedSVD.cpp:319: Failure
The difference between abs(d_basis_vals[i]) and abs(basis_true_ans[row_offset[d_rank] * 2 + i]) is 0.043123229337106217, which exceeds 1e-7, where
abs(d_basis_vals[i]) evaluates to 0.38134513245650903,
abs(basis_true_ans[row_offset[d_rank] * 2 + i]) evaluates to 0.42446836179361525, and
1e-7 evaluates to 9.9999999999999995e-08.
/g/g92/chung28/libROM/unit_tests/test_RandomizedSVD.cpp:319: Failure
The difference between abs(d_basis_vals[i]) and abs(basis_true_ans[row_offset[d_rank] * 2 + i]) is 0.39115063109136156, which exceeds 1e-7, where
abs(d_basis_vals[i]) evaluates to 0.86860933316093525,
abs(basis_true_ans[row_offset[d_rank] * 2 + i]) evaluates to 0.47745870206957369, and
1e-7 evaluates to 9.9999999999999995e-08.
/g/g92/chung28/libROM/unit_tests/test_RandomizedSVD.cpp:319: Failure
The difference between abs(d_basis_vals[i]) and abs(basis_true_ans[row_offset[d_rank] * 2 + i]) is 0.1738629884761187, which exceeds 1e-7, where
abs(d_basis_vals[i]) evaluates to 0.52271104896021103,
abs(basis_true_ans[row_offset[d_rank] * 2 + i]) evaluates to 0.34884806048409234, and
1e-7 evaluates to 9.9999999999999995e-08.
/g/g92/chung28/libROM/unit_tests/test_RandomizedSVD.cpp:319: Failure
The difference between abs(d_basis_vals[i]) and abs(basis_true_ans[row_offset[d_rank] * 2 + i]) is 0.38702243794322316, which exceeds 1e-7, where
abs(d_basis_vals[i]) evaluates to 0.48328714680626988,
abs(basis_true_ans[row_offset[d_rank] * 2 + i]) evaluates to 0.87030958474949305, and
1e-7 evaluates to 9.9999999999999995e-08.
/g/g92/chung28/libROM/unit_tests/test_RandomizedSVD.cpp:319: Failure
The difference between abs(d_basis_vals[i]) and abs(basis_true_ans[row_offset[d_rank] * 2 + i]) is 0.018878134545858322, which exceeds 1e-7, where
abs(d_basis_vals[i]) evaluates to 0.14919936487725943,
abs(basis_true_ans[row_offset[d_rank] * 2 + i]) evaluates to 0.16807749942311775, and
1e-7 evaluates to 9.9999999999999995e-08.
/g/g92/chung28/libROM/unit_tests/test_RandomizedSVD.cpp:319: Failure
The difference between abs(d_basis_vals[i]) and abs(basis_true_ans[row_offset[d_rank] * 2 + i]) is 0.031391206376244291, which exceeds 1e-7, where
abs(d_basis_vals[i]) evaluates to 0.055692772119600151,
abs(basis_true_ans[row_offset[d_rank] * 2 + i]) evaluates to 0.02430156574335586, and
1e-7 evaluates to 9.9999999999999995e-08.
/g/g92/chung28/libROM/unit_tests/test_RandomizedSVD.cpp:319: Failure
The difference between abs(d_basis_vals[i]) and abs(basis_true_ans[row_offset[d_rank] * 2 + i]) is 0.053612574412784442, which exceeds 1e-7, where
abs(d_basis_vals[i]) evaluates to 0.56425713815414369,
abs(basis_true_ans[row_offset[d_rank] * 2 + i]) evaluates to 0.61786971256692813, and
1e-7 evaluates to 9.9999999999999995e-08.
/g/g92/chung28/libROM/unit_tests/test_RandomizedSVD.cpp:319: Failure
The difference between abs(d_basis_vals[i]) and abs(basis_true_ans[row_offset[d_rank] * 2 + i]) is 0.016596178215956006, which exceeds 1e-7, where
abs(d_basis_vals[i]) evaluates to 0.072738810062126166,
abs(basis_true_ans[row_offset[d_rank] * 2 + i]) evaluates to 0.089334988278082172, and
1e-7 evaluates to 9.9999999999999995e-08.
/g/g92/chung28/libROM/unit_tests/test_RandomizedSVD.cpp:319: Failure
The difference between abs(d_basis_vals[i]) and abs(basis_true_ans[row_offset[d_rank] * 2 + i]) is 0.04615242321809554, which exceeds 1e-7, where
abs(d_basis_vals[i]) evaluates to 0.49061439115558148,
abs(basis_true_ans[row_offset[d_rank] * 2 + i]) evaluates to 0.53676681437367701, and
1e-7 evaluates to 9.9999999999999995e-08.
/g/g92/chung28/libROM/unit_tests/test_RandomizedSVD.cpp:319: Failure
The difference between abs(d_basis_vals[i]) and abs(basis_true_ans[row_offset[d_rank] * 2 + i]) is 0.017953505050804619, which exceeds 1e-7, where
abs(d_basis_vals[i]) evaluates to 0.059655181853300182,
abs(basis_true_ans[row_offset[d_rank] * 2 + i]) evaluates to 0.077608686904104801, and
1e-7 evaluates to 9.9999999999999995e-08.
/g/g92/chung28/libROM/unit_tests/test_RandomizedSVD.cpp:324: Failure
The difference between abs(d_basis_right_vals[i]) and abs(basis_right_true_ans[i]) is 0.057201541154882296, which exceeds 1e-7, where
abs(d_basis_right_vals[i]) evaluates to 0.37575362437256643,
abs(basis_right_true_ans[i]) evaluates to 0.31855208321768413, and
1e-7 evaluates to 9.9999999999999995e-08.
/g/g92/chung28/libROM/unit_tests/test_RandomizedSVD.cpp:324: Failure
The difference between abs(d_basis_right_vals[i]) and abs(basis_right_true_ans[i]) is 0.28294848190315069, which exceeds 1e-7, where
abs(d_basis_right_vals[i]) evaluates to 0.84610008880356791,
abs(basis_right_true_ans[i]) evaluates to 0.56315160690041721, and
1e-7 evaluates to 9.9999999999999995e-08.
/g/g92/chung28/libROM/unit_tests/test_RandomizedSVD.cpp:324: Failure
The difference between abs(d_basis_right_vals[i]) and abs(basis_right_true_ans[i]) is 0.081541634825927578, which exceeds 1e-7, where
abs(d_basis_right_vals[i]) evaluates to 0.78008150233388607,
abs(basis_right_true_ans[i]) evaluates to 0.86162313715981365, and
1e-7 evaluates to 9.9999999999999995e-08.
/g/g92/chung28/libROM/unit_tests/test_RandomizedSVD.cpp:324: Failure
The difference between abs(d_basis_right_vals[i]) and abs(basis_right_true_ans[i]) is 0.0016730274655981647, which exceeds 1e-7, where
abs(d_basis_right_vals[i]) evaluates to 0.50900770764497449,
abs(basis_right_true_ans[i]) evaluates to 0.50733468017937633, and
1e-7 evaluates to 9.9999999999999995e-08.
/g/g92/chung28/libROM/unit_tests/test_RandomizedSVD.cpp:328: Failure
The difference between sv->item(i) and sv_true_ans[i] is 0.079844118486406934, which exceeds 1e-7, where
sv->item(i) evaluates to 4.6133218692500302,
sv_true_ans[i] evaluates to 4.6931659877364371, and
1e-7 evaluates to 9.9999999999999995e-08.
/g/g92/chung28/libROM/unit_tests/test_RandomizedSVD.cpp:328: Failure
The difference between sv->item(i) and sv_true_ans[i] is 1.1670580542149882, which exceeds 1e-7, where
sv->item(i) evaluates to 1.8447981099375361,
sv_true_ans[i] evaluates to 3.0118561641525243, and
1e-7 evaluates to 9.9999999999999995e-08.
[  FAILED  ] RandomizedSVDTest.Test_RandomizedSVDSmallerSubspace (1 ms)
[ RUN      ] RandomizedSVDTest.Test_RandomizedSVDTransposedSmallerSubspace
Distribution of sampler's A and U:
Local data: (  0.5377    1.8339   -2.2588    0.8622    0.3188  
              -1.3077   -0.4336    0.3426    3.5784    2.7694  
              -1.3499    3.0349    0.7254   -0.0631    0.7147  
             )
Process rank 0
=================
A->ctxt = 1
A->(m, n) = (3, 5)
A->(nprow, npcol) = (1, 1)
A->(pi, pj) = (0, 0)
A->(mb, nb) = (3, 3)
A->(mm, mn) = (3, 5)

Distribution of sampler's V:
Local data: ( -0.9929   -0.1187  
               0.1187   -0.9929  
             )
Process rank 0
=================
A->ctxt = 2
A->(m, n) = (2, 2)
A->(nprow, npcol) = (1, 1)
A->(pi, pj) = (0, 0)
A->(mb, nb) = (3, 3)
A->(mm, mn) = (2, 2)

Computed singular values: 4.6133E+00  1.8448E+00  
/g/g92/chung28/libROM/unit_tests/test_RandomizedSVD.cpp:435: Failure
The difference between abs(d_basis_right_vals[i]) and abs(basis_right_true_ans[row_offset[d_rank] * 2 + i]) is 0.043123229337106217, which exceeds 1e-7, where
abs(d_basis_right_vals[i]) evaluates to 0.38134513245650903,
abs(basis_right_true_ans[row_offset[d_rank] * 2 + i]) evaluates to 0.42446836179361525, and
1e-7 evaluates to 9.9999999999999995e-08.
/g/g92/chung28/libROM/unit_tests/test_RandomizedSVD.cpp:435: Failure
The difference between abs(d_basis_right_vals[i]) and abs(basis_right_true_ans[row_offset[d_rank] * 2 + i]) is 0.39115063109136156, which exceeds 1e-7, where
abs(d_basis_right_vals[i]) evaluates to 0.86860933316093525,
abs(basis_right_true_ans[row_offset[d_rank] * 2 + i]) evaluates to 0.47745870206957369, and
1e-7 evaluates to 9.9999999999999995e-08.
/g/g92/chung28/libROM/unit_tests/test_RandomizedSVD.cpp:435: Failure
The difference between abs(d_basis_right_vals[i]) and abs(basis_right_true_ans[row_offset[d_rank] * 2 + i]) is 0.1738629884761187, which exceeds 1e-7, where
abs(d_basis_right_vals[i]) evaluates to 0.52271104896021103,
abs(basis_right_true_ans[row_offset[d_rank] * 2 + i]) evaluates to 0.34884806048409234, and
1e-7 evaluates to 9.9999999999999995e-08.
/g/g92/chung28/libROM/unit_tests/test_RandomizedSVD.cpp:435: Failure
The difference between abs(d_basis_right_vals[i]) and abs(basis_right_true_ans[row_offset[d_rank] * 2 + i]) is 0.38702243794322316, which exceeds 1e-7, where
abs(d_basis_right_vals[i]) evaluates to 0.48328714680626988,
abs(basis_right_true_ans[row_offset[d_rank] * 2 + i]) evaluates to 0.87030958474949305, and
1e-7 evaluates to 9.9999999999999995e-08.
/g/g92/chung28/libROM/unit_tests/test_RandomizedSVD.cpp:435: Failure
The difference between abs(d_basis_right_vals[i]) and abs(basis_right_true_ans[row_offset[d_rank] * 2 + i]) is 0.018878134545858322, which exceeds 1e-7, where
abs(d_basis_right_vals[i]) evaluates to 0.14919936487725943,
abs(basis_right_true_ans[row_offset[d_rank] * 2 + i]) evaluates to 0.16807749942311775, and
1e-7 evaluates to 9.9999999999999995e-08.
/g/g92/chung28/libROM/unit_tests/test_RandomizedSVD.cpp:435: Failure
The difference between abs(d_basis_right_vals[i]) and abs(basis_right_true_ans[row_offset[d_rank] * 2 + i]) is 0.031391206376244291, which exceeds 1e-7, where
abs(d_basis_right_vals[i]) evaluates to 0.055692772119600151,
abs(basis_right_true_ans[row_offset[d_rank] * 2 + i]) evaluates to 0.02430156574335586, and
1e-7 evaluates to 9.9999999999999995e-08.
/g/g92/chung28/libROM/unit_tests/test_RandomizedSVD.cpp:435: Failure
The difference between abs(d_basis_right_vals[i]) and abs(basis_right_true_ans[row_offset[d_rank] * 2 + i]) is 0.053612574412784442, which exceeds 1e-7, where
abs(d_basis_right_vals[i]) evaluates to 0.56425713815414369,
abs(basis_right_true_ans[row_offset[d_rank] * 2 + i]) evaluates to 0.61786971256692813, and
1e-7 evaluates to 9.9999999999999995e-08.
/g/g92/chung28/libROM/unit_tests/test_RandomizedSVD.cpp:435: Failure
The difference between abs(d_basis_right_vals[i]) and abs(basis_right_true_ans[row_offset[d_rank] * 2 + i]) is 0.016596178215956006, which exceeds 1e-7, where
abs(d_basis_right_vals[i]) evaluates to 0.072738810062126166,
abs(basis_right_true_ans[row_offset[d_rank] * 2 + i]) evaluates to 0.089334988278082172, and
1e-7 evaluates to 9.9999999999999995e-08.
/g/g92/chung28/libROM/unit_tests/test_RandomizedSVD.cpp:435: Failure
The difference between abs(d_basis_right_vals[i]) and abs(basis_right_true_ans[row_offset[d_rank] * 2 + i]) is 0.04615242321809554, which exceeds 1e-7, where
abs(d_basis_right_vals[i]) evaluates to 0.49061439115558148,
abs(basis_right_true_ans[row_offset[d_rank] * 2 + i]) evaluates to 0.53676681437367701, and
1e-7 evaluates to 9.9999999999999995e-08.
/g/g92/chung28/libROM/unit_tests/test_RandomizedSVD.cpp:435: Failure
The difference between abs(d_basis_right_vals[i]) and abs(basis_right_true_ans[row_offset[d_rank] * 2 + i]) is 0.017953505050804619, which exceeds 1e-7, where
abs(d_basis_right_vals[i]) evaluates to 0.059655181853300182,
abs(basis_right_true_ans[row_offset[d_rank] * 2 + i]) evaluates to 0.077608686904104801, and
1e-7 evaluates to 9.9999999999999995e-08.
/g/g92/chung28/libROM/unit_tests/test_RandomizedSVD.cpp:440: Failure
The difference between abs(d_basis_vals[i]) and abs(basis_true_ans[i]) is 0.057201541154882296, which exceeds 1e-7, where
abs(d_basis_vals[i]) evaluates to 0.37575362437256643,
abs(basis_true_ans[i]) evaluates to 0.31855208321768413, and
1e-7 evaluates to 9.9999999999999995e-08.
/g/g92/chung28/libROM/unit_tests/test_RandomizedSVD.cpp:440: Failure
The difference between abs(d_basis_vals[i]) and abs(basis_true_ans[i]) is 0.28294848190315069, which exceeds 1e-7, where
abs(d_basis_vals[i]) evaluates to 0.84610008880356791,
abs(basis_true_ans[i]) evaluates to 0.56315160690041721, and
1e-7 evaluates to 9.9999999999999995e-08.
/g/g92/chung28/libROM/unit_tests/test_RandomizedSVD.cpp:440: Failure
The difference between abs(d_basis_vals[i]) and abs(basis_true_ans[i]) is 0.081541634825927578, which exceeds 1e-7, where
abs(d_basis_vals[i]) evaluates to 0.78008150233388607,
abs(basis_true_ans[i]) evaluates to 0.86162313715981365, and
1e-7 evaluates to 9.9999999999999995e-08.
/g/g92/chung28/libROM/unit_tests/test_RandomizedSVD.cpp:440: Failure
The difference between abs(d_basis_vals[i]) and abs(basis_true_ans[i]) is 0.0016730274655981647, which exceeds 1e-7, where
abs(d_basis_vals[i]) evaluates to 0.50900770764497449,
abs(basis_true_ans[i]) evaluates to 0.50733468017937633, and
1e-7 evaluates to 9.9999999999999995e-08.
/g/g92/chung28/libROM/unit_tests/test_RandomizedSVD.cpp:444: Failure
The difference between sv->item(i) and sv_true_ans[i] is 0.079844118486406934, which exceeds 1e-7, where
sv->item(i) evaluates to 4.6133218692500302,
sv_true_ans[i] evaluates to 4.6931659877364371, and
1e-7 evaluates to 9.9999999999999995e-08.
/g/g92/chung28/libROM/unit_tests/test_RandomizedSVD.cpp:444: Failure
The difference between sv->item(i) and sv_true_ans[i] is 1.1670580542149882, which exceeds 1e-7, where
sv->item(i) evaluates to 1.8447981099375361,
sv_true_ans[i] evaluates to 3.0118561641525243, and
1e-7 evaluates to 9.9999999999999995e-08.
[  FAILED  ] RandomizedSVDTest.Test_RandomizedSVDTransposedSmallerSubspace (1 ms)
[----------] 4 tests from RandomizedSVDTest (11 ms total)

[----------] Global test environment tear-down
[==========] 5 tests from 2 test suites ran. (11 ms total)
[  PASSED  ] 1 test.
[  FAILED  ] 4 tests, listed below:
[  FAILED  ] RandomizedSVDTest.Test_RandomizedSVD
[  FAILED  ] RandomizedSVDTest.Test_RandomizedSVDTransposed
[  FAILED  ] RandomizedSVDTest.Test_RandomizedSVDSmallerSubspace
[  FAILED  ] RandomizedSVDTest.Test_RandomizedSVDTransposedSmallerSubspace

 4 FAILED TESTS
chldkdtn commented 1 year ago

Thank you @dreamer2368 for identifying this failing case. @siuwuncheung can you verify if this is the reason that the tests for your PR fail as well?

siuwuncheung commented 1 year ago

Thank you @dreamer2368 for identifying this failing case. @siuwuncheung can you verify if this is the reason that the tests for your PR fail as well?

The failed test in my PR is a unit test with DMD, so it should be two different issues. I will fix the one in mine today.

[ FAILED ] DMDTest.Test_DMD (43 ms) [----------] 1 test from DMDTest (43 ms total)

[----------] Global test environment tear-down [==========] 2 tests from 2 test suites ran. (43 ms total) [ PASSED ] 1 test. [ FAILED ] 1 test, listed below: [ FAILED ] DMDTest.Test_DMD

siuwuncheung commented 1 year ago

@dreamer2368 I think this does not happen in the CI workflow in GH PRs. Can you please verify?

dreamer2368 commented 1 year ago

No it does not happen in the CI workflow. But it can (and does) happen in other machines. That is the main issue, since the test result is susceptible to round-off errors, causing false-negative.

I actually checked that qr decomposition in RandomizedSVD::computeSVD is indeed susceptible to round-off errors. (this only happens with d_debug_algorithm, so only for test.)

Following minimal example is taken from the first test of Test_RandomizedSVD. We see that O(1e-15) perturbation can completely change 2nd/3rd column of Q, due to the rank deficiency caused by rand_mat. To fix this issue, I suggest to change the 'testing' rand_mat and update the answer accordingly.

#include <fstream>
#include <iostream>
#include "librom.h"

// uniform random number in [0., 1.]
double UniformRandom();

int main(int argc, char *argv[])
{
   MPI_Init(&argc, &argv);

   printf("Example from RandomizedSVDTest, Test_RandomizedSVD.\n\n");

   double* sample1 = new double[5] {0.5377, 1.8339, -2.2588, 0.8622, 0.3188};
   double* sample2 = new double[5] {-1.3077, -0.4336, 0.3426, 3.5784, 2.7694};
   double* sample3 = new double[5] {-1.3499, 3.0349, 0.7254, -0.0631, 0.7147};

   CAROM::Matrix *snapshot_matrix = new CAROM::Matrix(5, 3, true);
   for (int i = 0; i < snapshot_matrix->numRows(); i++) {
      snapshot_matrix->item(i, 0) = sample1[i];
      snapshot_matrix->item(i, 1) = sample2[i];
      snapshot_matrix->item(i, 2) = sample3[i];
   }

   printf("Snapshot matrix from example.\n");
   for (int i = 0; i < snapshot_matrix->numRows(); i++) {
      for (int j = 0; j < snapshot_matrix->numColumns(); j++) {
         printf("%.15E\t", snapshot_matrix->item(i, j));
      }
      printf("\n");
   }
   printf("\n");

   CAROM::Matrix *rand_mat = new CAROM::Matrix(3, 3, false);
   for (int i = 0; i < snapshot_matrix->numColumns(); i++) {
      for (int j = 0; j < 3; j++) {
         rand_mat->item(i, j) = 1;
      }
   }

   printf("rand_mat (%d x %d) in RandomizedSVD::computeSVD (d_debug_algorithm).\n", rand_mat->numRows(), rand_mat->numColumns());
   for (int i = 0; i < rand_mat->numRows(); i++) {
      for (int j = 0; j < rand_mat->numColumns(); j++) {
         printf("%.15E\t", rand_mat->item(i, j));
      }
      printf("\n");
   }
   printf("\n");

   CAROM::Matrix* rand_proj = snapshot_matrix->mult(rand_mat);
   printf("rand_proj (%d x %d) in RandomizedSVD::computeSVD.\n", rand_proj->numRows(), rand_proj->numColumns());
   for (int i = 0; i < rand_proj->numRows(); i++) {
      for (int j = 0; j < rand_proj->numColumns(); j++) {
         printf("%.15E\t", rand_proj->item(i, j));
      }
      printf("\n");
   }
   printf("\n");

   CAROM::Matrix* Q = rand_proj->qr_factorize();
   printf("Q (%d x %d) in RandomizedSVD::computeSVD.\n", Q->numRows(), Q->numColumns());
   for (int i = 0; i < Q->numRows(); i++) {
      for (int j = 0; j < Q->numColumns(); j++) {
         printf("%.15E\t", Q->item(i, j));
      }
      printf("\n");
   }
   printf("\n");

   // Now perturb the snapshot matrix within machine precision.
   for (int i = 0; i < snapshot_matrix->numRows(); i++) {
      for (int j = 0; j < snapshot_matrix->numColumns(); j++) {
         snapshot_matrix->item(i, j) *= 1.0 + 1.0e-15 * (-1.0 + 2.0 * UniformRandom());
      }
   }

   printf("Perturbed snapshot matrix.\n");
   for (int i = 0; i < snapshot_matrix->numRows(); i++) {
      for (int j = 0; j < snapshot_matrix->numColumns(); j++) {
         printf("%.15E\t", snapshot_matrix->item(i, j));
      }
      printf("\n");
   }
   printf("\n");

   rand_proj = snapshot_matrix->mult(rand_mat);
   Q = rand_proj->qr_factorize();
   printf("After perturbation, 2nd/3rd columns of Q totally changed.\n");
   for (int i = 0; i < Q->numRows(); i++) {
      for (int j = 0; j < Q->numColumns(); j++) {
         printf("%.15E\t", Q->item(i, j));
      }
      printf("\n");
   }
   printf("\n");

   printf("Both Q are legitimate QR decomposition of rand_proj within 'machine precision'.\n");

   MPI_Finalize();
   return 0;
}

double UniformRandom()
{
   return static_cast<double> (rand()) / static_cast<double> (RAND_MAX);
}

The resulting output is:

Example from RandomizedSVDTest, Test_RandomizedSVD.

Snapshot matrix from example.
5.377000000000000E-01   -1.307700000000000E+00  -1.349900000000000E+00
1.833900000000000E+00   -4.336000000000000E-01  3.034900000000000E+00
-2.258800000000000E+00  3.426000000000000E-01   7.254000000000000E-01    
8.622000000000000E-01   3.578400000000000E+00   -6.310000000000000E-02   
3.188000000000000E-01   2.769400000000000E+00   7.147000000000000E-01    

rand_mat (3 x 3) in RandomizedSVD::computeSVD (d_debug_algorithm).              
1.000000000000000E+00   1.000000000000000E+00   1.000000000000000E+00  
1.000000000000000E+00   1.000000000000000E+00   1.000000000000000E+00  
1.000000000000000E+00   1.000000000000000E+00   1.000000000000000E+00  

rand_proj (5 x 3) in RandomizedSVD::computeSVD.                                                
-2.119900000000000E+00  -2.119900000000000E+00  -2.119900000000000E+00
4.435200000000000E+00   4.435200000000000E+00   4.435200000000000E+00  
-1.190800000000000E+00  -1.190800000000000E+00  -1.190800000000000E+00
4.377500000000000E+00   4.377500000000000E+00   4.377500000000000E+00
3.802900000000000E+00   3.802900000000000E+00   3.802900000000000E+00

Q (5 x 3) in RandomizedSVD::computeSVD.                                                          
-2.755033519022854E-01  -9.077467635817615E-01  3.135274050896839E-01  
5.764009936114987E-01   -4.177980391731229E-01  -7.001788974619734E-01 
-1.547570128049631E-01  3.758194159204378E-02   -1.295324450643630E-01 
5.689022703675899E-01   -5.221036081088777E-03  5.208590570351792E-01   
4.942269432280772E-01   -9.747401413574118E-04  3.512510016878761E-01   

Perturbed snapshot matrix.                                                                                     
5.377000000000003E-01   -1.307700000000000E+00  -1.349900000000001E+00
1.833900000000001E+00   -4.336000000000004E-01  3.034899999999998E+00
-2.258799999999999E+00  3.426000000000002E-01   7.253999999999997E-01 
8.622000000000000E-01   3.578400000000000E+00   -6.310000000000002E-02
3.187999999999999E-01   2.769400000000000E+00   7.147000000000007E-01

After perturbation, 2nd/3rd columns of Q totally changed.                                
-2.755033519022854E-01  -9.517690886536551E-01  6.753268486376426E-02
5.764009936114984E-01   -7.711547662313500E-02  7.454636540798325E-01
-1.547570128049630E-01  1.434853849974411E-01   -1.711447593679669E-01
5.689022703675899E-01   -2.064584708791187E-01  -2.607804146307769E-01
4.942269432280773E-01   -1.580368603932945E-01  -5.851720461598588E-01

Both Q are legitimate QR decomposition of rand_proj within 'machine precision'.
chldkdtn commented 1 year ago

@dreamer2368 If you can submit a PR with this fix, that would be wonderful.

siuwuncheung commented 1 year ago

Sorry for getting back this late. Thank you so much for setting up the example to make things clear, @dreamer2368. I agree that we need to change the rand_mat. Normally, it is a (Gaussian) random matrix, consisting of linear independent random columns. In the debug mode, we set it to be all ones, which break the linear independence and cause numerical instability issues. We need to be careful about how many tests, besides this one, will be affected by changing the rand_mat, before we know what to change.

If I understand correctly, we always assume the matrix being randomly projected has more or equal rows than columns. In this case, it will be safe to replace rand_mat->item(i, j) = 1; by rand_mat->item(i, j) = (i == j);

dreamer2368 commented 1 year ago

Resolved by PR #211 .