Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tester fixes #183

Merged
merged 3 commits into from
May 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 25 additions & 24 deletions test/run_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
group_cat.add_argument( '--svd', action='store_true', help='run SVD tests' ),
group_cat.add_argument( '--aux', action='store_true', help='run auxiliary routine tests' ),
group_cat.add_argument( '--norms', action='store_true', help='run norm tests' ),
group_cat.add_argument( '--cond', action='store_true', help='run condition number estimate tests' ),
group_cat.add_argument( '--condest', action='store_true', help='run condition number estimate tests' ),
]
# map category objects to category names: ['lu', 'chol', ...]
categories = list( map( lambda x: x.dest, categories ) )
Expand Down Expand Up @@ -133,6 +133,7 @@
group_opt.add_argument( '--matrix', action='store', help='default=%(default)s', default='' )
group_opt.add_argument( '--matrixB', action='store', help='default=%(default)s', default='' )
group_opt.add_argument( '--matrixC', action='store', help='default=%(default)s', default='' )
group_opt.add_argument( '--cond', action='store', help='default=%(default)s', default='1e2' )

parser.add_argument( 'tests', nargs=argparse.REMAINDER )
opts = parser.parse_args()
Expand Down Expand Up @@ -183,17 +184,17 @@
nk_wide = dim
nk = dim

# for xsmall and small, use smaller nb, but not with medium or large
# For xsmall and small, use smaller nb, but not with medium or large.
# For xsmall, use smaller cond (1e2) than default (1e3) for Cholesky QR to pass.
is_default_nb = (opts.nb == parser.get_default('nb'))
is_default_cond = (opts.cond == parser.get_default('cond'))

if (not opts.dim):
if (opts.quick):
n = ' --dim 100'
tall = ' --dim 100x50' # 2:1
wide = ' --dim 50x100' # 1:2
mnk = ' --dim 25x50x75'
nk_tall = ' --dim 1x100x50' # 2:1
nk_wide = ' --dim 1x50x100' # 1:2
if (is_default_nb):
opts.nb = '8'

Expand All @@ -204,10 +205,10 @@
mnk += ' --dim 10x15x20 --dim 15x10x20' \
+ ' --dim 10x20x15 --dim 15x20x10' \
+ ' --dim 20x10x15 --dim 20x15x10'
nk_tall += ' --dim 1x20x10'
nk_wide += ' --dim 1x10x20'
if (is_default_nb):
opts.nb = '5,8'
if (is_default_cond):
opts.cond = '1e2'

if (opts.small):
n += ' --dim 25:100:25'
Expand All @@ -216,8 +217,6 @@
mnk += ' --dim 25x50x75 --dim 50x25x75' \
+ ' --dim 25x75x50 --dim 50x75x25' \
+ ' --dim 75x25x50 --dim 75x50x25'
nk_tall += ' --dim 1x50:200:50x25:100:25'
nk_wide += ' --dim 1x25:100:25x50:200:50'
if (is_default_nb):
opts.nb = '25,32'

Expand All @@ -228,8 +227,6 @@
mnk += ' --dim 100x300x600 --dim 300x100x600' \
+ ' --dim 100x600x300 --dim 300x600x100' \
+ ' --dim 600x100x300 --dim 600x300x100'
nk_tall += ' --dim 1x200:1000:200x100:500:100'
nk_wide += ' --dim 1x100:500:100x200:1000:200'
if (is_default_nb):
opts.nb = parser.get_default('nb')

Expand All @@ -240,11 +237,13 @@
mnk += ' --dim 1000x3000x6000 --dim 3000x1000x6000' \
+ ' --dim 1000x6000x3000 --dim 3000x6000x1000' \
+ ' --dim 6000x1000x3000 --dim 6000x3000x1000'
nk_tall += ' --dim 1x2000:10000:2000x1000:5000:1000'
nk_wide += ' --dim 1x1000:5000:1000x2000:10000:2000'
if (is_default_nb):
opts.nb = parser.get_default('nb')

# For nk, prepend 1x for the unused m dimension.
nk_tall = re.sub( r'--dim (\d)', r'--dim 1x\1', tall )
nk_wide = re.sub( r'--dim (\d)', r'--dim 1x\1', wide )

mn = ''
nk = ''
if (opts.square):
Expand Down Expand Up @@ -310,6 +309,7 @@
matrixB = ' --matrixB ' + opts.matrixB if (opts.matrixB) else ''
matrixC = ' --matrixC ' + opts.matrixC if (opts.matrixC) else ''
matrixBC = matrixB + matrixC
cond = ' --cond ' + opts.cond if (opts.cond) else ''

# general options for all routines
gen = origin + target + grid + check + ref + tol + repeat + nb
Expand Down Expand Up @@ -338,6 +338,7 @@ def filter_csv( values, csv ):
# limit options to specific values
dtype_real = ' --type ' + filter_csv( ('s', 'd'), opts.type )
dtype_complex = ' --type ' + filter_csv( ('c', 'z'), opts.type )
dtype_single = ' --type ' + filter_csv( ('s', 'c'), opts.type )
dtype_double = ' --type ' + filter_csv( ('d', 'z'), opts.type )

trans_nt = ' --trans ' + filter_csv( ('n', 't'), opts.trans )
Expand Down Expand Up @@ -366,19 +367,19 @@ def filter_csv( values, csv ):

[ 'hbmm', gen + dtype + la + side + uplo + mn + ab + kd + matrixBC ],

[ 'herk', gen + dtype_real + la + he_matrix + trans + mn + ab + matrixC ],
[ 'herk', gen + dtype_complex + la + he_matrix + trans_nc + mn + ab + matrixC ],
[ 'herk', gen + dtype_real + la + he_matrix + trans + nk + ab + matrixC ],
[ 'herk', gen + dtype_complex + la + he_matrix + trans_nc + nk + ab + matrixC ],

[ 'her2k', gen + dtype_real + la + he_matrix + trans + mn + ab + matrixBC ],
[ 'her2k', gen + dtype_complex + la + he_matrix + trans_nc + mn + ab + matrixBC ],
[ 'her2k', gen + dtype_real + la + he_matrix + trans + nk + ab + matrixBC ],
[ 'her2k', gen + dtype_complex + la + he_matrix + trans_nc + nk + ab + matrixBC ],

[ 'symm', gen + dtype + la + side + sy_matrix + mn + ab + matrixBC ],

[ 'syr2k', gen + dtype_real + la + sy_matrix + trans + mn + ab + matrixC ],
[ 'syr2k', gen + dtype_complex + la + sy_matrix + trans_nt + mn + ab + matrixC ],
[ 'syr2k', gen + dtype_real + la + sy_matrix + trans + nk + ab + matrixC ],
[ 'syr2k', gen + dtype_complex + la + sy_matrix + trans_nt + nk + ab + matrixC ],

[ 'syrk', gen + dtype_real + la + sy_matrix + trans + mn + ab + matrixBC ],
[ 'syrk', gen + dtype_complex + la + sy_matrix + trans_nt + mn + ab + matrixBC ],
[ 'syrk', gen + dtype_real + la + sy_matrix + trans + nk + ab + matrixBC ],
[ 'syrk', gen + dtype_complex + la + sy_matrix + trans_nt + nk + ab + matrixBC ],

# todo: tbsm fails for nb=8 or 16 with --quick.
[ 'tbsm', gen_no_nb + ' --nb 32' + dtype + la + side + uplo + transA + diag + mn + a + kd + matrixB ],
Expand Down Expand Up @@ -481,8 +482,7 @@ def filter_csv( values, csv ):
# todo: mn (i.e., add wide)
[ 'gels', gen + dtype + la + n + tall + trans_nc + ' --method-gels qr' ],
# Cholesky QR needs well-conditioned problem.
[ 'gels', gen + la + n + tall + trans_nc + ' --method-gels cholqr --matrix svd --cond 1e3 --type s,c' ],
[ 'gels', gen + la + n + tall + trans_nc + ' --method-gels cholqr --matrix svd --cond 1e3 --type d,z' ],
[ 'gels', gen + dtype + la + n + tall + trans_nc + cond + ' --method-gels cholqr --matrix svd' ],

# Generalized
#[ 'gglse', gen + dtype + la + mnk ],
Expand Down Expand Up @@ -619,8 +619,8 @@ def filter_csv( values, csv ):
#[ 'tbnorm', gen + dtype + la + n + kd + norm ],
]

# cond
if (opts.cond):
# condest
if (opts.condest):
cmds += [
[ 'gecondest', gen + dtype + n ],
[ 'pocondest', gen + dtype + n + uplo ],
Expand Down Expand Up @@ -743,6 +743,7 @@ def run_test( cmd ):
# ------------------------------------------------------------------------------
# run each test

print_tee( ' '.join( sys.argv ) )
start = time.time()
print_tee( time.ctime() )

Expand Down
12 changes: 6 additions & 6 deletions test/test_her2k.cc
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,9 @@ void test_her2k_work(Params& params, bool run)
opA = conj_transpose( A );
opB = conj_transpose( B );
}
slate_assert(A.mt() == C.mt());
slate_assert(B.mt() == C.mt());
slate_assert(A.nt() == B.nt());
slate_assert( opA.mt() == C.mt() );
slate_assert( opB.mt() == C.mt() );
slate_assert( opA.nt() == opB.nt() );

