From 3ecff0dfc63ac0f1cea83f1113e2cecde162d6fb Mon Sep 17 00:00:00 2001 From: Mathieu Faverge <mathieu.faverge@inria.fr> Date: Mon, 5 Feb 2018 19:04:42 +0100 Subject: [PATCH] Remove COMPLEX/REAL from testings --- testing/testing_zauxiliary.c | 6 +- testing/testing_zgeadd.c | 7 +- testing/testing_zgels.c | 3 - testing/testing_zgels_hqr.c | 3 - testing/testing_zgels_systolic.c | 3 - testing/testing_zgemm.c | 5 +- testing/testing_zgeqrf_qdwh.c | 3 - testing/testing_zher2k.c | 18 ++-- testing/testing_zlange.c | 161 +++++++++++++++---------------- testing/testing_zpemv.c | 5 +- testing/testing_zsyr2k.c | 18 ++-- testing/testing_ztrmm.c | 5 +- testing/testing_ztrsm.c | 5 +- 13 files changed, 104 insertions(+), 138 deletions(-) diff --git a/testing/testing_zauxiliary.c b/testing/testing_zauxiliary.c index cf2db1c2c..eebc0fe5d 100644 --- a/testing/testing_zauxiliary.c +++ b/testing/testing_zauxiliary.c @@ -28,10 +28,6 @@ #include <sys/resource.h> #endif #include <morse.h> -#undef REAL -#define COMPLEX -#undef SINGLE -#define DOUBLE #include "testing_zauxiliary.h" int IONE = 1; @@ -199,7 +195,7 @@ int main (int argc, char **argv) else if ( strcmp(func, "GEMM") == 0 ) { info += testing_zgemm( argc, argv ); } -#ifdef COMPLEX +#if defined(PRECISION_z) || defined(PRECISION_c) else if ( strcmp(func, "HEMM") == 0 ) { info += testing_zhemm( argc, argv ); } diff --git a/testing/testing_zgeadd.c b/testing/testing_zgeadd.c index b6744ecd6..ae417b1f9 100644 --- a/testing/testing_zgeadd.c +++ b/testing/testing_zgeadd.c @@ -35,9 +35,6 @@ #include <mpi.h> #endif -#undef REAL -#define COMPLEX - static int check_tr_solution(MORSE_enum uplo, MORSE_enum trans, int M, int N, MORSE_Complex64_t alpha, MORSE_Complex64_t *A, int LDA, MORSE_Complex64_t beta, MORSE_Complex64_t *Bref, MORSE_Complex64_t *Bmorse, int LDB); @@ -105,7 +102,7 @@ int testing_zgeadd(int argc, char **argv) LAPACKE_zlarnv_work(IONE, ISEED, LDAxN, A); LAPACKE_zlarnv_work(IONE, ISEED, LDBxN, B); -#ifdef COMPLEX +#if defined(PRECISION_z) || defined(PRECISION_c) for (t=0; t<3; t++) { #else for (t=0; t<2; t++) { @@ -143,7 +140,7 @@ int testing_zgeadd(int argc, char **argv) LAPACKE_zlarnv_work(IONE, ISEED, LDAxN, A); LAPACKE_zlarnv_work(IONE, ISEED, LDBxN, B); -#ifdef COMPLEX +#if defined(PRECISION_z) || defined(PRECISION_c) for (t=0; t<3; t++) { #else for (t=0; t<2; t++) { diff --git a/testing/testing_zgels.c b/testing/testing_zgels.c index 51859d37c..1259502af 100644 --- a/testing/testing_zgels.c +++ b/testing/testing_zgels.c @@ -34,9 +34,6 @@ #include <coreblas.h> #include "testing_zauxiliary.h" -#undef REAL -#define COMPLEX - enum blas_order_type { blas_rowmajor = 101, blas_colmajor = 102 }; diff --git a/testing/testing_zgels_hqr.c b/testing/testing_zgels_hqr.c index 97c32a771..9583e5413 100644 --- a/testing/testing_zgels_hqr.c +++ b/testing/testing_zgels_hqr.c @@ -30,9 +30,6 @@ #include <coreblas.h> #include "testing_zauxiliary.h" -#undef REAL -#define COMPLEX - static int check_orthogonality(int, int, int, MORSE_Complex64_t*, double); static int check_factorization(int, int, MORSE_Complex64_t*, MORSE_Complex64_t*, int, MORSE_Complex64_t*, double); static int check_solution(int, int, int, MORSE_Complex64_t*, int, MORSE_Complex64_t*, MORSE_Complex64_t*, int, double); diff --git a/testing/testing_zgels_systolic.c b/testing/testing_zgels_systolic.c index 9726b5a59..600c3b142 100644 --- a/testing/testing_zgels_systolic.c +++ b/testing/testing_zgels_systolic.c @@ -30,9 +30,6 @@ #include <coreblas.h> #include "testing_zauxiliary.h" -#undef REAL -#define COMPLEX - static int check_orthogonality(int, int, int, MORSE_Complex64_t*, double); static int check_factorization(int, int, MORSE_Complex64_t*, MORSE_Complex64_t*, int, MORSE_Complex64_t*, double); static int check_solution(int, int, int, MORSE_Complex64_t*, int, MORSE_Complex64_t*, MORSE_Complex64_t*, int, double); diff --git a/testing/testing_zgemm.c b/testing/testing_zgemm.c index ec2948c51..44336fef7 100644 --- a/testing/testing_zgemm.c +++ b/testing/testing_zgemm.c @@ -35,9 +35,6 @@ #include <mpi.h> #endif -#undef REAL -#define COMPLEX - static int check_solution(MORSE_enum transA, MORSE_enum transB, int M, int N, int K, MORSE_Complex64_t alpha, MORSE_Complex64_t *A, int LDA, MORSE_Complex64_t *B, int LDB, @@ -113,7 +110,7 @@ int testing_zgemm(int argc, char **argv) LAPACKE_zlarnv_work(IONE, ISEED, LDBxN, B); LAPACKE_zlarnv_work(IONE, ISEED, LDCxN, C); -#ifdef COMPLEX +#if defined(PRECISION_z) || defined(PRECISION_c) for (ta=0; ta<3; ta++) { for (tb=0; tb<3; tb++) { #else diff --git a/testing/testing_zgeqrf_qdwh.c b/testing/testing_zgeqrf_qdwh.c index c669f2167..6047451cb 100644 --- a/testing/testing_zgeqrf_qdwh.c +++ b/testing/testing_zgeqrf_qdwh.c @@ -35,9 +35,6 @@ #include <coreblas/coreblas_z.h> #include "testing_zauxiliary.h" -#undef REAL -#define COMPLEX - static int check_orthogonality(int, int, const MORSE_Complex64_t*, int, double); static int check_factorization(int, int, const MORSE_Complex64_t*, int, const MORSE_Complex64_t*, int, MORSE_Complex64_t*, int, double); diff --git a/testing/testing_zher2k.c b/testing/testing_zher2k.c index f20412112..d53ba235a 100644 --- a/testing/testing_zher2k.c +++ b/testing/testing_zher2k.c @@ -33,7 +33,7 @@ #include "testing_zauxiliary.h" static int check_solution(MORSE_enum uplo, MORSE_enum trans, int N, int K, - MORSE_Complex64_t alpha, MORSE_Complex64_t *A, int LDA, + MORSE_Complex64_t alpha, MORSE_Complex64_t *A, int LDA, MORSE_Complex64_t *B, int LDB, double beta, MORSE_Complex64_t *Cref, MORSE_Complex64_t *Cmorse, int LDC); @@ -112,12 +112,12 @@ int testing_zher2k(int argc, char **argv) memcpy(Cinit, C, LDCxN*sizeof(MORSE_Complex64_t)); memcpy(Cfinal, C, LDCxN*sizeof(MORSE_Complex64_t)); - + /* MORSE ZHER2K */ MORSE_zher2k(uplo[u], trans[t], N, K, alpha, A, LDA, B, LDB, beta, Cfinal, LDC); /* Check the solution */ - info_solution = check_solution(uplo[u], trans[t], N, K, + info_solution = check_solution(uplo[u], trans[t], N, K, alpha, A, LDA, B, LDB, beta, Cinit, Cfinal, LDC); if (info_solution == 0) { @@ -156,16 +156,16 @@ static int check_solution(MORSE_enum uplo, MORSE_enum trans, int N, int K, double *work = (double *)malloc(max(N, K)* sizeof(double)); beta_const = -1.0; - Anorm = LAPACKE_zlange_work(LAPACK_COL_MAJOR, 'I', - (trans == MorseNoTrans) ? N : K, + Anorm = LAPACKE_zlange_work(LAPACK_COL_MAJOR, 'I', + (trans == MorseNoTrans) ? N : K, (trans == MorseNoTrans) ? K : N, A, LDA, work); - Bnorm = LAPACKE_zlange_work(LAPACK_COL_MAJOR, 'I', - (trans == MorseNoTrans) ? N : K, + Bnorm = LAPACKE_zlange_work(LAPACK_COL_MAJOR, 'I', + (trans == MorseNoTrans) ? N : K, (trans == MorseNoTrans) ? K : N, B, LDB, work); Cinitnorm = LAPACKE_zlange_work(LAPACK_COL_MAJOR, 'I', N, N, Cref, LDC, work); Cmorsenorm = LAPACKE_zlange_work(LAPACK_COL_MAJOR, 'I', N, N, Cmorse, LDC, work); - cblas_zher2k(CblasColMajor, (CBLAS_UPLO)uplo, (CBLAS_TRANSPOSE)trans, + cblas_zher2k(CblasColMajor, (CBLAS_UPLO)uplo, (CBLAS_TRANSPOSE)trans, N, K, CBLAS_SADDR(alpha), A, LDA, B, LDB, (beta), Cref, LDC); Clapacknorm = LAPACKE_zlange_work(LAPACK_COL_MAJOR, 'I', N, N, Cref, LDC, work); @@ -175,7 +175,7 @@ static int check_solution(MORSE_enum uplo, MORSE_enum trans, int N, int K, Rnorm = LAPACKE_zlange_work(LAPACK_COL_MAJOR, 'I', N, N, Cref, LDC, work); eps = LAPACKE_dlamch_work('e'); - + printf("Rnorm %e, Anorm %e, Cinitnorm %e, Cmorsenorm %e, Clapacknorm %e\n", Rnorm, Anorm, Cinitnorm, Cmorsenorm, Clapacknorm); diff --git a/testing/testing_zlange.c b/testing/testing_zlange.c index 8921f7c0e..859393db9 100644 --- a/testing/testing_zlange.c +++ b/testing/testing_zlange.c @@ -31,9 +31,6 @@ #include <coreblas.h> #include "testing_zauxiliary.h" -#undef REAL -#define COMPLEX - int testing_zlange(int argc, char **argv) { int hres = 0; @@ -111,50 +108,50 @@ int testing_zlange(int argc, char **argv) } - #ifdef COMPLEX - /* MORSE ZLANTR */ - for(n=1; n<3; n++) { - for(u=0; u<2; u++) { - int d; - for(d=0; d<2; d++) { - normmorse = MORSE_zlantr(norm[n], uplo[u], diag[d], M, N, A, LDA); - normlapack = LAPACKE_zlantr_work(LAPACK_COL_MAJOR, morse_lapack_const(norm[n]), morse_lapack_const(uplo[u]), - morse_lapack_const(diag[d]), M, N, A, LDA, work); - printf("LAPACK %e, CHAMELEON %e\n", normlapack, normmorse); - - result = fabs(normmorse - normlapack) / (normlapack * eps); - switch(norm[n]) { - case MorseMaxNorm: - /* result should be perfectly equal */ - break; - case MorseInfNorm: - /* Sum order on the line can differ */ - result = result / (double)N; - break; - case MorseOneNorm: - /* Sum order on the column can differ */ - result = result / (double)M; - break; - case MorseFrobeniusNorm: - /* Sum oreder on every element can differ */ - result = result / ((double)M * (double)N); - break; - } - - printf("***************************************************\n"); - if ( result < 1. ) { - printf(" ---- TESTING ZLANTR (%s, %s, %s)......... PASSED !\n", - normstr[n], uplostr[u], diagstr[d]); - } - else { - printf(" - TESTING ZLANTR (%s, %s, %s)... FAILED !\n", - normstr[n], uplostr[u], diagstr[d]); - } - printf("***************************************************\n"); +#if defined(PRECISION_z) || defined(PRECISION_c) + /* MORSE ZLANTR */ + for(n=1; n<3; n++) { + for(u=0; u<2; u++) { + int d; + for(d=0; d<2; d++) { + normmorse = MORSE_zlantr(norm[n], uplo[u], diag[d], M, N, A, LDA); + normlapack = LAPACKE_zlantr_work(LAPACK_COL_MAJOR, morse_lapack_const(norm[n]), morse_lapack_const(uplo[u]), + morse_lapack_const(diag[d]), M, N, A, LDA, work); + printf("LAPACK %e, CHAMELEON %e\n", normlapack, normmorse); + + result = fabs(normmorse - normlapack) / (normlapack * eps); + switch(norm[n]) { + case MorseMaxNorm: + /* result should be perfectly equal */ + break; + case MorseInfNorm: + /* Sum order on the line can differ */ + result = result / (double)N; + break; + case MorseOneNorm: + /* Sum order on the column can differ */ + result = result / (double)M; + break; + case MorseFrobeniusNorm: + /* Sum oreder on every element can differ */ + result = result / ((double)M * (double)N); + break; } + + printf("***************************************************\n"); + if ( result < 1. ) { + printf(" ---- TESTING ZLANTR (%s, %s, %s)......... PASSED !\n", + normstr[n], uplostr[u], diagstr[d]); + } + else { + printf(" - TESTING ZLANTR (%s, %s, %s)... FAILED !\n", + normstr[n], uplostr[u], diagstr[d]); + } + printf("***************************************************\n"); } } - #endif + } +#endif /* MORSE ZLANSY */ for(n=0; n<4; n++) { @@ -193,51 +190,51 @@ int testing_zlange(int argc, char **argv) } } - #ifdef COMPLEX - /* MORSE ZLANHE */ - { - int j; - for (j=0; j<min(M,N); j++) { +#if defined(PRECISION_z) || defined(PRECISION_c) + /* MORSE ZLANHE */ + { + int j; + for (j=0; j<min(M,N); j++) { A[j*LDA+j] -= I*cimag(A[j*LDA+j]); - } } + } - for(n=0; n<4; n++) { - for(u=0; u<2; u++) { - normmorse = MORSE_zlanhe(norm[n], uplo[u], min(M,N), A, LDA); - normlapack = LAPACKE_zlanhe_work(LAPACK_COL_MAJOR, morse_lapack_const(norm[n]), morse_lapack_const(uplo[u]), min(M,N), A, LDA, work); - printf("LAPACK %e, CHAMELEON %e\n", normlapack, normmorse); + for(n=0; n<4; n++) { + for(u=0; u<2; u++) { + normmorse = MORSE_zlanhe(norm[n], uplo[u], min(M,N), A, LDA); + normlapack = LAPACKE_zlanhe_work(LAPACK_COL_MAJOR, morse_lapack_const(norm[n]), morse_lapack_const(uplo[u]), min(M,N), A, LDA, work); + printf("LAPACK %e, CHAMELEON %e\n", normlapack, normmorse); - result = fabs(normmorse - normlapack) / (normlapack * eps); - switch(norm[n]) { - case MorseMaxNorm: - /* result should be perfectly equal */ - break; - case MorseInfNorm: - /* Sum order on the line can differ */ - result = result / (double)N; - break; - case MorseOneNorm: - /* Sum order on the column can differ */ - result = result / (double)M; - break; - case MorseFrobeniusNorm: - /* Sum oreder on every element can differ */ - result = result / ((double)M * (double)N); - break; - } + result = fabs(normmorse - normlapack) / (normlapack * eps); + switch(norm[n]) { + case MorseMaxNorm: + /* result should be perfectly equal */ + break; + case MorseInfNorm: + /* Sum order on the line can differ */ + result = result / (double)N; + break; + case MorseOneNorm: + /* Sum order on the column can differ */ + result = result / (double)M; + break; + case MorseFrobeniusNorm: + /* Sum oreder on every element can differ */ + result = result / ((double)M * (double)N); + break; + } - printf("***************************************************\n"); - if ( result < 1. ) { - printf(" ---- TESTING ZLANHE (%s, %s)......... PASSED !\n", normstr[n], uplostr[u]); - } - else { - printf(" - TESTING ZLANHE (%s, %s)... FAILED !\n", normstr[n], uplostr[u]); - } - printf("***************************************************\n"); + printf("***************************************************\n"); + if ( result < 1. ) { + printf(" ---- TESTING ZLANHE (%s, %s)......... PASSED !\n", normstr[n], uplostr[u]); + } + else { + printf(" - TESTING ZLANHE (%s, %s)... FAILED !\n", normstr[n], uplostr[u]); } + printf("***************************************************\n"); } - #endif + } +#endif free(A); free(work); diff --git a/testing/testing_zpemv.c b/testing/testing_zpemv.c index a816862dd..9565e8e2f 100644 --- a/testing/testing_zpemv.c +++ b/testing/testing_zpemv.c @@ -31,9 +31,6 @@ #include <coreblas.h> #include "testing_zauxiliary.h" -#define COMPLEX -#undef REAL - /*-------------------------------------------------------------- * Check the pemv */ @@ -164,7 +161,7 @@ int testing_zpemv(int argc, char **argv) } /* Colwise ConjTrans & Rowwise NoTrans */ -#ifdef COMPLEX +#if defined(PRECISION_z) || defined(PRECISION_c) for (t=0; t<3; t++) #else for (t=0; t<2; t++) diff --git a/testing/testing_zsyr2k.c b/testing/testing_zsyr2k.c index c4f1a8a4e..eec56cccf 100644 --- a/testing/testing_zsyr2k.c +++ b/testing/testing_zsyr2k.c @@ -33,7 +33,7 @@ #include "testing_zauxiliary.h" static int check_solution(MORSE_enum uplo, MORSE_enum trans, int N, int K, - MORSE_Complex64_t alpha, MORSE_Complex64_t *A, int LDA, + MORSE_Complex64_t alpha, MORSE_Complex64_t *A, int LDA, MORSE_Complex64_t *B, int LDB, MORSE_Complex64_t beta, MORSE_Complex64_t *Cref, MORSE_Complex64_t *Cmorse, int LDC); @@ -112,12 +112,12 @@ int testing_zsyr2k(int argc, char **argv) memcpy(Cinit, C, LDCxN*sizeof(MORSE_Complex64_t)); memcpy(Cfinal, C, LDCxN*sizeof(MORSE_Complex64_t)); - + /* MORSE ZSYR2K */ MORSE_zsyr2k(uplo[u], trans[t], N, K, alpha, A, LDA, B, LDB, beta, Cfinal, LDC); /* Check the solution */ - info_solution = check_solution(uplo[u], trans[t], N, K, + info_solution = check_solution(uplo[u], trans[t], N, K, alpha, A, LDA, B, LDB, beta, Cinit, Cfinal, LDC); if (info_solution == 0) { @@ -156,16 +156,16 @@ static int check_solution(MORSE_enum uplo, MORSE_enum trans, int N, int K, double *work = (double *)malloc(max(N, K)* sizeof(double)); beta_const = -1.0; - Anorm = LAPACKE_zlange_work(LAPACK_COL_MAJOR, 'I', - (trans == MorseNoTrans) ? N : K, + Anorm = LAPACKE_zlange_work(LAPACK_COL_MAJOR, 'I', + (trans == MorseNoTrans) ? N : K, (trans == MorseNoTrans) ? K : N, A, LDA, work); - Bnorm = LAPACKE_zlange_work(LAPACK_COL_MAJOR, 'I', - (trans == MorseNoTrans) ? N : K, + Bnorm = LAPACKE_zlange_work(LAPACK_COL_MAJOR, 'I', + (trans == MorseNoTrans) ? N : K, (trans == MorseNoTrans) ? K : N, B, LDB, work); Cinitnorm = LAPACKE_zlange_work(LAPACK_COL_MAJOR, 'I', N, N, Cref, LDC, work); Cmorsenorm = LAPACKE_zlange_work(LAPACK_COL_MAJOR, 'I', N, N, Cmorse, LDC, work); - cblas_zsyr2k(CblasColMajor, (CBLAS_UPLO)uplo, (CBLAS_TRANSPOSE)trans, + cblas_zsyr2k(CblasColMajor, (CBLAS_UPLO)uplo, (CBLAS_TRANSPOSE)trans, N, K, CBLAS_SADDR(alpha), A, LDA, B, LDB, CBLAS_SADDR(beta), Cref, LDC); Clapacknorm = LAPACKE_zlange_work(LAPACK_COL_MAJOR, 'I', N, N, Cref, LDC, work); @@ -175,7 +175,7 @@ static int check_solution(MORSE_enum uplo, MORSE_enum trans, int N, int K, Rnorm = LAPACKE_zlange_work(LAPACK_COL_MAJOR, 'I', N, N, Cref, LDC, work); eps = LAPACKE_dlamch_work('e'); - + printf("Rnorm %e, Anorm %e, Cinitnorm %e, Cmorsenorm %e, Clapacknorm %e\n", Rnorm, Anorm, Cinitnorm, Cmorsenorm, Clapacknorm); diff --git a/testing/testing_ztrmm.c b/testing/testing_ztrmm.c index a6a058635..4d13517b7 100644 --- a/testing/testing_ztrmm.c +++ b/testing/testing_ztrmm.c @@ -32,9 +32,6 @@ #include <coreblas.h> #include "testing_zauxiliary.h" -#undef REAL -#define COMPLEX - static int check_solution(MORSE_enum side, MORSE_enum uplo, MORSE_enum trans, MORSE_enum diag, int M, int N, MORSE_Complex64_t alpha, MORSE_Complex64_t *A, int LDA, @@ -103,7 +100,7 @@ int testing_ztrmm(int argc, char **argv) for (s=0; s<2; s++) { for (u=0; u<2; u++) { -#ifdef COMPLEX +#if defined(PRECISION_z) || defined(PRECISION_c) for (t=0; t<3; t++) { #else for (t=0; t<2; t++) { diff --git a/testing/testing_ztrsm.c b/testing/testing_ztrsm.c index ba6110955..4a1992736 100644 --- a/testing/testing_ztrsm.c +++ b/testing/testing_ztrsm.c @@ -32,9 +32,6 @@ #include <coreblas.h> #include "testing_zauxiliary.h" -#undef REAL -#define COMPLEX - static int check_solution(MORSE_enum side, MORSE_enum uplo, MORSE_enum trans, MORSE_enum diag, int M, int N, MORSE_Complex64_t alpha, MORSE_Complex64_t *A, int LDA, @@ -103,7 +100,7 @@ int testing_ztrsm(int argc, char **argv) for (s=0; s<2; s++) { for (u=0; u<2; u++) { -#ifdef COMPLEX +#if defined(PRECISION_z) || defined(PRECISION_c) for (t=0; t<3; t++) { #else for (t=0; t<2; t++) { -- GitLab