time_zpotrs_tile.c 2.52 KB
Newer Older
1
/**
2 3
 *
 * @file time_zpotrs_tile.c
4
 *
Mathieu Faverge's avatar
Mathieu Faverge committed
5 6
 * @copyright 2009-2014 The University of Tennessee and The University of
 *                      Tennessee Research Foundation. All rights reserved.
Mathieu Faverge's avatar
Mathieu Faverge committed
7
 * @copyright 2012-2018 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria,
8
 *                      Univ. Bordeaux. All rights reserved.
9
 *
10
 ***
11
 *
Mathieu Faverge's avatar
Mathieu Faverge committed
12
 * @version 1.0.0
13 14
 * @precisions normal z -> c d s
 *
15
 */
16
#define _TYPE  CHAMELEON_Complex64_t
17 18 19
#define _PREC  double
#define _LAMCH LAPACKE_dlamch_work

20
#define _NAME  "CHAMELEON_zpotrs_Tile"
21 22 23 24 25 26 27
/* See Lawn 41 page 120 */
#define _FMULS FMULS_POTRS( N, NRHS )
#define _FADDS FADDS_POTRS( N, NRHS )

#include "./timing.c"

static int
Mathieu Faverge's avatar
Mathieu Faverge committed
28
RunTest(int *iparam, double *dparam, chameleon_time_t *t_)
29 30
{
    PASTE_CODE_IPARAM_LOCALS( iparam );
31
    cham_uplo_t uplo = ChamUpper;
32

33
    LDA = chameleon_max( LDA, N );
34 35

    /* Allocate Data */
36
    PASTE_CODE_ALLOCATE_MATRIX_TILE( descA,  1,     CHAMELEON_Complex64_t, ChamComplexDouble, LDA, N, N    );
37
    PASTE_CODE_ALLOCATE_MATRIX_TILE( descB,  1,     CHAMELEON_Complex64_t, ChamComplexDouble, LDB, N, NRHS );
38
    PASTE_CODE_ALLOCATE_MATRIX_TILE( descAC, check, CHAMELEON_Complex64_t, ChamComplexDouble, LDA, N, N    );
39
    PASTE_CODE_ALLOCATE_MATRIX_TILE( descX,  1,     CHAMELEON_Complex64_t, ChamComplexDouble, LDB, N, NRHS );
40

41 42 43 44 45
    /* Initialize data and save A and B if check */
    CHAMELEON_zplrnt_Tile( descX, 7672 );
    if ( check ) {
        CHAMELEON_zplghe_Tile( (double)N, ChamUpperLower, descAC, 51 );
        CHAMELEON_zlacpy_Tile( uplo, descAC, descA );
46

47 48 49 50 51
        CHAMELEON_zlacpy_Tile( ChamUpperLower, descX, descB );
    }
    else {
        CHAMELEON_zplghe_Tile( (double)N, uplo, descA, 51 );
    }
52 53
    //RUNTIME_zlocality_allrestrict( STARPU_CUDA );

54 55
    /* CHAMELEON ZPOTRF */
    CHAMELEON_zpotrf_Tile(uplo, descA);
56

57 58 59 60 61
    /* Compute the solution */
    START_TIMING();
    CHAMELEON_zpotrs_Tile( uplo, descA, descX );
    STOP_TIMING();

62 63 64 65
    /* Check the solution */
    if ( check )
    {
        /* Check solution */
66 67 68
        dparam[IPARAM_ANORM] = CHAMELEON_zlange_Tile( ChamInfNorm, descAC );
        dparam[IPARAM_BNORM] = CHAMELEON_zlange_Tile( ChamInfNorm, descB  );
        dparam[IPARAM_XNORM] = CHAMELEON_zlange_Tile( ChamInfNorm, descX  );
69
        CHAMELEON_zgemm_Tile( ChamNoTrans, ChamNoTrans, 1.0, descAC, descX, -1.0, descB );
70
        dparam[IPARAM_RES] = CHAMELEON_zlange_Tile( ChamInfNorm, descB );
71 72 73

        PASTE_CODE_FREE_MATRIX( descAC );
    }
74

75
    PASTE_CODE_FREE_MATRIX( descA );
76 77
    PASTE_CODE_FREE_MATRIX( descX );
    PASTE_CODE_FREE_MATRIX( descB );
78 79 80

    return 0;
}