print_matrix("A", A, params);
print_matrix("B", B, params);
Expand All @@ -138,9 +138,9 @@ void test_her2k_work(Params& params, bool run)
// If check run, perform first half of SLATE residual check.
TestMatrix<slate::Matrix<scalar_t>> X_alloc, Y_alloc, Z_alloc;
if (check && ! ref) {
X_alloc = allocate_test_Matrix<scalar_t>( false, true, An, nrhs, params );
Y_alloc = allocate_test_Matrix<scalar_t>( false, true, Am, nrhs, params );
Z_alloc = allocate_test_Matrix<scalar_t>( false, true, Am, nrhs, params );
X_alloc = allocate_test_Matrix<scalar_t>( false, true, n, nrhs, params );
Y_alloc = allocate_test_Matrix<scalar_t>( false, true, n, nrhs, params );
Z_alloc = allocate_test_Matrix<scalar_t>( false, true, k, nrhs, params );

auto& X = X_alloc.A;
auto& Y = Y_alloc.A;
Expand Down
6 changes: 3 additions & 3 deletions test/test_herk.cc
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,9 @@ void test_herk_work(Params& params, bool run)
// If check run, perform first half of SLATE residual check.
TestMatrix<slate::Matrix<scalar_t>> X_alloc, Y_alloc, Z_alloc;
if (check && ! ref) {
X_alloc = allocate_test_Matrix<scalar_t>( false, true, An, nrhs, params );
Y_alloc = allocate_test_Matrix<scalar_t>( false, true, Am, nrhs, params );
Z_alloc = allocate_test_Matrix<scalar_t>( false, true, Am, nrhs, params );
X_alloc = allocate_test_Matrix<scalar_t>( false, true, n, nrhs, params );
Y_alloc = allocate_test_Matrix<scalar_t>( false, true, n, nrhs, params );
Z_alloc = allocate_test_Matrix<scalar_t>( false, true, k, nrhs, params );

auto& X = X_alloc.A;
auto& Y = Y_alloc.A;
Expand Down
12 changes: 6 additions & 6 deletions test/test_syr2k.cc
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,9 @@ void test_syr2k_work(Params& params, bool run)
opA = conj_transpose( A );
opB = conj_transpose( B );
}
slate_assert(opA.mt() == C.mt());
slate_assert(opB.mt() == C.mt());
slate_assert(opA.nt() == B.nt());
slate_assert( opA.mt() == C.mt() );
slate_assert( opB.mt() == C.mt() );
slate_assert( opA.nt() == opB.nt() );

print_matrix("A", A, params);
print_matrix("B", B, params);
Expand All @@ -136,9 +136,9 @@ void test_syr2k_work(Params& params, bool run)
// If check run, perform first half of SLATE residual check.
TestMatrix<slate::Matrix<scalar_t>> X_alloc, Y_alloc, Z_alloc;
if (check && ! ref) {
X_alloc = allocate_test_Matrix<scalar_t>( false, true, An, nrhs, params );
Y_alloc = allocate_test_Matrix<scalar_t>( false, true, Am, nrhs, params );
Z_alloc = allocate_test_Matrix<scalar_t>( false, true, Am, nrhs, params );
X_alloc = allocate_test_Matrix<scalar_t>( false, true, n, nrhs, params );
Y_alloc = allocate_test_Matrix<scalar_t>( false, true, n, nrhs, params );
Z_alloc = allocate_test_Matrix<scalar_t>( false, true, k, nrhs, params );

auto& X = X_alloc.A;
auto& Y = Y_alloc.A;
Expand Down
6 changes: 3 additions & 3 deletions test/test_syrk.cc
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,9 @@ void test_syrk_work(Params& params, bool run)
// If check run, perform first half of SLATE residual check.
TestMatrix<slate::Matrix<scalar_t>> X_alloc, Y_alloc, Z_alloc;
if (check && ! ref) {
X_alloc = allocate_test_Matrix<scalar_t>( false, true, An, nrhs, params );
Y_alloc = allocate_test_Matrix<scalar_t>( false, true, Am, nrhs, params );
Z_alloc = allocate_test_Matrix<scalar_t>( false, true, Am, nrhs, params );
X_alloc = allocate_test_Matrix<scalar_t>( false, true, n, nrhs, params );
Y_alloc = allocate_test_Matrix<scalar_t>( false, true, n, nrhs, params );
Z_alloc = allocate_test_Matrix<scalar_t>( false, true, k, nrhs, params );

auto& X = X_alloc.A;
auto& Y = Y_alloc.A;
Expand Down
Loading