diff --git a/timing/CMakeLists.txt b/timing/CMakeLists.txt index 47db669ce369b6d2418872f562cfd21eb1cfa909..9d87274341d3e0e3b6bef2f0579a7ebbcef93cb5 100644 --- a/timing/CMakeLists.txt +++ b/timing/CMakeLists.txt @@ -88,6 +88,8 @@ set(ZSRC time_zgetrf_incpiv_tile.c time_zgetrf_nopiv.c time_zgetrf_nopiv_tile.c + time_zgetrs_incpiv_tile.c + time_zgetrs_nopiv_tile.c #time_zgetrf.c #time_zgetrf_tile.c time_zposv.c diff --git a/timing/time_zgetrs_incpiv_tile.c b/timing/time_zgetrs_incpiv_tile.c new file mode 100644 index 0000000000000000000000000000000000000000..491da4f43ff45f71ef728f908fa744ded2c7a1ac --- /dev/null +++ b/timing/time_zgetrs_incpiv_tile.c @@ -0,0 +1,96 @@ +/** + * + * @copyright (c) 2009-2014 The University of Tennessee and The University + * of Tennessee Research Foundation. + * All rights reserved. + * @copyright (c) 2012-2014 Inria. All rights reserved. + * @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved. + * + **/ + +/** + * + * @precisions normal z -> c d s + * + **/ +#define _TYPE MORSE_Complex64_t +#define _PREC double +#define _LAMCH LAPACKE_dlamch_work + +#define _NAME "MORSE_zgetrs_incpiv_Tile" +/* See Lawn 41 page 120 */ +#define _FMULS (FMULS_GETRS( N, NRHS )) +#define _FADDS (FADDS_GETRS( N, NRHS )) + +#include "./timing.c" + +static int +RunTest(int *iparam, double *dparam, morse_time_t *t_) +{ + MORSE_desc_t *descL; + int *piv; + PASTE_CODE_IPARAM_LOCALS( iparam ); + check = 1; + + if ( M != N && check ) { + fprintf(stderr, "Check cannot be perfomed with M != N\n"); + check = 0; + } + +#if defined(CHAMELEON_USE_MAGMA) + if ( iparam[IPARAM_NB]%iparam[IPARAM_IB] != 0 ) { + fprintf(stderr, "NB must be a multiple of IB for LU on GPU\n"); + exit(-1); + } +#endif + + /* Allocate Data */ + PASTE_CODE_ALLOCATE_MATRIX_TILE( descA, 1, MORSE_Complex64_t, MorseComplexDouble, LDA, M, N ); + PASTE_CODE_ALLOCATE_MATRIX_TILE( descX, check, MORSE_Complex64_t, MorseComplexDouble, LDB, M, NRHS ); + PASTE_CODE_ALLOCATE_MATRIX_TILE( descAC, check, MORSE_Complex64_t, MorseComplexDouble, LDA, M, N ); + PASTE_CODE_ALLOCATE_MATRIX_TILE( descB, check, MORSE_Complex64_t, MorseComplexDouble, LDB, M, NRHS ); + + MORSE_zplrnt_Tile(descA, 3456); + + /* Allocate Workspace */ + MORSE_Alloc_Workspace_zgesv_incpiv_Tile(min(M,N), &descL, &piv, P, Q); + + /* Save A for check */ + if (check == 1){ + MORSE_zlacpy_Tile(MorseUpperLower, descA, descAC); + } + + /* MORSE ZGETRF_NOPIV */ + MORSE_zgetrf_incpiv_Tile( descA, descL, piv ); + + /* Check the solution */ + if ( check ) + { + /* Initialize and save B */ + MORSE_zplrnt_Tile( descX, 7732 ); + MORSE_zlacpy_Tile(MorseUpperLower, descX, descB); + + /* Compute the solution */ + START_TIMING(); + MORSE_zgetrs_incpiv_Tile( descA, descL, piv, descX ); + STOP_TIMING(); + + /* Check solution */ + dparam[IPARAM_ANORM] = MORSE_zlange_Tile(MorseInfNorm, descAC); + dparam[IPARAM_BNORM] = MORSE_zlange_Tile(MorseInfNorm, descB); + dparam[IPARAM_XNORM] = MORSE_zlange_Tile(MorseInfNorm, descX); + MORSE_zgemm_Tile( MorseNoTrans, MorseNoTrans, 1.0, descAC, descX, -1.0, descB ); + dparam[IPARAM_RES] = MORSE_zlange_Tile(MorseInfNorm, descB); + PASTE_CODE_FREE_MATRIX( descX ); + PASTE_CODE_FREE_MATRIX( descAC ); + PASTE_CODE_FREE_MATRIX( descB ); + } + + /* Deallocate Workspace */ + MORSE_Dealloc_Workspace(&descL); + + PASTE_CODE_FREE_MATRIX( descA ); + free( piv ); + + return 0; +} diff --git a/timing/time_zgetrs_nopiv_tile.c b/timing/time_zgetrs_nopiv_tile.c new file mode 100644 index 0000000000000000000000000000000000000000..2b9a531f56d2d1867ed9c21166d45c2484a3327e --- /dev/null +++ b/timing/time_zgetrs_nopiv_tile.c @@ -0,0 +1,80 @@ +/** + * + * @copyright (c) 2009-2014 The University of Tennessee and The University + * of Tennessee Research Foundation. + * All rights reserved. + * @copyright (c) 2012-2014 Inria. All rights reserved. + * @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved. + * + **/ + +/** + * + * @precisions normal z -> c d s + * + **/ +#define _TYPE MORSE_Complex64_t +#define _PREC double +#define _LAMCH LAPACKE_dlamch_work + +#define _NAME "MORSE_zgetrs_nopiv_Tile" +/* See Lawn 41 page 120 */ +#define _FMULS (FMULS_GETRS( N, NRHS )) +#define _FADDS (FADDS_GETRS( N, NRHS )) + +#include "./timing.c" + +static int +RunTest(int *iparam, double *dparam, morse_time_t *t_) +{ + PASTE_CODE_IPARAM_LOCALS( iparam ); + check = 1; + + if ( M != N && check ) { + fprintf(stderr, "Check cannot be perfomed with M != N\n"); + check = 0; + } + + /* Allocate Data */ + PASTE_CODE_ALLOCATE_MATRIX_TILE( descA, 1, MORSE_Complex64_t, MorseComplexDouble, LDA, M, N ); + PASTE_CODE_ALLOCATE_MATRIX_TILE( descX, check, MORSE_Complex64_t, MorseComplexDouble, LDB, M, NRHS ); + PASTE_CODE_ALLOCATE_MATRIX_TILE( descAC, check, MORSE_Complex64_t, MorseComplexDouble, LDA, M, N ); + PASTE_CODE_ALLOCATE_MATRIX_TILE( descB, check, MORSE_Complex64_t, MorseComplexDouble, LDB, M, NRHS ); + + MORSE_zplrnt_Tile(descA, 3456); + + /* Save A for check */ + if (check == 1){ + MORSE_zlacpy_Tile(MorseUpperLower, descA, descAC); + } + + /* MORSE ZGETRF_NOPIV */ + MORSE_zgetrf_nopiv_Tile( descA ); + + /* Check the solution */ + if ( check ) + { + /* Initialize and save B */ + MORSE_zplrnt_Tile( descX, 7732 ); + MORSE_zlacpy_Tile(MorseUpperLower, descX, descB); + + /* Compute the solution */ + START_TIMING(); + MORSE_zgetrs_nopiv_Tile( descA, descX ); + STOP_TIMING(); + + /* Check solution */ + dparam[IPARAM_ANORM] = MORSE_zlange_Tile(MorseInfNorm, descAC); + dparam[IPARAM_BNORM] = MORSE_zlange_Tile(MorseInfNorm, descB); + dparam[IPARAM_XNORM] = MORSE_zlange_Tile(MorseInfNorm, descX); + MORSE_zgemm_Tile( MorseNoTrans, MorseNoTrans, 1.0, descAC, descX, -1.0, descB ); + dparam[IPARAM_RES] = MORSE_zlange_Tile(MorseInfNorm, descB); + PASTE_CODE_FREE_MATRIX( descX ); + PASTE_CODE_FREE_MATRIX( descAC ); + PASTE_CODE_FREE_MATRIX( descB ); + } + + PASTE_CODE_FREE_MATRIX( descA ); + + return 0; +}