Mentions légales du service

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

Merge branch 'testing/modular_accuracy' into 'master'

Enable modular accuracy to validate the tests

See merge request !352
parents dae9f993 008c075f
No related branches found
No related tags found
1 merge request!352Enable modular accuracy to validate the tests
......@@ -158,6 +158,11 @@ int main (int argc, char **argv) {
testing_options_init( &options );
#if !defined(CHAMELEON_SIMULATION)
/* Let's initialize the accuracy for the checks */
testing_setaccuracy( LAPACKE_dlamch_work('e') );
#endif
rc = CHAMELEON_Init( options.threads, options.gpus );
if ( rc != CHAMELEON_SUCCESS ) {
fprintf( stderr, "CHAMELEON_Init failed and returned %d.\n", rc );
......
......@@ -100,9 +100,9 @@ static inline int check_zqc_std ( run_arg_list_t *args, cham_side_t side,
CHAMELEON_Complex64_t *C, CHAMELEON_Complex64_t *CC, int LDC, CHAMELEON_Complex64_t *Q, int LDQ ) { return 0; }
/* SVD check */
static inline int check_zgesvd_std ( run_arg_list_t *args, cham_job_t jobu, cham_job_t jobvt, int M, int N, CHAMELEON_Complex64_t *Ainit, CHAMELEON_Complex64_t *A, int LDA,
static inline int check_zgesvd_std ( run_arg_list_t *args, cham_job_t jobu, cham_job_t jobvt, int M, int N, CHAMELEON_Complex64_t *Ainit, CHAMELEON_Complex64_t *A, int LDA,
double *Sinit, double *S, CHAMELEON_Complex64_t *U, int LDU, CHAMELEON_Complex64_t *Vt, int LDVt ) { return 0; }
static inline int check_zgesvd ( run_arg_list_t *args, cham_job_t jobu, cham_job_t jobvt, CHAM_desc_t *descAinit, CHAM_desc_t *descA,
static inline int check_zgesvd ( run_arg_list_t *args, cham_job_t jobu, cham_job_t jobvt, CHAM_desc_t *descAinit, CHAM_desc_t *descA,
double *Sinit, double *S, CHAMELEON_Complex64_t *U, int LDU, CHAMELEON_Complex64_t *Vt, int LDVt ) { return 0; }
/* Polar decomposition check */
......@@ -179,9 +179,9 @@ int check_zqc_std ( run_arg_list_t *args, cham_side_t side, cham_trans_t t
CHAMELEON_Complex64_t *C, CHAMELEON_Complex64_t *CC, int LDC, CHAMELEON_Complex64_t *Q, int LDQ );
/* SVD check */
int check_zgesvd_std ( run_arg_list_t *args, cham_job_t jobu, cham_job_t jobvt, int M, int N, CHAMELEON_Complex64_t *Ainit, CHAMELEON_Complex64_t *A, int LDA,
int check_zgesvd_std ( run_arg_list_t *args, cham_job_t jobu, cham_job_t jobvt, int M, int N, CHAMELEON_Complex64_t *Ainit, CHAMELEON_Complex64_t *A, int LDA,
double *Sinit, double *S, CHAMELEON_Complex64_t *U, int LDU, CHAMELEON_Complex64_t *Vt, int LDVt );
int check_zgesvd ( run_arg_list_t *args, cham_job_t jobu, cham_job_t jobvt, CHAM_desc_t *descAinit, CHAM_desc_t *descA,
int check_zgesvd ( run_arg_list_t *args, cham_job_t jobu, cham_job_t jobvt, CHAM_desc_t *descAinit, CHAM_desc_t *descA,
double *Sinit, double *S, CHAMELEON_Complex64_t *U, int LDU, CHAMELEON_Complex64_t *Vt, int LDVt );
/* Polar decomposition check */
int check_zgepdf_qr ( run_arg_list_t *args, CHAM_desc_t *descA1, CHAM_desc_t *descA2,
......
......@@ -81,7 +81,7 @@ int check_zmatrices_std( run_arg_list_t *args, cham_uplo_t uplo, int M, int N, C
{
int info_solution = 0;
double Anorm, Rnorm, result;
double eps = LAPACKE_dlamch_work('e');
cham_fixdbl_t eps = testing_getaccuracy();
double *work = (double *)malloc( LDA*N*sizeof(double) );
......@@ -237,7 +237,7 @@ int check_znorm_std( run_arg_list_t *args, cham_mtxtype_t matrix_type, cham_norm
double *work = (double*) malloc(chameleon_max(M, N)*sizeof(double));
double norm_lapack;
double result;
double eps = LAPACKE_dlamch_work('e');
cham_fixdbl_t eps = testing_getaccuracy();
/* Computes the norm with the LAPACK function */
switch (matrix_type) {
......@@ -427,7 +427,7 @@ int check_zsum_std( run_arg_list_t *args, cham_uplo_t uplo, cham_trans_t trans,
Binitnorm = LAPACKE_zlantr( LAPACK_COL_MAJOR, 'M', chameleon_lapack_const(uplo), 'N', M, N, Bref, LDB );
}
double eps = LAPACKE_dlamch_work('e');
cham_fixdbl_t eps = testing_getaccuracy();
double *work = malloc(chameleon_max(M, N)* sizeof(double));
/* Makes the sum with the core function */
......@@ -690,7 +690,7 @@ int check_zrankk_std( run_arg_list_t *args, int M, int N, int K, CHAMELEON_Compl
int info_solution = 0;
int minMN = chameleon_min(M, N);
double Anorm, Rnorm, result;
double eps = LAPACKE_dlamch_work('e');
cham_fixdbl_t eps = testing_getaccuracy();
Anorm = LAPACKE_zlange( LAPACK_COL_MAJOR, 'F', M, N, A, LDA );
......
......@@ -119,7 +119,7 @@ int check_zgemm_std( run_arg_list_t *args, cham_trans_t transA, cham_trans_t tra
/* Computes the norms for comparing */
Crefnorm = LAPACKE_zlange_work( LAPACK_COL_MAJOR, 'M', M, N, Cref, LDC, NULL );
double eps = LAPACKE_dlamch_work('e');
cham_fixdbl_t eps = testing_getaccuracy();
/* Makes the multiplication with the core function */
cblas_zgemm( CblasColMajor, (CBLAS_TRANSPOSE)transA, (CBLAS_TRANSPOSE)transB, M, N, K,
......@@ -331,7 +331,7 @@ int check_zsymm_std( run_arg_list_t *args, cham_mtxtype_t matrix_type, cham_side
Crefnorm = LAPACKE_zlange_work( LAPACK_COL_MAJOR, 'M', M, N, Cref, LDC, NULL );
Cchamnorm = LAPACKE_zlange_work( LAPACK_COL_MAJOR, 'M', M, N, C, LDC, NULL );
double eps = LAPACKE_dlamch_work('e');
cham_fixdbl_t eps = testing_getaccuracy();
/* Makes the multiplication with the core function */
#if defined(PRECISION_z) || defined(PRECISION_c)
......@@ -552,7 +552,7 @@ int check_zsyrk_std( run_arg_list_t *args, cham_mtxtype_t matrix_type, cham_uplo
Cchamnorm = LAPACKE_zlansy_work( LAPACK_COL_MAJOR, 'I', chameleon_lapack_const(uplo), N, C, LDC, work );
}
double eps = LAPACKE_dlamch_work('e');
cham_fixdbl_t eps = testing_getaccuracy();
double ABnorm;
/* Makes the multiplication with the core function */
......@@ -787,7 +787,7 @@ int check_ztrmm_std( run_arg_list_t *args, int check_func, cham_side_t side, cha
double Anorm, Bnorm, Rnorm, result;
char normTypeA, normTypeB;
double *work;
double eps = LAPACKE_dlamch_work('e');
cham_fixdbl_t eps = testing_getaccuracy();
/* Computes the norms for comparing */
if ( side == ChamLeft ) {
......
......@@ -28,7 +28,6 @@
#if !defined(CHAMELEON_SIMULATION)
#include <coreblas/lapacke.h>
#if defined(CHAMELEON_USE_MPI)
#include <mpi.h>
#endif
......@@ -66,7 +65,7 @@ int check_zlauum( run_arg_list_t *args, cham_uplo_t uplo, CHAM_desc_t *descA, CH
{
int info_local, info_global;
int N = descA->n;
double eps = LAPACKE_dlamch_work('e');
cham_fixdbl_t eps = testing_getaccuracy();
double result, Anorm, AAtnorm, Rnorm;
CHAM_desc_t *descAt;
......@@ -202,7 +201,7 @@ int check_zxxtrf( run_arg_list_t *args, cham_mtxtype_t matrix_type, cham_uplo_t
int M = descA->m;
int N = descA->n;
double Anorm, Rnorm, result;
double eps = LAPACKE_dlamch_work('e');
cham_fixdbl_t eps = testing_getaccuracy();
CHAM_desc_t *descL, *descU;
cham_trans_t transL = ChamNoTrans;
......@@ -396,7 +395,7 @@ int check_zsolve( run_arg_list_t *args, cham_mtxtype_t matrix_type, cham_trans_t
int M = descA->m;
int N = descA->n;
double Anorm, Bnorm, Xnorm, Rnorm, result = 0;
double eps = LAPACKE_dlamch_work('e');
cham_fixdbl_t eps = testing_getaccuracy();
cham_normtype_t norm = (trans == ChamNoTrans) ? ChamOneNorm : ChamInfNorm;
/* Computes the norms */
......@@ -559,7 +558,7 @@ int check_ztrtri( run_arg_list_t *args, cham_mtxtype_t matrix_type, cham_uplo_t
cham_uplo_t uplo_inv;
CHAM_desc_t *descI, *descB = NULL;
double Rnorm, Anorm, Ainvnorm, result;
double eps = LAPACKE_dlamch_work('e');
cham_fixdbl_t eps = testing_getaccuracy();
int N = descA0->m;
/* Creates an identity matrix */
......
......@@ -28,7 +28,6 @@
#if !defined(CHAMELEON_SIMULATION)
#include <coreblas/lapacke.h>
#if defined(CHAMELEON_USE_MPI)
#include <mpi.h>
#endif
......@@ -79,7 +78,7 @@ int check_zgepdf_qr( run_arg_list_t *args, CHAM_desc_t *descA1, CHAM_desc_t *des
int N = descQ1->n;
int K = descAF1->n;
double result, Anorm, A1norm, A2norm, Rnorm;
double eps = LAPACKE_dlamch_work('e');
cham_fixdbl_t eps = testing_getaccuracy();
CHAM_desc_t *descR, *subR, *subAF;
/*
......@@ -187,7 +186,7 @@ int check_zxxpd( run_arg_list_t *args,
{
int info_local, info_global;
double Anorm, Rnorm, result;
double eps = LAPACKE_dlamch_work('e');
cham_fixdbl_t eps = testing_getaccuracy();
/* Compute ||A|| */
Anorm = CHAMELEON_zlange_Tile( ChamFrobeniusNorm, descA );
......
......@@ -28,7 +28,6 @@
#if !defined(CHAMELEON_SIMULATION)
#include <coreblas/lapacke.h>
#if defined(CHAMELEON_USE_MPI)
#include <mpi.h>
#endif
......@@ -59,7 +58,7 @@ int check_zortho( run_arg_list_t *args, CHAM_desc_t *descQ )
int N = descQ->n;
int minMN = chameleon_min(M, N);
double result, normR;
double eps = LAPACKE_dlamch_work('e');
cham_fixdbl_t eps = testing_getaccuracy();
CHAM_desc_t *descI, *subI;
/* Builds the identity */
......@@ -176,7 +175,7 @@ int check_zgelqf( run_arg_list_t *args, CHAM_desc_t *descA, CHAM_desc_t *descAF,
int N = descQ->n;
int K = chameleon_min( descA->m, descA->n );
double result, Anorm, Rnorm;
double eps = LAPACKE_dlamch_work('e');
cham_fixdbl_t eps = testing_getaccuracy();
CHAM_desc_t *descL;
int full_lq = ( M == N ) ? 1 : 0;
......@@ -347,7 +346,7 @@ int check_zgeqrf( run_arg_list_t *args, CHAM_desc_t *descA, CHAM_desc_t *descAF,
int N = descQ->n;
int K = chameleon_min( descA->m, descA->n );
double result, Anorm, Rnorm;
double eps = LAPACKE_dlamch_work('e');
cham_fixdbl_t eps = testing_getaccuracy();
CHAM_desc_t *descR;
int full_qr = ( M == N ) ? 1 : 0;
......@@ -523,7 +522,7 @@ int check_zqc( run_arg_list_t *args, cham_side_t side, cham_trans_t trans,
int info_local, info_global;
int M = descQ->m;
double Cnorm, Qnorm, CCnorm, Rnorm, result;
double eps = LAPACKE_dlamch_work('e');
cham_fixdbl_t eps = testing_getaccuracy();
Cnorm = CHAMELEON_zlange_Tile( ChamOneNorm, descC );
Qnorm = CHAMELEON_zlange_Tile( ChamOneNorm, descQ );
......@@ -667,7 +666,7 @@ int check_zgeqrs( run_arg_list_t *args, cham_trans_t trans, CHAM_desc_t *descA,
int maxMNK = chameleon_max( M, chameleon_max( N, NRHS ) );
double Rnorm, result;
double Anorm = CHAMELEON_zlange_Tile( ChamOneNorm, descA );
double eps = LAPACKE_dlamch_work('e');
cham_fixdbl_t eps = testing_getaccuracy();
CHAMELEON_Get( CHAMELEON_TILE_SIZE, &nb );
......@@ -753,7 +752,7 @@ int check_zgelqs( run_arg_list_t *args, cham_trans_t trans, CHAM_desc_t *descA,
int maxMNK = chameleon_max( M, chameleon_max( N, NRHS ) );
double Rnorm, result;
double Anorm = CHAMELEON_zlange_Tile( ChamOneNorm, descA );
double eps = LAPACKE_dlamch_work('e');
cham_fixdbl_t eps = testing_getaccuracy();
CHAMELEON_Get( CHAMELEON_TILE_SIZE, &nb );
......@@ -879,13 +878,13 @@ int check_zgels( run_arg_list_t *args, cham_trans_t trans, CHAM_desc_t *descA, C
*
* @param[in] X
* The matrix X.
*
*
* @param[in] LDX
* The leading dimension of the matrix X.
*
* @param[in] B
* The matrix B.
*
*
* @param[in] LDB
* The leading dimension fo the matrix B.
*
......
......@@ -24,7 +24,6 @@
#if !defined(CHAMELEON_SIMULATION)
#include <coreblas/lapacke.h>
#if defined(CHAMELEON_USE_MPI)
#include <mpi.h>
#endif
......@@ -38,7 +37,7 @@
* @ingroup testing
*
* @brief Checks if the Chameleon SVD algorithm works: Ainit = U * mat( S ) * Vt.
* - U and Vt should be orthogonal.
* - U and Vt should be orthogonal.
* - Sinit and S should be the same.
* - Ainit = U * mat( S ) * Vt.
*
......@@ -46,7 +45,7 @@
*
* @param[in] jobu
* Specifies options for computing all or part of the matrix U.
*
*
* @param[in] jobvt
* Specifies options for computing all or part of the matrix V^H.
*
......@@ -58,22 +57,22 @@
*
* @param[in] Ainit
* The matrix Ainit (initial matrix A).
*
*
* @param[in] A
* The matrix A after the SVD, can contain parts of the matrix U or Vt
* The matrix A after the SVD, can contain parts of the matrix U or Vt
* or nothing (depending on the values of jobu and jobvt).
*
* @param[in] LDA
* The leading dimension of the matrices A and Ainit.
*
* @param[in] Sinit
* The vector with the singular values of the matrix Ainit
* The vector with the singular values of the matrix Ainit
* (contains the K = min(M, N) singular values of Ainit).
*
*
* @param[in] S
* The vector with the singular values of the matrix Ainit
* The vector with the singular values of the matrix Ainit
* computed by the Chameleon SVD algorithm.
*
*
* @param[in] U
* The orthogonal matrix U computed by the Chameleon SVD algorithm can
* contain all of U, a part of U or nothing (NULL) depending on the value of jobu;
......@@ -98,14 +97,14 @@
*
*******************************************************************************
*/
int check_zgesvd_std( run_arg_list_t *args, cham_job_t jobu, cham_job_t jobvt, int M, int N, CHAMELEON_Complex64_t *Ainit, CHAMELEON_Complex64_t *A, int LDA,
int check_zgesvd_std( run_arg_list_t *args, cham_job_t jobu, cham_job_t jobvt, int M, int N, CHAMELEON_Complex64_t *Ainit, CHAMELEON_Complex64_t *A, int LDA,
double *Sinit, double *S, CHAMELEON_Complex64_t *U, int LDU, CHAMELEON_Complex64_t *Vt, int LDVt )
{
int info_solution = 0;
double result;
int k;
int K = chameleon_min(M, N);
double eps = LAPACKE_dlamch_work('e');
cham_fixdbl_t eps = testing_getaccuracy();
/* Checks if U is orthogonal */
switch ( jobu ) {
......@@ -174,7 +173,7 @@ int check_zgesvd_std( run_arg_list_t *args, cham_job_t jobu, cham_job_t jobvt, i
* @ingroup testing
*
* @brief Checks if the Chameleon SVD algorithm works: descAinit = U * mat( S ) * Vt.
* - U and Vt should be orthogonal.
* - U and Vt should be orthogonal.
* - Sinit and S should be the same.
* - descAinit = U * mat( S ) * Vt.
*
......@@ -182,25 +181,25 @@ int check_zgesvd_std( run_arg_list_t *args, cham_job_t jobu, cham_job_t jobvt, i
*
* @param[in] jobu
* Specifies options for computing all or part of the matrix U.
*
*
* @param[in] jobvt
* Specifies options for computing all or part of the matrix V^H.
*
* @param[in] descAinit
* The descriptor of the matrix Ainit (initial matrix A).
*
*
* @param[in] descA
* The descriptor of the matrix A after the SVD, can contain parts of the matrix
* The descriptor of the matrix A after the SVD, can contain parts of the matrix
* U or Vt or nothing (depending on the values of jobu and jobvt).
*
* @param[in] Sinit
* The vector with the singular values of the matrix Ainit
* The vector with the singular values of the matrix Ainit
* (contains the K = min(M, N) singular values of Ainit).
*
*
* @param[in] S
* The vector with the singular values of the matrix Ainit
* The vector with the singular values of the matrix Ainit
* computed by the Chameleon SVD algorithm.
*
*
* @param[in] U
* The orthogonal matrix U computed by the Chameleon SVD algorithm can
* contain all of U, a part of U or nothing (NULL) depending on the value of jobu;
......@@ -225,7 +224,7 @@ int check_zgesvd_std( run_arg_list_t *args, cham_job_t jobu, cham_job_t jobvt, i
*
*******************************************************************************
*/
int check_zgesvd( run_arg_list_t *args, cham_job_t jobu, cham_job_t jobvt, CHAM_desc_t *descAinit, CHAM_desc_t *descA,
int check_zgesvd( run_arg_list_t *args, cham_job_t jobu, cham_job_t jobvt, CHAM_desc_t *descAinit, CHAM_desc_t *descA,
double *Sinit, double *S, CHAMELEON_Complex64_t *U, int LDU, CHAMELEON_Complex64_t *Vt, int LDVt )
{
int info_solution;
......
......@@ -24,6 +24,11 @@ extern testing_options_t options;
*/
static testing_t *testings = NULL;
/**
* @brief Accuracy required to validate the tests
*/
static cham_fixdbl_t testing_accuracy = -1.;
/**
* @brief Function to register a new testing
*/
......@@ -227,3 +232,32 @@ testing_stop( testdata_t *tdata, cham_fixdbl_t flops )
CHAMELEON_Resume();
#endif
}
/**
* @brief Return the accuracy wanted to validate the tests
*/
cham_fixdbl_t
testing_getaccuracy()
{
#if !defined(CHAMELEON_SIMULATION)
if ( testing_accuracy < 0. ) {
fprintf( stderr, "WARNING: Accuracy has not been initialized yet. Please call testing_setaccuracy() prior to calling testing_getaccuracy()\n" );
assert( 0 );
}
#endif
return testing_accuracy;
}
/**
* @brief Set the global accuracy wanted to validate the tests
*/
void
testing_setaccuracy( cham_fixdbl_t accuracy )
{
if ( accuracy <= 0. ) {
fprintf( stderr, "WARNING: accuracy must be > 0.\n" );
return;
}
testing_accuracy = accuracy;
}
......@@ -290,4 +290,7 @@ void testing_start( testdata_t *tdata );
void testing_stop( testdata_t *tdata, cham_fixdbl_t flops );
void testing_options_init( testing_options_t *options );
cham_fixdbl_t testing_getaccuracy();
void testing_setaccuracy( cham_fixdbl_t accuracy );
#endif /* _testings_h_ */
......@@ -116,6 +116,11 @@ int main (int argc, char **argv) {
testing_options_init( &options );
#if !defined(CHAMELEON_SIMULATION)
/* Let's initialize the accuracy for the checks */
testing_setaccuracy( LAPACKE_dlamch_work('e') );
#endif
rc = CHAMELEON_Init( options.threads, 0 );
if ( rc != CHAMELEON_SUCCESS ) {
fprintf( stderr, "CHAMELEON_Init failed and returned %d.\n", rc );
......
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