From 7e558e1bce0090563caec535a2236a20a6194cb9 Mon Sep 17 00:00:00 2001
From: Mathieu Faverge <mathieu.faverge@inria.fr>
Date: Fri, 26 Jun 2020 18:07:14 +0200
Subject: [PATCH] Add more testing to validate this new extension

---
 cmake_modules/morse_cmake                   |  2 +-
 runtime/starpu/control/runtime_descriptor.c |  2 +-
 testing/chameleon_ztesting.c                |  9 ++++----
 testing/input/geadd.in                      |  2 ++
 testing/input/gemm.in                       |  2 ++
 testing/input/hemm.in                       |  2 ++
 testing/input/her2k.in                      |  2 ++
 testing/input/herk.in                       |  2 ++
 testing/input/lascal.in                     |  1 +
 testing/input/symm.in                       |  2 ++
 testing/input/syr2k.in                      |  2 ++
 testing/input/syrk.in                       |  2 ++
 testing/input/tradd.in                      |  2 ++
 testing/input/trmm.in                       |  1 +
 testing/input/trsm.in                       |  1 +
 testing/testing_zcheck.c                    | 25 ++++++++++++++++++---
 testing/testing_zgemm.c                     |  2 +-
 17 files changed, 51 insertions(+), 10 deletions(-)

diff --git a/cmake_modules/morse_cmake b/cmake_modules/morse_cmake
index 657741dba..be970c016 160000
--- a/cmake_modules/morse_cmake
+++ b/cmake_modules/morse_cmake
@@ -1 +1 @@
-Subproject commit 657741dbab25d4008c4dfc2ebdf34a3f43bf00e6
+Subproject commit be970c0169f847f9a61993d2e6a7cd49a409399e
diff --git a/runtime/starpu/control/runtime_descriptor.c b/runtime/starpu/control/runtime_descriptor.c
index 8402ec55b..a6d9f84c7 100644
--- a/runtime/starpu/control/runtime_descriptor.c
+++ b/runtime/starpu/control/runtime_descriptor.c
@@ -31,7 +31,7 @@
  These values can be changed through the call CHAMELEON_user_tag_size(int tag_width, int tag_sep) */
 #define TAG_WIDTH_MIN 20
 static int tag_width = 64;
-static int tag_sep   = 50;
+static int tag_sep   = 40;
 static int _tag_mpi_initialized_ = 0;
 
 static inline int
diff --git a/testing/chameleon_ztesting.c b/testing/chameleon_ztesting.c
index e41178a64..0d6d6e5d9 100644
--- a/testing/chameleon_ztesting.c
+++ b/testing/chameleon_ztesting.c
@@ -98,10 +98,11 @@ static parameter_t parameters[] = {
     { "||A||",         "Norm of the matrix A",                  1005, PARAM_OUTPUT, 2, 13, TestValDouble, {0}, NULL, pread_double, sprint_double },
     { "||B||",         "Norm of the matrix B",                  1006, PARAM_OUTPUT, 2, 13, TestValDouble, {0}, NULL, pread_double, sprint_double },
     { "||C||",         "Norm of the matrix C",                  1007, PARAM_OUTPUT, 2, 13, TestValDouble, {0}, NULL, pread_double, sprint_double },
-    { "||b||",         "Norm of the vector b",                  1008, PARAM_OUTPUT, 2, 13, TestValDouble, {0}, NULL, pread_double, sprint_double },
-    { "||x||",         "Norm of the vector x",                  1009, PARAM_OUTPUT, 2, 13, TestValDouble, {0}, NULL, pread_double, sprint_double },
-    { "||Ax-b||/N/eps/(||A||||x||+||b||", "",                   1010, PARAM_OUTPUT, 2, 22, TestValDouble, {0}, NULL, pread_double, sprint_double },
-    { "||I-QQ'||",     "Orthonormality of Q",                   1011, PARAM_OUTPUT, 2, 13, TestValDouble, {0}, NULL, pread_double, sprint_double },
+    { "||R||",         "Residual norm",                         1008, PARAM_OUTPUT, 2, 13, TestValDouble, {0}, NULL, pread_double, sprint_double },
+    { "||b||",         "Norm of the vector b",                  1009, PARAM_OUTPUT, 2, 13, TestValDouble, {0}, NULL, pread_double, sprint_double },
+    { "||x||",         "Norm of the vector x",                  1010, PARAM_OUTPUT, 2, 13, TestValDouble, {0}, NULL, pread_double, sprint_double },
+    { "||Ax-b||/N/eps/(||A||||x||+||b||", "",                   1011, PARAM_OUTPUT, 2, 22, TestValDouble, {0}, NULL, pread_double, sprint_double },
+    { "||I-QQ'||",     "Orthonormality of Q",                   1012, PARAM_OUTPUT, 2, 13, TestValDouble, {0}, NULL, pread_double, sprint_double },
 };
 
 #define STR_MAX_LENGTH 256
