diff --git a/testing/testing_zpoinv.c b/testing/testing_zpoinv.c index 2b5ff90b76186cc4443bb3f34bddc54929e1d74c..db8d2f93967704c917d6ed5d370b771427937ba1 100644 --- a/testing/testing_zpoinv.c +++ b/testing/testing_zpoinv.c @@ -14,7 +14,7 @@ * @author Florent Pruvost * @author Mathieu Faverge * @author Alycia Lisito - * @date 2022-02-02 + * @date 2022-02-07 * @precisions normal z -> c d s * */ @@ -87,6 +87,51 @@ testing_zpoinv_desc( run_arg_list_t *args, int check ) return hres; } +int +testing_zpoinv_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_uplo_t uplo = run_arg_get_uplo( args, "uplo", ChamUpper ); + int N = run_arg_get_int( args, "N", 1000 ); + int LDA = run_arg_get_int( args, "LDA", N ); + int seedA = run_arg_get_int( args, "seedA", random() ); + + /* Descriptors */ + CHAMELEON_Complex64_t *A; + + CHAMELEON_Set( CHAMELEON_TILE_SIZE, nb ); + + /* Create the matrices */ + A = malloc( LDA*N*sizeof(CHAMELEON_Complex64_t) ); + + /* Initialise the matrix with the random values */ + CHAMELEON_zplghe( (double)N, uplo, N, A, LDA, seedA ); + + /* Calculates the inversed matrix */ + testing_start( &test_data ); + hres = CHAMELEON_zpoinv( uplo, N, A, LDA ); + test_data.hres = hres; + testing_stop( &test_data, flops_zpoinv( N ) ); + + /* Check the inverse */ + if ( check ) { + CHAMELEON_Complex64_t *A0 = malloc( LDA * N * sizeof(CHAMELEON_Complex64_t) ); + CHAMELEON_zplghe( (double)N, uplo, N, A0, LDA, seedA ); + + // hres += check_ztrtri( args, ChamHermitian, uplo, ChamNonUnit, descA0, descA ); + + free( A0 ); + } + + free( A ); + + return hres; +} + testing_t test_zpoinv; const char *zpoinv_params[] = { "mtxfmt", "nb", "uplo", "n", "lda", "seedA", NULL }; const char *zpoinv_output[] = { NULL }; @@ -105,7 +150,7 @@ testing_zpoinv_init( void ) test_zpoinv.output = zpoinv_output; test_zpoinv.outchk = zpoinv_outchk; test_zpoinv.fptr_desc = testing_zpoinv_desc; - test_zpoinv.fptr_std = NULL; + test_zpoinv.fptr_std = testing_zpoinv_std; test_zpoinv.next = NULL; testing_register( &test_zpoinv ); diff --git a/testing/testing_zposv.c b/testing/testing_zposv.c index 56b10eced0ca4731460d065649bb59b296c3e932..be1aead9410979e1a725178fb67e29685fe20c5f 100644 --- a/testing/testing_zposv.c +++ b/testing/testing_zposv.c @@ -2,7 +2,7 @@ * * @file testing_zposv.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,7 @@ * @author Lucas Barros de Assis * @author Florent Pruvost * @author Mathieu Faverge - * @date 2020-11-19 + * @date 2022-02-07 * @precisions normal z -> c d s * */ @@ -105,6 +105,67 @@ testing_zposv_desc( run_arg_list_t *args, int check ) return hres; } +int +testing_zposv_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_uplo_t uplo = run_arg_get_uplo( args, "uplo", ChamUpper ); + int N = run_arg_get_int( args, "N", 1000 ); + int NRHS = run_arg_get_int( args, "NRHS", 1 ); + int LDA = run_arg_get_int( args, "LDA", N ); + int LDB = run_arg_get_int( args, "LDB", N ); + int seedA = run_arg_get_int( args, "seedA", random() ); + int seedB = run_arg_get_int( args, "seedB", random() ); + + /* Descriptors */ + CHAMELEON_Complex64_t *A, *X; + + CHAMELEON_Set( CHAMELEON_TILE_SIZE, nb ); + + /* Creates the matrices */ + A = malloc( LDA*N*sizeof(CHAMELEON_Complex64_t) ); + X = malloc( LDB*NRHS*sizeof(CHAMELEON_Complex64_t) ); + + /* Fills the matrix with random values */ + CHAMELEON_zplghe( (double)N, uplo, N, A, LDA, seedA ); + CHAMELEON_zplrnt( N, NRHS, X, LDB, seedB ); + + /* Calculates the solution */ + testing_start( &test_data ); + hres = CHAMELEON_zposv( uplo, N, NRHS, A, LDA, X, LDB ); + test_data.hres = hres; + testing_stop( &test_data, flops_zposv( N, NRHS ) ); + + /* Checks the factorisation and residue */ + if ( check ) { + CHAMELEON_Complex64_t *A0 = malloc( LDA*N*sizeof(CHAMELEON_Complex64_t) ); + CHAMELEON_Complex64_t *X0 = malloc( LDB*NRHS*sizeof(CHAMELEON_Complex64_t) ); + + /* Check the factorization */ + CHAMELEON_zplghe( (double)N, uplo, N, A0, LDA, seedA ); + + // hres += check_zxxtrf( args, ChamHermitian, uplo, descA0, descA ); + + /* Check the solve */ + CHAMELEON_zplrnt( N, NRHS, X0, LDB, seedB ); + + CHAMELEON_zplghe( (double)N, uplo, N, A0, LDA, seedA ); + // hres += check_zsolve( args, ChamHermitian, ChamNoTrans, uplo, descA0, descX, descB ); + + free( A0 ); + free( X0 ); + } + + free( A ); + free( X ); + + return hres; +} + testing_t test_zposv; const char *zposv_params[] = { "mtxfmt", "nb", "uplo", "n", "nrhs", "lda", "ldb", "seedA", "seedB", NULL }; @@ -124,7 +185,7 @@ testing_zposv_init( void ) test_zposv.output = zposv_output; test_zposv.outchk = zposv_outchk; test_zposv.fptr_desc = testing_zposv_desc; - test_zposv.fptr_std = NULL; + test_zposv.fptr_std = testing_zposv_std; test_zposv.next = NULL; testing_register( &test_zposv ); diff --git a/testing/testing_zpotri.c b/testing/testing_zpotri.c index 5544d3b4efba249db0beebc4b4644d2911b0a79c..072a998066dc77f3777acb5b3b9a321433f25aa3 100644 --- a/testing/testing_zpotri.c +++ b/testing/testing_zpotri.c @@ -2,7 +2,7 @@ * * @file testing_zpotri.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-07 * @precisions normal z -> c d s * */ @@ -82,6 +83,54 @@ testing_zpotri_desc( run_arg_list_t *args, int check ) return hres; } +int +testing_zpotri_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_uplo_t uplo = run_arg_get_uplo( args, "uplo", ChamUpper ); + int N = run_arg_get_int( args, "N", 1000 ); + int LDA = run_arg_get_int( args, "LDA", N ); + int seedA = run_arg_get_int( args, "seedA", random() ); + + /* Descriptors */ + CHAMELEON_Complex64_t *A; + + CHAMELEON_Set( CHAMELEON_TILE_SIZE, nb ); + + /* Create the matrices */ + A = malloc( LDA*N*sizeof(CHAMELEON_Complex64_t) ); + + /* Initialise the matrix with the random values */ + CHAMELEON_zplghe( (double)N, uplo, N, A, LDA, seedA ); + + hres = CHAMELEON_zpotrf( uplo, N, A, LDA ); + assert( hres == 0 ); + + /* Calculates the inversed matrix */ + testing_start( &test_data ); + hres += CHAMELEON_zpotri( uplo, N, A, LDA ); + test_data.hres = hres; + testing_stop( &test_data, flops_zpotri( N ) ); + + /* Check the inverse */ + if ( check ) { + CHAMELEON_Complex64_t *A0 = malloc( LDA*N*sizeof(CHAMELEON_Complex64_t) ); + CHAMELEON_zplghe( (double)N, uplo, N, A0, LDA, seedA ); + + // hres += check_ztrtri( args, ChamHermitian, uplo, ChamNonUnit, descA0, descA ); + + free( A0 ); + } + + free( A ); + + return hres; +} + testing_t test_zpotri; const char *zpotri_params[] = { "mtxfmt", "nb", "uplo", "n", "lda", "seedA", NULL }; const char *zpotri_output[] = { NULL }; @@ -100,7 +149,7 @@ testing_zpotri_init( void ) test_zpotri.output = zpotri_output; test_zpotri.outchk = zpotri_outchk; test_zpotri.fptr_desc = testing_zpotri_desc; - test_zpotri.fptr_std = NULL; + test_zpotri.fptr_std = testing_zpotri_std; test_zpotri.next = NULL; testing_register( &test_zpotri ); diff --git a/testing/testing_zpotrs.c b/testing/testing_zpotrs.c index eff8694631327db69ebff726d2847b4beb0a3c08..cb7b2715e201ff9b5f4b596e36fa8b8b26770e58 100644 --- a/testing/testing_zpotrs.c +++ b/testing/testing_zpotrs.c @@ -2,7 +2,7 @@ * * @file testing_zpotrs.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. * *** @@ -12,7 +12,8 @@ * @version 1.1.0 * @author Lucas Barros de Assis * @author Mathieu Faverge - * @date 2020-11-19 + * @author Alycia Lisito + * @date 2022-02-07 * @precisions normal z -> c d s * */ @@ -94,6 +95,64 @@ testing_zpotrs_desc( run_arg_list_t *args, int check ) return hres; } +int +testing_zpotrs_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_uplo_t uplo = run_arg_get_uplo( args, "uplo", ChamUpper ); + int N = run_arg_get_int( args, "N", 1000 ); + int NRHS = run_arg_get_int( args, "NRHS", 1 ); + int LDA = run_arg_get_int( args, "LDA", N ); + int LDB = run_arg_get_int( args, "LDB", N ); + int seedA = run_arg_get_int( args, "seedA", random() ); + int seedB = run_arg_get_int( args, "seedB", random() ); + + /* Descriptors */ + CHAMELEON_Complex64_t *A, *X; + + CHAMELEON_Set( CHAMELEON_TILE_SIZE, nb ); + + /* Creates the matrices */ + A = malloc( LDA*N*sizeof(CHAMELEON_Complex64_t) ); + X = malloc( LDB*NRHS*sizeof(CHAMELEON_Complex64_t) ); + + /* Fills the matrix with random values */ + CHAMELEON_zplghe( (double)N, uplo, N, A, LDA, seedA ); + CHAMELEON_zplrnt( N, NRHS, X, LDB, seedB ); + + hres = CHAMELEON_zpotrf( uplo, N, A, LDA ); + assert( hres == 0 ); + + /* Calculates the solution */ + testing_start( &test_data ); + hres += CHAMELEON_zpotrs( uplo, N, NRHS, A, LDA, X, LDB ); + test_data.hres = hres; + testing_stop( &test_data, flops_zpotrs( N, NRHS ) ); + + /* Checks the factorisation and residue */ + if ( check ) { + CHAMELEON_Complex64_t *A0 = malloc( LDA*N*sizeof(CHAMELEON_Complex64_t) ); + CHAMELEON_Complex64_t *X0 = malloc( LDB*NRHS*sizeof(CHAMELEON_Complex64_t) ); + + CHAMELEON_zplghe( (double)N, uplo, N, A0, LDA, seedA ); + CHAMELEON_zplrnt( N, NRHS, X0, LDB, seedB ); + + // hres += check_zsolve( args, ChamHermitian, ChamNoTrans, uplo, descA0, descX, descB ); + + free( A0 ); + free( X0 ); + } + + free( A ); + free( X ); + + return hres; +} + testing_t test_zpotrs; const char *zpotrs_params[] = { "mtxfmt", "nb", "uplo", "n", "nrhs", "lda", "ldb", "seedA", "seedB", NULL }; @@ -113,7 +172,7 @@ testing_zpotrs_init( void ) test_zpotrs.output = zpotrs_output; test_zpotrs.outchk = zpotrs_outchk; test_zpotrs.fptr_desc = testing_zpotrs_desc; - test_zpotrs.fptr_std = NULL; + test_zpotrs.fptr_std = testing_zpotrs_std; test_zpotrs.next = NULL; testing_register( &test_zpotrs );