From 4d94679f12ae932d466a394d3b06676524fa84ab Mon Sep 17 00:00:00 2001 From: Alycia Lisito <alycia.lisito@inria.fr> Date: Fri, 4 Feb 2022 15:41:13 +0100 Subject: [PATCH] testing: add standard api to trsm --- testing/testing_ztrsm.c | 67 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 64 insertions(+), 3 deletions(-) diff --git a/testing/testing_ztrsm.c b/testing/testing_ztrsm.c index 8ce176491..851df92b8 100644 --- a/testing/testing_ztrsm.c +++ b/testing/testing_ztrsm.c @@ -2,7 +2,7 @@ * * @file testing_ztrsm.c * - * @copyright 2019-2021 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, + * @copyright 2019-2022 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, * Univ. Bordeaux. All rights reserved. * *** @@ -13,7 +13,8 @@ * @author Lucas Barros de Assis * @author Florent Pruvost * @author Mathieu Faverge - * @date 2020-11-19 + * @author Alycia Lisito + * @date 2022-02-04 * @precisions normal z -> c d s * */ @@ -97,6 +98,66 @@ testing_ztrsm_desc( run_arg_list_t *args, int check ) return hres; } +int +testing_ztrsm_std( run_arg_list_t *args, int check ) +{ + testdata_t test_data = { .args = args }; + int hres = 0; + + /* Read arguments */ + int nb = run_arg_get_int( args, "nb", 320 ); + cham_trans_t trans = run_arg_get_trans( args, "trans", ChamNoTrans ); + cham_side_t side = run_arg_get_side( args, "side", ChamLeft ); + cham_uplo_t uplo = run_arg_get_uplo( args, "uplo", ChamUpper ); + cham_diag_t diag = run_arg_get_diag( args, "diag", ChamNonUnit ); + int N = run_arg_get_int( args, "N", 1000 ); + int M = run_arg_get_int( args, "M", N ); + int Ak = ( side == ChamLeft ) ? M : N; + int LDA = run_arg_get_int( args, "LDA", Ak ); + int LDB = run_arg_get_int( args, "LDB", M ); + CHAMELEON_Complex64_t alpha = testing_zalea(); + int seedA = run_arg_get_int( args, "seedA", random() ); + int seedB = run_arg_get_int( args, "seedB", random() ); + + /* Descriptors */ + CHAMELEON_Complex64_t *A, *B, *Binit; + + alpha = run_arg_get_complex64( args, "alpha", alpha ); + + CHAMELEON_Set( CHAMELEON_TILE_SIZE, nb ); + + /* Creates the matrices */ + A = malloc( LDA*Ak*sizeof(CHAMELEON_Complex64_t) ); + B = malloc( LDB*N*sizeof(CHAMELEON_Complex64_t) ); + + /* Fills the matrix with random values */ + /* We bump a little bit the diagonal to make it stable */ + CHAMELEON_zplgsy( 2., uplo, N, A, LDA, seedA ); + CHAMELEON_zplrnt( M, N, B, LDB, seedB ); + + /* Calculates the product */ + testing_start( &test_data ); + hres = CHAMELEON_ztrsm( side, uplo, trans, diag, N, M, alpha, A, LDA, B, LDB ); + test_data.hres = hres; + testing_stop( &test_data, flops_ztrsm( side, M, N ) ); + + /* Checks the solution */ + if ( check ) { + Binit = malloc( LDB*N*sizeof(CHAMELEON_Complex64_t) ); + CHAMELEON_zplrnt( M, N, Binit, LDB, seedB ); + + // hres += check_ztrmm( args, CHECK_TRSM, side, uplo, trans, diag, + // alpha, descA, descB, descBinit ); + + free( Binit ); + } + + free( A ); + free( B ); + + return hres; +} + testing_t test_ztrsm; const char *ztrsm_params[] = { "mtxfmt", "nb", "side", "uplo", "trans", "diag", "m", "n", "lda", "ldb", "alpha", "seedA", "seedB", NULL }; @@ -116,7 +177,7 @@ testing_ztrsm_init( void ) test_ztrsm.output = ztrsm_output; test_ztrsm.outchk = ztrsm_outchk; test_ztrsm.fptr_desc = testing_ztrsm_desc; - test_ztrsm.fptr_std = NULL; + test_ztrsm.fptr_std = testing_ztrsm_std; test_ztrsm.next = NULL; testing_register( &test_ztrsm ); -- GitLab