diff --git a/testing/input/geadd.in b/testing/input/geadd.in
index 180fa9a87..8e6fe98f1 100644
--- a/testing/input/geadd.in
+++ b/testing/input/geadd.in
@@ -12,6 +12,8 @@
 # alpha: Scalar alpha
 # beta: Scalar beta
 
+alpha = 0., 3.45
+beta = 0., -4.86
 op = geadd
 nb = 16, 17
 ib = 8
diff --git a/testing/input/gemm.in b/testing/input/gemm.in
index f4df5ce2c..ae01aee4d 100644
--- a/testing/input/gemm.in
+++ b/testing/input/gemm.in
@@ -15,6 +15,8 @@
 # alpha: Scalar alpha
 # beta: Scalar beta
 
+alpha = 0., 3.45
+beta = 0., -4.86
 op = gemm
 nb = 16, 17
 ib = 8
diff --git a/testing/input/hemm.in b/testing/input/hemm.in
index a57144304..047e5e9a6 100644
--- a/testing/input/hemm.in
+++ b/testing/input/hemm.in
@@ -15,6 +15,8 @@
 # beta: Scalar beta
 # bump: bump value for Hermitian matrices
 
+alpha = 0., 3.45
+beta = 0., -4.86
 op = hemm
 nb = 16, 17
 ib = 8
diff --git a/testing/input/her2k.in b/testing/input/her2k.in
index 8b420b62a..261c63cee 100644
--- a/testing/input/her2k.in
+++ b/testing/input/her2k.in
@@ -15,6 +15,8 @@
 # beta: Scalar beta
 # bump: Bump value for symmetric matrices
 
+alpha = 0., 3.45
+beta = 0., -4.86
 op = her2k
 nb = 16, 17
 ib = 8
diff --git a/testing/input/herk.in b/testing/input/herk.in
index c00df4c16..eeec8f520 100644
--- a/testing/input/herk.in
+++ b/testing/input/herk.in
@@ -14,6 +14,8 @@
 # beta: Scalar beta
 # bump: Bump value for symmetric matrices
 
+alpha = 0., 3.45
+beta = 0., -4.86
 op = herk
 nb = 16, 17
 ib = 8
diff --git a/testing/input/lascal.in b/testing/input/lascal.in
index ba7171b1b..14bccea0c 100644
--- a/testing/input/lascal.in
+++ b/testing/input/lascal.in
@@ -10,6 +10,7 @@
 # uplo: Part of the matrix to be copied (0 for Upper, 1 for Lower and 2 for UpperLower)
 # alpha: Scale to apply
 
+alpha = 0., 3.45
 op = lascal
 nb = 16, 17
 ib = 8
diff --git a/testing/input/symm.in b/testing/input/symm.in
index 17c7c3dac..6981e403d 100644
--- a/testing/input/symm.in
+++ b/testing/input/symm.in
@@ -15,6 +15,8 @@
 # beta: Scalar beta
 # bump: bump value for Hermitian matrices
 
+alpha = 0., 3.45
+beta = 0., -4.86
 op = symm
 nb = 16, 17
 ib = 8
diff --git a/testing/input/syr2k.in b/testing/input/syr2k.in
index fe434797b..24ced3073 100644
--- a/testing/input/syr2k.in
+++ b/testing/input/syr2k.in
@@ -15,6 +15,8 @@
 # beta: Scalar beta
 # bump: Bump value for symmetric matrices
 
+alpha = 0., 3.45
+beta = 0., -4.86
 op = syr2k
 nb = 16, 17
 ib = 8
diff --git a/testing/input/syrk.in b/testing/input/syrk.in
index 82daa929d..b37b6a823 100644
--- a/testing/input/syrk.in
+++ b/testing/input/syrk.in
@@ -14,6 +14,8 @@
 # beta: Scalar beta
 # bump: Bump value for symmetric matrices
 
+alpha = 0., 3.45
+beta = 0., -4.86
 op = syrk
 nb = 16, 17
 ib = 8
diff --git a/testing/input/tradd.in b/testing/input/tradd.in
index b93000662..a574f0351 100644
--- a/testing/input/tradd.in
+++ b/testing/input/tradd.in
@@ -13,6 +13,8 @@
 # alpha: Scalar alpha
 # beta: Scalar beta
 
+alpha = 0., 3.45
+beta = 0., -4.86
 op = tradd
 nb = 16, 17
 ib = 8
