From c1440200103181baa321d86dd9244b756bfe9f07 Mon Sep 17 00:00:00 2001
From: Florent Pruvost <florent.pruvost@inria.fr>
Date: Tue, 14 Jun 2022 14:09:49 +0200
Subject: [PATCH] cmake: avoid to force cblas and lapacke mt to false because
 the application may want to use the multithreaded version and handle at its
 level the number of threads to use

---
 CMakeLists.txt | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3992cc335..4e2b1d40c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -288,6 +288,9 @@ mark_as_advanced(CHAMELEON_COPY_DIAG)
 
 # If ON generates vendor_ztesting in testings
 option(CHAMELEON_TESTINGS_VENDOR "Generate testings of the blas / lapack vendor (e.g. intel MKL MT)" OFF)
+
+# If ON enable the use of multithreaded kernels such as Intel MKL MT
+option(CHAMELEON_KERNELS_MT "Use multithreaded kernels (e.g. intel MKL MT)" OFF)
 #------------------------------------------------------------------------------
 
 ###############################################################################
@@ -331,14 +334,20 @@ find_package(M REQUIRED)
 # with concerned libraries
 if(NOT CHAMELEON_SIMULATION)
 
+    if(CHAMELEON_KERNELS_MT)
+        set( CBLAS_MT TRUE )
+        set( LAPACKE_MT TRUE )
+    else()
+        set( CBLAS_MT FALSE )
+        set( LAPACKE_MT FALSE )
+    endif()
+
     # CHAMELEON depends on CBLAS
     #---------------------------
-    set( CBLAS_MT FALSE )
     find_package(CBLAS REQUIRED)
 
     # CHAMELEON depends on LAPACKE
     #-----------------------------
-    set( LAPACKE_MT FALSE )
     find_package(LAPACKE REQUIRED)
 
     # CHAMELEON depends on CUDA/CUBLAS
-- 
GitLab