From ee32dd91dec878cf927b5d007a390b7eef2448ca Mon Sep 17 00:00:00 2001
From: Mathieu Faverge <mathieu.faverge@inria.fr>
Date: Wed, 12 May 2021 17:58:09 +0200
Subject: [PATCH] coreblas/trace: add an environment variable to enable/disable
 log info

---
 coreblas/compute/global.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/coreblas/compute/global.c b/coreblas/compute/global.c
index f92498976..7ce1142c0 100644
--- a/coreblas/compute/global.c
+++ b/coreblas/compute/global.c
@@ -22,10 +22,20 @@
  */
 #include "coreblas.h"
 #include <stdarg.h>
+#include <stdlib.h>
 
 int _coreblas_silent = 0;
 static int coreblas_gemm3m_enabled = 0;
 
+__attribute__((unused)) __attribute__((constructor)) static void
+__coreblas_lib_init()
+{
+    char *silent = getenv("CHAMELEON_COREBLAS_SILENT");
+    if ( silent && !(strcmp( silent, "0" ) == 0) ) {
+        _coreblas_silent = 1;
+    }
+}
+
 #if defined(CHAMELEON_KERNELS_TRACE)
 void __coreblas_kernel_trace( const char *func, ... )
 {
-- 
GitLab