diff --git a/testing/input/trmm.in b/testing/input/trmm.in
index d57033740..6c6228f14 100644
--- a/testing/input/trmm.in
+++ b/testing/input/trmm.in
@@ -14,6 +14,7 @@
 # diag: Whether or not A is unit triangular
 # alpha: Scalar alpha
 
+alpha = 0., 3.45
 op = trmm
 nb = 16, 17
 ib = 8
diff --git a/testing/input/trsm.in b/testing/input/trsm.in
index 2882e9142..93098cc25 100644
--- a/testing/input/trsm.in
+++ b/testing/input/trsm.in
@@ -15,6 +15,7 @@
 # diag: Whether or not A is unit triangular
 # alpha: Scalar alpha
 
+alpha = 0., 3.45
 op = trsm
 nb = 16, 17
 ib = 8
diff --git a/testing/testing_zcheck.c b/testing/testing_zcheck.c
index 5a5f9f302..e0d4c1964 100644
--- a/testing/testing_zcheck.c
+++ b/testing/testing_zcheck.c
@@ -105,7 +105,12 @@ int check_zmatrices( run_arg_list_t *args, cham_uplo_t uplo, CHAM_desc_t *descA,
             Rnorm = LAPACKE_zlantr_work( LAPACK_COL_MAJOR, 'M', chameleon_lapack_const(uplo), 'N',
                                          M, N, B, LDA, work );
         }
-        result = Rnorm / (Anorm * eps);
+        if ( Anorm != 0. ) {
+            result = Rnorm / (Anorm * eps);
+        }
+        else {
+            result = Rnorm;
+        }
 
         /* Verifies if the result is inside a threshold */
         if (  isnan(Rnorm) || isinf(Rnorm) || isnan(result) || isinf(result) || (result > 10.0) ) {
@@ -537,7 +542,16 @@ int check_zgemm( run_arg_list_t *args, cham_trans_t transA, cham_trans_t transB,
         /* Calculates the norm with the core function's result */
         Rnorm = LAPACKE_zlange_work( LAPACK_COL_MAJOR, 'M', M, N, Cref, LDC, NULL );
 
-        result = Rnorm / ((cabs(alpha) * max(Anorm, Bnorm) + cabs(beta) * Crefnorm) * K * eps);
+        if ( ( alpha != 0. ) || (beta != 0. ) ) {
+            result = Rnorm / ((cabs(alpha) * max(Anorm, Bnorm) + cabs(beta) * Crefnorm) * K * eps);
+        }
+        else {
+            result = Rnorm;
+        }
+        run_arg_add_double( args, "||A||", Anorm );
+        run_arg_add_double( args, "||B||", Bnorm );
+        run_arg_add_double( args, "||C||", Crefnorm );
+        run_arg_add_double( args, "||R||", Rnorm );
 
         /* Verifies if the result is inside a threshold */
         if (  isnan(Rnorm) || isinf(Rnorm) || isnan(result) || isinf(result) || (result > 10.0) ) {
@@ -685,7 +699,12 @@ int check_zsymm( run_arg_list_t *args, cham_mtxtype_t matrix_type, cham_side_t s
         Clapacknorm = LAPACKE_zlange_work( LAPACK_COL_MAJOR, 'M', M, N, Cref, LDC, NULL );
         Rnorm       = LAPACKE_zlange_work( LAPACK_COL_MAJOR, 'M', M, N, Cref, LDC, NULL );
 
-        result = Rnorm / ((cabs(alpha) * max(Anorm, Bnorm) + cabs(beta) * Crefnorm) * An * eps);
+        if ( ( alpha != 0. ) || (beta != 0. ) ) {
+            result = Rnorm / ((cabs(alpha) * max(Anorm, Bnorm) + cabs(beta) * Crefnorm) * An * eps);
+        }
+        else {
+            result = Rnorm;
+        }
 
         /* Verifies if the result is inside a threshold */
         if (  isnan(Rnorm) || isinf(Rnorm) || isnan(result) || isinf(result) || (result > 10.0) ) {
diff --git a/testing/testing_zgemm.c b/testing/testing_zgemm.c
index 17d39874d..b3f2bea7c 100644
--- a/testing/testing_zgemm.c
+++ b/testing/testing_zgemm.c
@@ -114,7 +114,7 @@ testing_t   test_zgemm;
 const char *zgemm_params[] = { "mtxfmt", "nb", "transA", "transB", "m",     "n",     "k",     "lda", "ldb",
                                "ldc", "alpha",  "beta",   "seedA", "seedB", "seedC", NULL };
 const char *zgemm_output[] = { NULL };
-const char *zgemm_outchk[] = { "RETURN", NULL };
+const char *zgemm_outchk[] = { "||A||", "||B||", "||C||", "||R||", "RETURN", NULL };
 
 /**
  * @brief Testing registration function
-- 
GitLab