Commit a5f37713 authored by PRUVOST Florent's avatar PRUVOST Florent

auxiliary.c/h is useless here - fix headers problem to access to auxiliary functions

parent a731cd2f
......@@ -30,14 +30,13 @@
# ----------------------------------------------------------------
set(TIMING_AUX_HDRS_GENERATED "")
set(ZHDR
zauxiliary.h
timing_zauxiliary.h
)
precisions_rules_py(TIMING_AUX_HDRS_GENERATED "${ZHDR}"
PRECISIONS "s;d;c;z;ds;zc" )
set(TIMING_AUX_HDRS
auxiliary.h
timing.h
timing.c
${TIMING_AUX_HDRS_GENERATED}
......@@ -51,14 +50,13 @@ add_custom_target(timing_include ALL SOURCES ${TIMING_AUX_HDRS})
# ----------------------------------------------------------------
set(TIMING_AUX_SRCS_GENERATED "")
set(ZSRC
zauxiliary.c
timing_zauxiliary.c
)
precisions_rules_py(TIMING_AUX_SRCS_GENERATED "${ZSRC}"
PRECISIONS "${CHAMELEON_PRECISION}")
set(TIMING_SRCS
auxiliary.c
${TIMING_AUX_SRCS_GENERATED}
)
......
/**
*
* @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.
*
**/
/**
*
* @file timing/auxiliary.c
*
* MORSE timing auxiliary routines
* MORSE is a software package provided by Univ. of Tennessee,
* Univ. of California Berkeley and Univ. of Colorado Denver
*
* @version 0.9.0
* @author Mathieu Faverge
* @author Cedric Castagnede
* @date 2010-11-15
*
**/
#include <morse.h>
#include <coreblas/include/coreblas.h>
#include "control/auxiliary.h"
int format[6]= { MorseCM, MorseCCRB, MorseCRRB, MorseRCRB, MorseRRRB, MorseRM };
int side[2] = { MorseLeft, MorseRight };
int uplo[2] = { MorseUpper, MorseLower };
int diag[2] = { MorseNonUnit, MorseUnit };
int trans[3] = { MorseNoTrans, MorseTrans, MorseConjTrans };
char *formatstr[6]= { "CM", "RM", "CCRB", "CRRB", "RCRB", "RRRB"};
char *sidestr[2] = { "Left ", "Right" };
char *uplostr[2] = { "Upper", "Lower" };
char *diagstr[2] = { "NonUnit", "Unit " };
char *transstr[3] = { "N", "T", "H" };
/*-------------------------------------------------------------------
* Mapping for the different layouts
*/
#define map_cm(m, n, i, j) ((i) + (j) * (m))
#define map_rm(m, n, i, j) ((i) * (n) + (j))
int map_CM(int m, int n, int mb, int nb, int i, int j)
{
int hres = map_cm(m, n, i, j);
(void)mb;
(void)nb;
(void)n;
return hres;
}
int map_RM(int m, int n, int mb, int nb, int i, int j)
{
int hres = map_rm(m, n, i, j);
(void)mb;
(void)nb;
(void)m;
return hres;
}
int map_CCRB(int m, int n, int mb, int nb, int i, int j) {
int m0 = m - m%mb;
int n0 = n - n%nb;
if ( j < n0 )
if (i < m0)
/* Case in A11 */
return ( map_cm( m/mb, n/nb, i/mb, j/nb )*mb*nb + map_cm( mb, nb, i%mb, j%nb) );
else
/* Case in A21 */
return ( m0*n0 + ( (j/nb) * (nb*(m%mb)) ) + map_cm( m%mb, nb, i%mb, j%nb) );
else
if (i < m0)
/* Case in A12 */
return ( m*n0 + ( (i/mb) * (mb*(n%nb)) ) + map_cm( mb, n%nb, i%mb, j%nb) );
else
/* Case in A22 */
return ( m*n0 + (n-n0)*m0 + map_cm( m%mb, n%nb, i%mb, j%nb) );
}
int map_CRRB(int m, int n, int mb, int nb, int i, int j) {
int m0 = m - m%mb;
int n0 = n - n%nb;
if ( j < n0 )
if (i < m0)
/* Case in A11 */
return ( map_cm( m/mb, n/nb, i/mb, j/nb )*mb*nb + map_rm( mb, nb, i%mb, j%nb) );
else
/* Case in A21 */
return ( m0*n0 + ( (j/nb) * (nb*(m%mb)) ) + map_rm( m%mb, nb, i%mb, j%nb) );
else
if (i < m0)
/* Case in A12 */
return ( m*n0 + ( (i/mb) * (mb*(n%nb)) ) + map_rm( mb, n%nb, i%mb, j%nb) );
else
/* Case in A22 */
return ( m*n0 + (n-n0)*m0 + map_rm( m%mb, n%nb, i%mb, j%nb) );
}
int map_RCRB(int m, int n, int mb, int nb, int i, int j) {
int m0 = m - m%mb;
int n0 = n - n%nb;
if ( j < n0 )
if (i < m0)
/* Case in A11 */
return ( map_rm( m/mb, n/nb, i/mb, j/nb )*mb*nb + map_cm( mb, nb, i%mb, j%nb) );
else
/* Case in A21 */
return ( m0*n + ( (j/nb) * (nb*(m%mb)) ) + map_cm( m%mb, nb, i%mb, j%nb) );
else
if (i < m0)
/* Case in A12 */
return ( m0*n0 + ( (i/mb) * (mb*(n%nb)) ) + map_cm( mb, n%nb, i%mb, j%nb) );
else
/* Case in A22 */
return ( m*n0 + (n-n0)*m0 + map_cm( m%mb, n%nb, i%mb, j%nb) );
}
int map_RRRB(int m, int n, int mb, int nb, int i, int j) {
int m0 = m - m%mb;
int n0 = n - n%nb;
if ( j < n0 )
if (i < m0)
/* Case in A11 */
return ( map_rm( m/mb, n/nb, i/mb, j/nb )*mb*nb + map_rm( mb, nb, i%mb, j%nb) );
else
/* Case in A21 */
return ( m0*n + ( (j/nb) * (nb*(m%mb)) ) + map_rm( m%mb, nb, i%mb, j%nb) );
else
if (i < m0)
/* Case in A12 */
return ( m0*n0 + ( (i/mb) * (mb*(n%nb)) ) + map_rm( mb, n%nb, i%mb, j%nb) );
else
/* Case in A22 */
return ( m*n0 + (n-n0)*m0 + map_rm( m%mb, n%nb, i%mb, j%nb) );
}
void *formatmap[6] = { map_CM, map_RM, map_CCRB, map_CRRB, map_RCRB, map_RRRB };
/**
*
* @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.
*
**/
/**
*
* @file timing/auxiliary.h
*
* MORSE timing auxiliary routines
* MORSE is a software package provided by Univ. of Tennessee,
* Univ. of California Berkeley and Univ. of Colorado Denver
*
* @version 0.9.0
* @author Mathieu Faverge
* @author Cedric Castagnede
* @date 2010-11-15
*
**/
#ifndef AUXILIARY_H
#define AUXILIARY_H
#ifndef max
#define max(a,b) ( ( (a) > (b) ) ? (a) : (b))
#endif
#ifndef min
#define min(a,b) ( ( (a) < (b) ) ? (a) : (b))
#endif
#include "zauxiliary.h"
#include "cauxiliary.h"
#include "dauxiliary.h"
#include "sauxiliary.h"
extern int IONE;
extern int ISEED[4];
extern int format[6];
extern int trans[3];
extern int uplo[2];
extern int side[2];
extern int diag[2];
extern char *formatstr[6];
extern char *transstr[3];
extern char *uplostr[2];
extern char *sidestr[2];
extern char *diagstr[2];
extern void *formatmap[6];
int map_CM (int m, int n, int mb, int nb, int i, int j);
int map_RM (int m, int n, int mb, int nb, int i, int j);
int map_CCRB(int m, int n, int mb, int nb, int i, int j);
int map_CRRB(int m, int n, int mb, int nb, int i, int j);
int map_RCRB(int m, int n, int mb, int nb, int i, int j);
int map_RRRB(int m, int n, int mb, int nb, int i, int j);
#endif /* AUXILIARY_H */
......@@ -23,6 +23,7 @@
#define _FADDS (FADDS_GEQRF( M, N ) + FADDS_GEQRS( M, N, NRHS ))
#include "./timing.c"
#include "timing_zauxiliary.h"
static int
RunTest(int *iparam, double *dparam, morse_time_t *t_)
......
......@@ -23,13 +23,14 @@
#define _FADDS FADDS_GEMM(M, N, K)
#include "./timing.c"
#include "timing_zauxiliary.h"
static int
RunTest(int *iparam, double *dparam, morse_time_t *t_)
{
MORSE_Complex64_t alpha, beta;
PASTE_CODE_IPARAM_LOCALS( iparam );
LDB = max(K, iparam[IPARAM_LDB]);
LDC = max(M, iparam[IPARAM_LDC]);
......@@ -54,32 +55,17 @@ RunTest(int *iparam, double *dparam, morse_time_t *t_)
START_TIMING();
MORSE_zgemm( MorseNoTrans, MorseNoTrans, M, N, K, alpha, A, LDA, B, LDB, beta, C, LDC );
STOP_TIMING();
/* Check the solution */
if (check)
{
// dparam[IPARAM_RES] = z_check_gemm( MorseNoTrans, MorseNoTrans, M, N, K,
// &alpha, A, LDA, B, LDB, &beta, C, C2, LDC,
// &(dparam[IPARAM_ANORM]),
// &(dparam[IPARAM_BNORM]),
// &(dparam[IPARAM_XNORM]));
MORSE_Complex64_t beta_const = -1.0;
double *work = (double *)malloc(max(K,max(M, N))* sizeof(double));
dparam[IPARAM_ANORM] = LAPACKE_zlange_work(LAPACK_COL_MAJOR, morse_lapack_const(MorseInfNorm), M, N, C2, LDC, work);
dparam[IPARAM_BNORM] = LAPACKE_zlange_work(LAPACK_COL_MAJOR, morse_lapack_const(MorseInfNorm), M, N, C, LDC, work);
cblas_zgemm(CblasColMajor, (CBLAS_TRANSPOSE)MorseNoTrans, (CBLAS_TRANSPOSE)MorseNoTrans, M, N, K,
CBLAS_SADDR(alpha), A, LDA, B, LDB, CBLAS_SADDR(beta), C2, LDC);
dparam[IPARAM_XNORM] = LAPACKE_zlange_work(LAPACK_COL_MAJOR, morse_lapack_const(MorseInfNorm), M, N, C2, LDC, work);
cblas_zaxpy(LDC * N, CBLAS_SADDR(beta_const), C, 1, C2, 1);
dparam[IPARAM_RES] = LAPACKE_zlange_work(LAPACK_COL_MAJOR, morse_lapack_const(MorseInfNorm), M, N, C2, LDC, work);
dparam[IPARAM_RES] = 0.0;
dparam[IPARAM_RES] = z_check_gemm( MorseNoTrans, MorseNoTrans, M, N, K,
alpha, A, LDA, B, LDB, beta, C, C2, LDC,
&(dparam[IPARAM_ANORM]),
&(dparam[IPARAM_BNORM]),
&(dparam[IPARAM_XNORM]));
free(work);
free(C2);
}
......
......@@ -23,13 +23,15 @@
#define _FADDS FADDS_GEMM(M, N, K)
#include "./timing.c"
#include "timing_zauxiliary.h"
static int
RunTest(int *iparam, double *dparam, morse_time_t *t_)
{
MORSE_Complex64_t alpha, beta;
PASTE_CODE_IPARAM_LOCALS( iparam );
LDB = max(K, iparam[IPARAM_LDB]);
LDC = max(M, iparam[IPARAM_LDC]);
......@@ -42,17 +44,17 @@ RunTest(int *iparam, double *dparam, morse_time_t *t_)
MORSE_zplrnt_Tile( descA, 5373 );
MORSE_zplrnt_Tile( descB, 7672 );
MORSE_zplrnt_Tile( descC, 6387 );
LAPACKE_zlarnv_work(1, ISEED, 1, &alpha);
LAPACKE_zlarnv_work(1, ISEED, 1, &beta);
/* Save C for check */
PASTE_TILE_TO_LAPACK( descC, C2, check, MORSE_Complex64_t, LDC, N );
START_TIMING();
MORSE_zgemm_Tile( MorseNoTrans, MorseNoTrans, alpha, descA, descB, beta, descC );
STOP_TIMING();
/* Check the solution */
if (check)
{
......@@ -60,28 +62,12 @@ RunTest(int *iparam, double *dparam, morse_time_t *t_)
PASTE_TILE_TO_LAPACK( descB, B, check, MORSE_Complex64_t, LDB, N );
PASTE_TILE_TO_LAPACK( descC, C, check, MORSE_Complex64_t, LDC, N );
// dparam[IPARAM_RES] = z_check_gemm( MorseNoTrans, MorseNoTrans, M, N, K,
// alpha, A, LDA, B, LDB, beta, C, C2, LDC,
// &(dparam[IPARAM_ANORM]),
// &(dparam[IPARAM_BNORM]),
// &(dparam[IPARAM_XNORM]));
MORSE_Complex64_t beta_const = -1.0;
double *work = (double *)malloc(max(K,max(M, N))* sizeof(double));
dparam[IPARAM_ANORM] = LAPACKE_zlange_work(LAPACK_COL_MAJOR, morse_lapack_const(MorseInfNorm), M, N, C2, LDC, work);
dparam[IPARAM_BNORM] = LAPACKE_zlange_work(LAPACK_COL_MAJOR, morse_lapack_const(MorseInfNorm), M, N, C, LDC, work);
cblas_zgemm(CblasColMajor, (CBLAS_TRANSPOSE)MorseNoTrans, (CBLAS_TRANSPOSE)MorseNoTrans, M, N, K,
CBLAS_SADDR(alpha), A, LDA, B, LDB, CBLAS_SADDR(beta), C2, LDC);
dparam[IPARAM_XNORM] = LAPACKE_zlange_work(LAPACK_COL_MAJOR, morse_lapack_const(MorseInfNorm), M, N, C2, LDC, work);
cblas_zaxpy(LDC * N, CBLAS_SADDR(beta_const), C, 1, C2, 1);
dparam[IPARAM_RES] = LAPACKE_zlange_work(LAPACK_COL_MAJOR, morse_lapack_const(MorseInfNorm), M, N, C2, LDC, work);
dparam[IPARAM_RES] = z_check_gemm( MorseNoTrans, MorseNoTrans, M, N, K,
alpha, A, LDA, B, LDB, beta, C, C2, LDC,
&(dparam[IPARAM_ANORM]),
&(dparam[IPARAM_BNORM]),
&(dparam[IPARAM_XNORM]));
free(work);
free(A); free(B); free(C); free(C2);
}
......
......@@ -23,6 +23,7 @@
#define _FADDS FADDS_GEQRF(M, N)
#include "./timing.c"
#include "timing_zauxiliary.h"
static int
RunTest(int *iparam, double *dparam, morse_time_t *t_)
......
......@@ -23,6 +23,7 @@
#define _FADDS (FADDS_GETRF( N, N ) + FADDS_GETRS( N, NRHS ))
#include "./timing.c"
#include "timing_zauxiliary.h"
static int
RunTest(int *iparam, double *dparam, morse_time_t *t_)
......
......@@ -23,6 +23,7 @@
#define _FADDS (FADDS_GETRF( N, N ) + FADDS_GETRS( N, NRHS ))
#include "./timing.c"
#include "timing_zauxiliary.h"
static int
RunTest(int *iparam, double *dparam, morse_time_t *t_)
......
......@@ -23,6 +23,7 @@
#define _FADDS FADDS_GETRF(M, N)
#include "./timing.c"
#include "timing_zauxiliary.h"
static int
RunTest(int *iparam, double *dparam, morse_time_t *t_)
......
......@@ -24,6 +24,7 @@
int morse_element_size(int type);
#include "./timing.c"
#include "timing_zauxiliary.h"
static int
RunTest(int *iparam, double *dparam, morse_time_t *t_)
......
......@@ -23,6 +23,7 @@
#define _FADDS (FADDS_POTRF( N ) + FADDS_POTRS( N, NRHS ))
#include "./timing.c"
#include "timing_zauxiliary.h"
static int
RunTest(int *iparam, double *dparam, morse_time_t *t_)
......
......@@ -23,6 +23,7 @@
#define _FADDS FADDS_POTRF( N )
#include "./timing.c"
#include "timing_zauxiliary.h"
static int
RunTest(int *iparam, double *dparam, morse_time_t *t_)
......
......@@ -23,6 +23,7 @@
#define _FADDS FADDS_POTRF( N )
#include "./timing.c"
#include "timing_zauxiliary.h"
static int
RunTest(int *iparam, double *dparam, morse_time_t *t_)
......
......@@ -23,6 +23,7 @@
#define _FADDS FADDS_TRSM( MorseLeft, N, NRHS )
#include "./timing.c"
#include "timing_zauxiliary.h"
static int
RunTest(int *iparam, double *dparam, morse_time_t *t_)
......
......@@ -21,7 +21,7 @@
#include <coreblas/include/cblas.h>
#include <coreblas/include/lapacke.h>
#include <coreblas/include/coreblas.h>
#include <control/auxiliary.h>
#include "timing_zauxiliary.h"
/*-------------------------------------------------------------------
* Check the orthogonality of Q
......
......@@ -13,8 +13,8 @@
* @precisions normal z -> c d s
*
**/
#ifndef ZAUXILIARY_H
#define ZAUXILIARY_H
#ifndef TIMING_ZAUXILIARY_H
#define TIMING_ZAUXILIARY_H
int z_check_orthogonality (int M, int N, int LDQ, MORSE_Complex64_t *Q);
int z_check_QRfactorization (int M, int N, MORSE_Complex64_t *A1, MORSE_Complex64_t *A2, int LDA, MORSE_Complex64_t *Q);
......@@ -41,4 +41,4 @@ int zcheck_inverse(int N, MORSE_Complex64_t *A1, MORSE_Complex64_t *A2,
int LDA, MORSE_enum uplo, double *rnorm, double *anorm, double *ainvnorm);
#endif /* ZAUXILIARY_H */
#endif /* TIMING_ZAUXILIARY_H */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment