HiCMA
Hierarchical Computations on Manycore Architectures
timing_zauxiliary.c
Go to the documentation of this file.
1 
13 /*
14  * @copyright (c) 2009-2014 The University of Tennessee and The University
15  * of Tennessee Research Foundation.
16  * All rights reserved.
17  * @copyright (c) 2012-2016 Inria. All rights reserved.
18  * @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved.
19  */
20 
21 
22 #include <stdlib.h>
23 #include <stdio.h>
24 #include <string.h>
25 #include <math.h>
26 // #include "libhqr.h"
27 #include <morse.h>
28 #include <coreblas/cblas.h>
29 #include <coreblas/lapacke.h>
30 #include <coreblas/coreblas.h>
31 #include "timing_zauxiliary.h"
32 
33 
34 #undef CBLAS_SADDR //FIXME
35 #define CBLAS_SADDR(_val) (_val) //FIXME I should not include this definition
36 /*--------------------------------------------------------------
37  * Check the gemm
38  */
40  MORSE_enum transA, MORSE_enum transB, int M, int N, int K, //FIXME use z cblas calls for precision generation
41  double alpha, double *A, int LDA,
42  double *B, int LDB,
43  double beta, double *Cmorse,
44  double *Cref, int LDC,
45  double *Cinitnorm, double *Cmorsenorm, double *Clapacknorm )
46 {
47  double beta_const = -1.0;
48  double Rnorm;
49  double *work = (double *)malloc(chameleon_max(K,chameleon_max(M, N))* sizeof(double));
50 
51  *Cinitnorm = LAPACKE_dlange_work(LAPACK_COL_MAJOR, 'I', M, N, Cref, LDC, work);
52  *Cmorsenorm = LAPACKE_dlange_work(LAPACK_COL_MAJOR, 'I', M, N, Cmorse, LDC, work);
53 
54  cblas_dgemm(CblasColMajor, (CBLAS_TRANSPOSE)transA, (CBLAS_TRANSPOSE)transB, M, N, K, //TODO
55  CBLAS_SADDR(alpha), A, LDA, B, LDB, CBLAS_SADDR(beta), Cref, LDC); //TODO
56 
57  *Clapacknorm = LAPACKE_dlange_work(LAPACK_COL_MAJOR, 'I', M, N, Cref, LDC, work);
58 
59  cblas_daxpy(LDC * N, CBLAS_SADDR(beta_const), Cmorse, 1, Cref, 1);
60 
61  Rnorm = LAPACKE_dlange_work(LAPACK_COL_MAJOR, 'I', M, N, Cref, LDC, work);
62 
63  free(work);
64 
65  return Rnorm;
66 }
67 
68 
#define A(m, n)
Definition: pzgemm.c:56
double hicma_z_check_gemm(MORSE_enum transA, MORSE_enum transB, int M, int N, int K, double alpha, double *A, int LDA, double *B, int LDB, double beta, double *Cmorse, double *Cref, int LDC, double *Cinitnorm, double *Cmorsenorm, double *Clapacknorm)
#define CBLAS_SADDR(_val)
#define B(m, n)
Definition: pzgemm.c:57