From 3943fb903a9918ed96f827f1436043a28b0d90cc Mon Sep 17 00:00:00 2001
From: Mathieu Faverge <mathieu.faverge@inria.fr>
Date: Wed, 14 Oct 2020 15:58:08 +0200
Subject: [PATCH] Fix compilation with parsec and openmp for forcegpu and
 profile options

---
 runtime/openmp/CMakeLists.txt               | 10 +++++
 runtime/openmp/control/runtime_zlocality.c  | 44 +++++++++++++++++++++
 runtime/openmp/control/runtime_zprofiling.c | 31 +++++++++++++++
 runtime/parsec/control/runtime_zlocality.c  |  4 +-
 4 files changed, 87 insertions(+), 2 deletions(-)
 create mode 100644 runtime/openmp/control/runtime_zlocality.c
 create mode 100644 runtime/openmp/control/runtime_zprofiling.c

diff --git a/runtime/openmp/CMakeLists.txt b/runtime/openmp/CMakeLists.txt
index ae6e6264b..0dd9e7816 100644
--- a/runtime/openmp/CMakeLists.txt
+++ b/runtime/openmp/CMakeLists.txt
@@ -64,6 +64,16 @@ install(
 
 # Generate the Chameleon common for all possible precisions
 # ---------------------------------------------------------
+set(RUNTIME_COMMON_GENERATED "")
+set(ZSRC
+  control/runtime_zprofiling.c
+  control/runtime_zlocality.c
+  )
+
+precisions_rules_py(
+  RUNTIME_COMMON_GENERATED "${ZSRC}"
+  PRECISIONS "${CHAMELEON_PRECISION}"
+  TARGETDIR "control")
 
 set(RUNTIME_COMMON
   control/runtime_async.c
diff --git a/runtime/openmp/control/runtime_zlocality.c b/runtime/openmp/control/runtime_zlocality.c
new file mode 100644
index 000000000..6d48e11a8
--- /dev/null
+++ b/runtime/openmp/control/runtime_zlocality.c
@@ -0,0 +1,44 @@
+/**
+ *
+ * @file openmp/runtime_zlocality.c
+ *
+ * @copyright 2012-2017 The University of Tennessee and The University of
+ *                      Tennessee Research Foundation. All rights reserved.
+ * @copyright 2012-2020 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria,
+ *                      Univ. Bordeaux. All rights reserved.
+ *
+ ***
+ *
+ * @brief Chameleon OpenMP CHAMELEON_Complex64_t kernel locality management
+ *
+ * @version 1.0.0
+ * @author Mathieu Faverge
+ * @date 2020-03-03
+ * @precisions normal z -> s d c
+ *
+ */
+#include "chameleon_openmp.h"
+
+void RUNTIME_zlocality_allrestrict( uint32_t where )
+{
+    (void)where;
+    chameleon_warning("RUNTIME_zlocality_allrestrict(Openmp)", "Kernel locality cannot be specified with Openmp");
+}
+
+void RUNTIME_zlocality_onerestrict( cham_tasktype_t kernel, uint32_t where )
+{
+    (void)kernel;
+    (void)where;
+    chameleon_warning("RUNTIME_zlocality_onerestrict(Openmp)", "Kernel locality cannot be specified with Openmp");
+}
+
+void RUNTIME_zlocality_allrestore( )
+{
+    chameleon_warning("RUNTIME_zlocality_allrestore(Openmp)", "Kernel locality cannot be specified with Openmp");
+}
+
+void RUNTIME_zlocality_onerestore( cham_tasktype_t kernel )
+{
+    (void)kernel;
+    chameleon_warning("RUNTIME_zlocality_onerestore(Openmp)", "Kernel locality cannot be specified with Openmp");
+}
diff --git a/runtime/openmp/control/runtime_zprofiling.c b/runtime/openmp/control/runtime_zprofiling.c
new file mode 100644
index 000000000..b03cd2e0e
--- /dev/null
+++ b/runtime/openmp/control/runtime_zprofiling.c
@@ -0,0 +1,31 @@
+/**
+ *
+ * @file openmp/runtime_zprofiling.c
+ *
+ * @copyright 2012-2017 The University of Tennessee and The University of
+ *                      Tennessee Research Foundation. All rights reserved.
+ * @copyright 2012-2020 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria,
+ *                      Univ. Bordeaux. All rights reserved.
+ *
+ ***
+ *
+ * @brief Chameleon OpenMP CHAMELEON_Complex64_t kernel progiling
+ *
+ * @version 1.0.0
+ * @author Mathieu Faverge
+ * @date 2020-03-03
+ *
+ */
+#include "chameleon_openmp.h"
+
+void RUNTIME_zdisplay_allprofile()
+{
+    chameleon_warning("RUNTIME_zdisplay_allprofile(OpenMP)", "Profiling is not available with OpenMP");
+}
+
+void RUNTIME_zdisplay_oneprofile( cham_tasktype_t kernel )
+{
+    (void)kernel;
+    chameleon_warning("RUNTIME_zdisplay_oneprofile(OpenMP)", "Profiling is not available with OpenMP\n");
+}
+
diff --git a/runtime/parsec/control/runtime_zlocality.c b/runtime/parsec/control/runtime_zlocality.c
index 06d22db22..7a9319bf6 100644
--- a/runtime/parsec/control/runtime_zlocality.c
+++ b/runtime/parsec/control/runtime_zlocality.c
@@ -12,12 +12,12 @@
  * @brief Chameleon PaRSEC CHAMELEON_Complex64_t kernel locality management
  *
  * @version 1.0.0
- * @author Reazul Hoque
  * @author Mathieu Faverge
  * @date 2020-03-03
+ * @precisions normal z -> s d c
  *
  */
-#include "runtime/PaRSEC/include/chameleon_parsec.h"
+#include "chameleon_parsec.h"
 
 void RUNTIME_zlocality_allrestrict( uint32_t where )
 {
-- 
GitLab