time_zgemm_tile.c 2.67 KB
Newer Older
1
/**
2 3
 *
 * @file time_zgemm_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.
PRUVOST Florent's avatar
PRUVOST Florent committed
7
 * @copyright 2012-2019 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria,
8
 *                      Univ. Bordeaux. All rights reserved.
9
 *
10
 ***
11
 *
PRUVOST Florent's avatar
PRUVOST Florent committed
12 13 14
 * @version 0.9.2
 * @author Mathieu Faverge
 * @date 2014-11-16
15 16
 * @precisions normal z -> c d s
 *
17
 */
18
#define _TYPE  CHAMELEON_Complex64_t
19 20 21
#define _PREC  double
#define _LAMCH LAPACKE_dlamch_work

22
#define _NAME  "CHAMELEON_zgemm_Tile"
23 24 25 26 27
/* See Lawn 41 page 120 */
#define _FMULS FMULS_GEMM(M, N, K)
#define _FADDS FADDS_GEMM(M, N, K)

#include "./timing.c"
28
#include "timing_zauxiliary.h"
29 30

static int
Mathieu Faverge's avatar
Mathieu Faverge committed
31
RunTest(int *iparam, double *dparam, chameleon_time_t *t_)
32
{
33
    CHAMELEON_Complex64_t alpha, beta;
34
    PASTE_CODE_IPARAM_LOCALS( iparam );
35 36


37 38
    LDB = chameleon_max(K, iparam[IPARAM_LDB]);
    LDC = chameleon_max(M, iparam[IPARAM_LDC]);
39 40

    /* Allocate Data */
41 42 43
    PASTE_CODE_ALLOCATE_MATRIX_TILE( descA, 1, CHAMELEON_Complex64_t, ChamComplexDouble, LDA, M, K );
    PASTE_CODE_ALLOCATE_MATRIX_TILE( descB, 1, CHAMELEON_Complex64_t, ChamComplexDouble, LDB, K, N );
    PASTE_CODE_ALLOCATE_MATRIX_TILE( descC, 1, CHAMELEON_Complex64_t, ChamComplexDouble, LDC, M, N );
44

45
    /* Initialize Data */
46 47 48
    CHAMELEON_zplrnt_Tile( descA, 5373 );
    CHAMELEON_zplrnt_Tile( descB, 7672 );
    CHAMELEON_zplrnt_Tile( descC, 6387 );
49

50
#if !defined(CHAMELEON_SIMULATION)
51 52
    LAPACKE_zlarnv_work(1, ISEED, 1, &alpha);
    LAPACKE_zlarnv_work(1, ISEED, 1, &beta);
53 54 55
#else
    alpha = 1.5;
    beta = -2.3;
56
#endif
57

58
    /* Save C for check */
59
    PASTE_TILE_TO_LAPACK( descC, C2, check, CHAMELEON_Complex64_t, LDC, N );
60 61

    START_TIMING();
62
    CHAMELEON_zgemm_Tile( ChamNoTrans, ChamNoTrans, alpha, descA, descB, beta, descC );
63
    STOP_TIMING();
64

65
#if !defined(CHAMELEON_SIMULATION)
66 67 68
    /* Check the solution */
    if (check)
    {
69 70 71
        PASTE_TILE_TO_LAPACK( descA, A, check, CHAMELEON_Complex64_t, LDA, K );
        PASTE_TILE_TO_LAPACK( descB, B, check, CHAMELEON_Complex64_t, LDB, N );
        PASTE_TILE_TO_LAPACK( descC, C, check, CHAMELEON_Complex64_t, LDC, N );
72

73
        dparam[IPARAM_RES] = z_check_gemm( ChamNoTrans, ChamNoTrans, M, N, K,
74 75 76 77
                                           alpha, A, LDA, B, LDB, beta, C, C2, LDC,
                                           &(dparam[IPARAM_ANORM]),
                                           &(dparam[IPARAM_BNORM]),
                                           &(dparam[IPARAM_XNORM]));
78

79 80
        free(A); free(B); free(C); free(C2);
    }
81
#endif
82 83 84 85 86 87

    PASTE_CODE_FREE_MATRIX( descA );
    PASTE_CODE_FREE_MATRIX( descB );
    PASTE_CODE_FREE_MATRIX( descC );
    return 0;
}