From 408b03dd8ccb3db7c71c2e92de996f9757c02680 Mon Sep 17 00:00:00 2001
From: Mathieu Faverge <mathieu.faverge@inria.fr>
Date: Wed, 22 May 2024 17:43:06 +0200
Subject: [PATCH] cmake: Add an option to enable debug mode in gered/hered

---
 CMakeLists.txt                           | 5 ++++-
 include/chameleon/config.h.in            | 9 +++++++--
 runtime/starpu/codelets/codelet_zgered.c | 4 +---
 runtime/starpu/codelets/codelet_zgerst.c | 8 +++-----
 4 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3892d9b94..8f89d65c4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -30,7 +30,8 @@
 #  @author Alycia Lisito
 #  @author Loris Lucido
 #  @author Nathan Précigout
-#  @date 2024-03-11
+#  @author Abel Calluaud
+#  @date 2024-07-17
 #
 ###
 cmake_minimum_required(VERSION 3.5)
@@ -260,6 +261,8 @@ if (CHAMELEON_ENABLE_TESTING)
     message("-- ${BoldGreen}CHAMELEON_ENABLE_TESTING is set to ON, turn it OFF to avoid building testing${ColourReset}")
 endif()
 
+option(CHAMELEON_DEBUG_GERED  "Enable GERED debug"  OFF)
+
 # Option to activate or not simulation mode (use Simgrid through StarPU)
 # ----------------------------------------------------------------------
 cmake_dependent_option(CHAMELEON_SIMULATION
diff --git a/include/chameleon/config.h.in b/include/chameleon/config.h.in
index 49885a899..c274a2884 100644
--- a/include/chameleon/config.h.in
+++ b/include/chameleon/config.h.in
@@ -11,13 +11,15 @@
  *
  * @brief Chameleon configuration file
  *
- * @version 1.2.0
+ * @version 1.3.0
  * @author Florent Pruvost
  * @author Mathieu Faverge
  * @author Philippe Virouleau
  * @author Raphael Boucherie
  * @author Loris Lucido
- * @date 2023-01-30
+ * @author Abel Calluaud
+ * @author Alycia Lisito
+ * @date 2024-07-17
  *
  */
 #ifndef CHAMELEON_CONFIG_H_HAS_BEEN_INCLUDED
@@ -79,6 +81,9 @@
 /* chameleon compute */
 #cmakedefine CHAMELEON_COPY_DIAG
 
+/* Debug options */
+#cmakedefine CHAMELEON_DEBUG_GERED
+
 /* Define the maximum batch size for kernels using it */
 #define CHAMELEON_BATCH_SIZE @CHAMELEON_BATCH_SIZE@
 
diff --git a/runtime/starpu/codelets/codelet_zgered.c b/runtime/starpu/codelets/codelet_zgered.c
index a6f8cab28..3c5a5f767 100644
--- a/runtime/starpu/codelets/codelet_zgered.c
+++ b/runtime/starpu/codelets/codelet_zgered.c
@@ -13,7 +13,7 @@
  *
  * @version 1.3.0
  * @author Mathieu Faverge
- * @date 2023-07-06
+ * @date 2024-07-17
  * @precisions normal z -> d
  *
  */
@@ -22,8 +22,6 @@
 #include "runtime_codelet_zc.h"
 #include "runtime_codelet_z.h"
 
-//#define CHAMELEON_DEBUG_GERED
-
 void INSERT_TASK_zgered( const RUNTIME_option_t *options,
                          double threshold, double Anorm, int m, int n,
                          const CHAM_desc_t *A, int Am, int An )
diff --git a/runtime/starpu/codelets/codelet_zgerst.c b/runtime/starpu/codelets/codelet_zgerst.c
index 7aca89b00..e74ca71f4 100644
--- a/runtime/starpu/codelets/codelet_zgerst.c
+++ b/runtime/starpu/codelets/codelet_zgerst.c
@@ -11,7 +11,7 @@
  *
  * @version 1.3.0
  * @author Mathieu Faverge
- * @date 2023-07-06
+ * @date 2024-07-17
  * @precisions normal z -> d
  *
  */
@@ -20,8 +20,6 @@
 #include "runtime_codelet_zc.h"
 #include "runtime_codelet_z.h"
 
-//#define CHAMELEON_DEBUG_GERST
-
 void INSERT_TASK_zgerst( const RUNTIME_option_t *options,
                          int m, int n,
                          const CHAM_desc_t *A, int Am, int An )
@@ -64,7 +62,7 @@ void INSERT_TASK_zgerst( const RUNTIME_option_t *options,
      * Restore from half precision
      */
     case ChamComplexHalf:
-#if defined(CHAMELEON_DEBUG_GERST)
+#if defined(CHAMELEON_DEBUG_GERED)
         fprintf( stderr,
                  "[%2d] Convert back the tile ( %d, %d ) from half precision\n",
                  A->myrank, Am, An );
@@ -86,7 +84,7 @@ void INSERT_TASK_zgerst( const RUNTIME_option_t *options,
 #endif
 
     case ChamComplexFloat:
-#if defined(CHAMELEON_DEBUG_GERST)
+#if defined(CHAMELEON_DEBUG_GERED)
         fprintf( stderr,
                  "[%2d] Convert back the tile ( %d, %d ) from half precision\n",
                  A->myrank, Am, An );
-- 
GitLab