Mentions légales du service

Skip to content
Snippets Groups Projects
Commit acc7fd61 authored by Mathieu Faverge's avatar Mathieu Faverge
Browse files

Merge branch 'check_cholesky' into 'master'

Add checks for the starndard API of the Cholesky functions

See merge request !286
parents 2e8763d7 0e0384ef
No related branches found
No related tags found
1 merge request!286Add checks for the starndard API of the Cholesky functions
......@@ -627,7 +627,7 @@ int main (int argc, char **argv) {
nowarmup = parameters_getvalue_int( "nowarmup" );
profile = parameters_getvalue_int( "profile" );
forcegpu = parameters_getvalue_int( "forcegpu" );
api = parameters_getvalue_int( "api" );
api = parameters_getvalue_int( "api" );
rc = CHAMELEON_Init( ncores, ngpus );
......
......@@ -172,6 +172,9 @@ int check_znorm_std( run_arg_list_t *args, cham_mtxtype_t matrix_type, cham_norm
/* Compares the norms */
result = fabs( norm_cham - norm_lapack ) / ( norm_lapack * eps );
run_arg_add_double( args, "||A||", norm_cham );
run_arg_add_double( args, "||B||", norm_lapack );
switch(norm_type) {
case ChamInfNorm:
/* Sum order on the line can differ */
......@@ -187,15 +190,20 @@ int check_znorm_std( run_arg_list_t *args, cham_mtxtype_t matrix_type, cham_norm
break;
case ChamMaxNorm:
default:
#if defined(PRECISION_z) || defined(PRECISION_c)
/* Add a factor two to macth different implementation of cabs */
result = result / 2;
#else
/* result should be perfectly equal */
#endif
;
}
run_arg_add_double( args, "||R||", result );
info_solution = ( result < 1 ) ? 0 : 1;
free(work);
(void)args;
return info_solution;
}
......@@ -625,7 +633,7 @@ int check_zsymm_std( run_arg_list_t *args, cham_mtxtype_t matrix_type, cham_side
An = M;
}
else {
normTypeA = '0';
normTypeA = 'O';
normTypeB = 'I';
An = N;
}
......@@ -1349,6 +1357,33 @@ int check_zxxtrf( run_arg_list_t *args, cham_mtxtype_t mtxtype, cham_uplo_t uplo
return info_global;
}
int check_zxxtrf_std( run_arg_list_t *args, cham_mtxtype_t mtxtype, cham_uplo_t uplo, int M, int N,
CHAMELEON_Complex64_t *A, CHAMELEON_Complex64_t *LU, int LDA )
{
int info_global;
CHAM_desc_t *descA, *descLU;
int P = parameters_getvalue_int( "P" );
int Q = parameters_compute_q( P );
intptr_t mtxfmt = parameters_getvalue_int( "mtxfmt" );
int nb = run_arg_get_int( args, "nb", 320 );
CHAMELEON_Desc_Create(
&descA, (void*)(-mtxfmt), ChamComplexDouble, nb, nb, nb * nb, LDA, N, 0, 0, M, N, P, Q );
CHAMELEON_Desc_Create(
&descLU, (void*)(-mtxfmt), ChamComplexDouble, nb, nb, nb * nb, LDA, N, 0, 0, M, N, P, Q );
CHAMELEON_zLap2Desc( uplo, A, LDA, descA );
CHAMELEON_zLap2Desc( uplo, LU, LDA, descLU );
info_global = check_zxxtrf( args, mtxtype, uplo, descA, descLU );
CHAMELEON_Desc_Destroy( &descA );
CHAMELEON_Desc_Destroy( &descLU );
(void)args;
return info_global;
}
/**
********************************************************************************
*
......@@ -1418,6 +1453,12 @@ int check_zsolve( run_arg_list_t *args, cham_mtxtype_t mtxtype, cham_trans_t tra
Rnorm = CHAMELEON_zlange_Tile( ChamOneNorm, descB );
result = Rnorm / ( Anorm * Xnorm * chameleon_max( M, N ) * eps );
run_arg_add_double( args, "||A||", Anorm );
run_arg_add_double( args, "||X||", Xnorm );
run_arg_add_double( args, "||B||", Bnorm );
run_arg_add_double( args, "||Ax-b||", Rnorm );
run_arg_add_double( args, "||Ax-b||/N/eps/(||A||||x||+||b||", result );
if ( isnan(Xnorm) || isinf(Xnorm) || isnan(result) || isinf(result) || (result > 60.0) ) {
info_local = 1;
}
......@@ -1437,6 +1478,37 @@ int check_zsolve( run_arg_list_t *args, cham_mtxtype_t mtxtype, cham_trans_t tra
return info_global;
}
int check_zsolve_std( run_arg_list_t *args, cham_mtxtype_t mtxtype, cham_trans_t trans, cham_uplo_t uplo, int N, int NRHS,
CHAMELEON_Complex64_t *A, int LDA, CHAMELEON_Complex64_t *X, CHAMELEON_Complex64_t *B, int LDB )
{
int info_global;
CHAM_desc_t *descA, *descB, *descX;
int P = parameters_getvalue_int( "P" );
int Q = parameters_compute_q( P );
intptr_t mtxfmt = parameters_getvalue_int( "mtxfmt" );
int nb = run_arg_get_int( args, "nb", 320 );
CHAMELEON_Desc_Create(
&descA, (void*)(-mtxfmt), ChamComplexDouble, nb, nb, nb * nb, LDA, N, 0, 0, N, N, P, Q );
CHAMELEON_Desc_Create(
&descB, (void*)(-mtxfmt), ChamComplexDouble, nb, nb, nb * nb, LDB, NRHS, 0, 0, N, NRHS, P, Q );
CHAMELEON_Desc_Create(
&descX, (void*)(-mtxfmt), ChamComplexDouble, nb, nb, nb * nb, LDB, NRHS, 0, 0, N, NRHS, P, Q );
CHAMELEON_zLap2Desc( uplo, A, LDA, descA );
CHAMELEON_zLap2Desc( uplo, B, LDB, descB );
CHAMELEON_zLap2Desc( uplo, X, LDB, descX );
info_global = check_zsolve( args, mtxtype, trans, uplo, descA, descX, descB );
CHAMELEON_Desc_Destroy( &descA );
CHAMELEON_Desc_Destroy( &descB );
CHAMELEON_Desc_Destroy( &descX );
(void)args;
return info_global;
}
/**
********************************************************************************
*
......@@ -1591,6 +1663,33 @@ int check_ztrtri( run_arg_list_t *args, cham_mtxtype_t matrix_type, cham_uplo_t
return info_global;
}
int check_ztrtri_std( run_arg_list_t *args, cham_mtxtype_t matrix_type, cham_uplo_t uplo, cham_diag_t diag,
int N, CHAMELEON_Complex64_t *A0, CHAMELEON_Complex64_t *Ai, int LDA )
{
int info_global;
CHAM_desc_t *descA0, *descAi;
int P = parameters_getvalue_int( "P" );
int Q = parameters_compute_q( P );
intptr_t mtxfmt = parameters_getvalue_int( "mtxfmt" );
int nb = run_arg_get_int( args, "nb", 320 );
CHAMELEON_Desc_Create(
&descA0, (void*)(-mtxfmt), ChamComplexDouble, nb, nb, nb * nb, LDA, N, 0, 0, N, N, P, Q );
CHAMELEON_Desc_Create(
&descAi, (void*)(-mtxfmt), ChamComplexDouble, nb, nb, nb * nb, LDA, N, 0, 0, N, N, P, Q );
CHAMELEON_zLap2Desc( uplo, A0, LDA, descA0 );
CHAMELEON_zLap2Desc( uplo, Ai, LDA, descAi );
info_global = check_ztrtri( args, matrix_type, uplo, diag, descA0, descAi );
CHAMELEON_Desc_Destroy( &descA0 );
CHAMELEON_Desc_Destroy( &descAi );
(void)args;
return info_global;
}
int check_zortho( run_arg_list_t *args, CHAM_desc_t *descQ )
{
int info_local, info_global;
......
......@@ -62,10 +62,15 @@ static inline int check_ztrmm ( run_arg_list_t *args, int check_func, ch
CHAMELEON_Complex64_t alpha, CHAM_desc_t *descA, CHAM_desc_t *descB, CHAM_desc_t *descBref ) { return 0; }
static inline int check_zlauum ( run_arg_list_t *args, cham_uplo_t uplo, CHAM_desc_t *descA1, CHAM_desc_t *descA2 ) { return 0; }
static inline int check_zxxtrf ( run_arg_list_t *args, cham_mtxtype_t mtxtype, cham_uplo_t uplo, CHAM_desc_t *descA1, CHAM_desc_t *descA2 ) { return 0; }
static inline int check_zxxtrf_std ( run_arg_list_t *args, cham_mtxtype_t mtxtype, cham_uplo_t uplo, int M, int N, CHAMELEON_Complex64_t *A, CHAMELEON_Complex64_t *LU, int LDA ) { return 0; }
static inline int check_zsolve ( run_arg_list_t *args, cham_mtxtype_t mtxtype, cham_trans_t trans, cham_uplo_t uplo,
CHAM_desc_t *descA, CHAM_desc_t *descX, CHAM_desc_t *descB ) { return 0; }
static inline int check_zsolve_std ( run_arg_list_t *args, cham_mtxtype_t mtxtype, cham_trans_t trans, cham_uplo_t uplo, int N, int NRHS,
CHAMELEON_Complex64_t *A, int LDA, CHAMELEON_Complex64_t *X, CHAMELEON_Complex64_t *B, int LDB ) { return 0; }
static inline int check_ztrtri ( run_arg_list_t *args, cham_mtxtype_t mtxtype, cham_uplo_t uplo, cham_diag_t diag,
CHAM_desc_t *descA, CHAM_desc_t *descAi ) { return 0; }
static inline int check_ztrtri_std ( run_arg_list_t *args, cham_mtxtype_t matrix_type, cham_uplo_t uplo, cham_diag_t diag,
int N, CHAMELEON_Complex64_t *A0, CHAMELEON_Complex64_t *Ai, int LDA ) { return 0; }
/* Using QR factorization */
static inline int check_zortho ( run_arg_list_t *args, CHAM_desc_t *descQ ) { return 0; }
......@@ -113,10 +118,15 @@ int check_ztrmm ( run_arg_list_t *args, int check_func, cham_side_t side
CHAMELEON_Complex64_t alpha, CHAM_desc_t *descA, CHAM_desc_t *descB, CHAM_desc_t *descBref );
int check_zlauum ( run_arg_list_t *args, cham_uplo_t uplo, CHAM_desc_t *descA1, CHAM_desc_t *descA2 );
int check_zxxtrf ( run_arg_list_t *args, cham_mtxtype_t mtxtype, cham_uplo_t uplo, CHAM_desc_t *descA1, CHAM_desc_t *descA2 );
int check_zxxtrf_std ( run_arg_list_t *args, cham_mtxtype_t mtxtype, cham_uplo_t uplo, int M, int N, CHAMELEON_Complex64_t *A, CHAMELEON_Complex64_t *LU, int LDA );
int check_zsolve ( run_arg_list_t *args, cham_mtxtype_t mtxtype, cham_trans_t trans, cham_uplo_t uplo,
CHAM_desc_t *descA, CHAM_desc_t *descX, CHAM_desc_t *descB );
int check_zsolve_std ( run_arg_list_t *args, cham_mtxtype_t mtxtype, cham_trans_t trans, cham_uplo_t uplo, int N, int NRHS,
CHAMELEON_Complex64_t *A, int LDA, CHAMELEON_Complex64_t *X, CHAMELEON_Complex64_t *B, int LDB );
int check_ztrtri ( run_arg_list_t *args, cham_mtxtype_t mtxtype, cham_uplo_t uplo, cham_diag_t diag,
CHAM_desc_t *descA, CHAM_desc_t *descAi );
int check_ztrtri_std ( run_arg_list_t *args, cham_mtxtype_t matrix_type, cham_uplo_t uplo, cham_diag_t diag,
int N, CHAMELEON_Complex64_t *A0, CHAMELEON_Complex64_t *Ai, int LDA );
/* Using QR factorization */
int check_zortho ( run_arg_list_t *args, CHAM_desc_t *descQ );
......
......@@ -177,7 +177,7 @@ testing_t test_zlantr;
const char *zlantr_params[] = { "mtxfmt", "nb", "norm", "uplo", "diag",
"m", "n", "lda", "seedA", NULL };
const char *zlantr_output[] = { NULL };
const char *zlantr_outchk[] = { "RETURN", NULL };
const char *zlantr_outchk[] = { "||A||", "||B||", "||R||", "RETURN", NULL };
/**
* @brief Testing registration function
......
......@@ -122,7 +122,7 @@ testing_zpoinv_std( run_arg_list_t *args, int check )
CHAMELEON_Complex64_t *A0 = malloc( LDA * N * sizeof(CHAMELEON_Complex64_t) );
CHAMELEON_zplghe( (double)N, uplo, N, A0, LDA, seedA );
// hres += check_ztrtri( args, ChamHermitian, uplo, ChamNonUnit, descA0, descA );
hres += check_ztrtri_std( args, ChamHermitian, uplo, ChamNonUnit, N, A0, A, LDA );
free( A0 );
}
......
......@@ -142,22 +142,22 @@ testing_zposv_std( run_arg_list_t *args, int check )
/* Checks the factorisation and residue */
if ( check ) {
CHAMELEON_Complex64_t *A0 = malloc( LDA*N*sizeof(CHAMELEON_Complex64_t) );
CHAMELEON_Complex64_t *X0 = malloc( LDB*NRHS*sizeof(CHAMELEON_Complex64_t) );
CHAMELEON_Complex64_t *A0 = malloc( LDA*N* sizeof(CHAMELEON_Complex64_t) );
CHAMELEON_Complex64_t *B = malloc( LDB*NRHS*sizeof(CHAMELEON_Complex64_t) );
/* Check the factorization */
CHAMELEON_zplghe( (double)N, uplo, N, A0, LDA, seedA );
// hres += check_zxxtrf( args, ChamHermitian, uplo, descA0, descA );
hres += check_zxxtrf_std( args, ChamHermitian, uplo, N, NRHS, A0, A, LDA );
/* Check the solve */
CHAMELEON_zplrnt( N, NRHS, X0, LDB, seedB );
CHAMELEON_zplrnt( N, NRHS, B, LDB, seedB );
CHAMELEON_zplghe( (double)N, uplo, N, A0, LDA, seedA );
// hres += check_zsolve( args, ChamHermitian, ChamNoTrans, uplo, descA0, descX, descB );
hres += check_zsolve_std( args, ChamHermitian, ChamNoTrans, uplo, N, NRHS, A0, LDA, X, B, LDB );
free( A0 );
free( X0 );
free( B );
}
free( A );
......@@ -170,7 +170,7 @@ testing_t test_zposv;
const char *zposv_params[] = { "mtxfmt", "nb", "uplo", "n", "nrhs",
"lda", "ldb", "seedA", "seedB", NULL };
const char *zposv_output[] = { NULL };
const char *zposv_outchk[] = { "RETURN", NULL };
const char *zposv_outchk[] = { "||A||", "||A-fact(A)||", "||X||", "||B||", "||Ax-b||", "||Ax-b||/N/eps/(||A||||x||+||b||", "RETURN", NULL };
/**
* @brief Testing registration function
......
......@@ -113,7 +113,7 @@ testing_zpotrf_std( run_arg_list_t *args, int check )
CHAMELEON_Complex64_t *A0 = malloc( LDA * N * sizeof(CHAMELEON_Complex64_t) );
CHAMELEON_zplghe( (double)N, uplo, N, A0, LDA, seedA );
// hres += check_zxxtrf( args, ChamHermitian, uplo, A0, A );
hres += check_zxxtrf_std( args, ChamHermitian, uplo, N, N, A0, A, LDA );
free( A0 );
}
......
......@@ -121,7 +121,7 @@ testing_zpotri_std( run_arg_list_t *args, int check )
CHAMELEON_Complex64_t *A0 = malloc( LDA*N*sizeof(CHAMELEON_Complex64_t) );
CHAMELEON_zplghe( (double)N, uplo, N, A0, LDA, seedA );
// hres += check_ztrtri( args, ChamHermitian, uplo, ChamNonUnit, descA0, descA );
hres += check_ztrtri_std( args, ChamHermitian, uplo, ChamNonUnit, N, A0, A, LDA );
free( A0 );
}
......
......@@ -117,7 +117,7 @@ testing_zpotrs_std( run_arg_list_t *args, int check )
CHAMELEON_Set( CHAMELEON_TILE_SIZE, nb );
/* Creates the matrices */
A = malloc( LDA*N*sizeof(CHAMELEON_Complex64_t) );
A = malloc( LDA*N* sizeof(CHAMELEON_Complex64_t) );
X = malloc( LDB*NRHS*sizeof(CHAMELEON_Complex64_t) );
/* Fills the matrix with random values */
......@@ -135,16 +135,16 @@ testing_zpotrs_std( run_arg_list_t *args, int check )
/* Checks the factorisation and residue */
if ( check ) {
CHAMELEON_Complex64_t *A0 = malloc( LDA*N*sizeof(CHAMELEON_Complex64_t) );
CHAMELEON_Complex64_t *X0 = malloc( LDB*NRHS*sizeof(CHAMELEON_Complex64_t) );
CHAMELEON_Complex64_t *A0 = malloc( LDA*N* sizeof(CHAMELEON_Complex64_t) );
CHAMELEON_Complex64_t *B = malloc( LDB*NRHS*sizeof(CHAMELEON_Complex64_t) );
CHAMELEON_zplghe( (double)N, uplo, N, A0, LDA, seedA );
CHAMELEON_zplrnt( N, NRHS, X0, LDB, seedB );
CHAMELEON_zplrnt( N, NRHS, B, LDB, seedB );
// hres += check_zsolve( args, ChamHermitian, ChamNoTrans, uplo, descA0, descX, descB );
hres += check_zsolve_std( args, ChamHermitian, ChamNoTrans, uplo, N, NRHS, A0, LDA, X, B, LDB );
free( A0 );
free( X0 );
free( B );
}
free( A );
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment