diff --git a/testing/testing_ztrmm.c b/testing/testing_ztrmm.c index 16cd4e1e8d0aa345075789c7d62364fbb95b5f8b..dced32a2e51699cbea23e26bbaae0455835279ea 100644 --- a/testing/testing_ztrmm.c +++ b/testing/testing_ztrmm.c @@ -2,7 +2,7 @@ * * @file testing_ztrmm.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 * */ @@ -106,6 +107,75 @@ testing_ztrmm_desc( run_arg_list_t *args, int check ) return hres; } +int +testing_ztrmm_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 K = run_arg_get_int( args, "K", N ); + int LDA = run_arg_get_int( args, "LDA", N ); + int LDB = run_arg_get_int( args, "LDB", N ); + 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 */ + int Bm, Bn; + CHAMELEON_Complex64_t *A, *B, *Binit; + + alpha = run_arg_get_complex64( args, "alpha", alpha ); + + CHAMELEON_Set( CHAMELEON_TILE_SIZE, nb ); + + /* Calculates the dimensions according to the side */ + if ( side == ChamLeft ) { + Bm = N; + Bn = K; + } + else { + Bm = K; + Bn = N; + } + + /* Creates the matrices */ + A = malloc( LDA*N*sizeof(CHAMELEON_Complex64_t) ); + B = malloc( LDB*Bn*sizeof(CHAMELEON_Complex64_t) ); + + /* Fills the matrix with random values */ + CHAMELEON_zplrnt( K, N, A, LDA, seedA ); + CHAMELEON_zplrnt( Bm, Bn, B, LDB, seedB ); + + /* Calculates the product */ + testing_start( &test_data ); + hres = CHAMELEON_ztrmm( side, uplo, trans, diag, N, K, alpha, A, LDA, B, LDB ); + test_data.hres = hres; + testing_stop( &test_data, flops_ztrmm( side, N, K ) ); + + /* Checks the solution */ + if ( check ) { + Binit = malloc( LDB*Bn*sizeof(CHAMELEON_Complex64_t) ); + CHAMELEON_zplrnt( Bm, Bn, Binit, LDB, seedB ); + + // hres += check_ztrmm( args, CHECK_TRMM, side, uplo, trans, diag, + // alpha, descA, descB, descBinit ); + + free( Binit ); + } + + free( A ); + free( B ); + + return hres; +} + testing_t test_ztrmm; const char *ztrmm_params[] = { "mtxfmt", "nb", "trans", "side", "uplo", "diag", "n", "k", "lda", "ldb", "alpha", "seedA", "seedB", NULL }; @@ -125,7 +195,7 @@ testing_ztrmm_init( void ) test_ztrmm.output = ztrmm_output; test_ztrmm.outchk = ztrmm_outchk; test_ztrmm.fptr_desc = testing_ztrmm_desc; - test_ztrmm.fptr_std = NULL; + test_ztrmm.fptr_std = testing_ztrmm_std; test_ztrmm.next = NULL; testing_register( &test_ztrmm );