From 5b3f99b578fd46ef481c97f55f83ad7027bc9d2b Mon Sep 17 00:00:00 2001
From: Sebastian Achilles <s.achilles@fz-juelich.de>
Date: Wed, 4 Jan 2023 18:29:41 +0100
Subject: [PATCH] set MKL_THREADING_LAYER in hook

---
 Custom_Hooks/eb_hooks.py | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/Custom_Hooks/eb_hooks.py b/Custom_Hooks/eb_hooks.py
index 433b3ef78..618d0a26e 100644
--- a/Custom_Hooks/eb_hooks.py
+++ b/Custom_Hooks/eb_hooks.py
@@ -88,6 +88,11 @@ TWEAKABLE_DEPENDENCIES = {
     'UCX': 'default',
 }
 
+MKL_THREADING_LAYER = {
+    'GCC': 'GNU',
+    'intel-compilers': 'INTEL',
+}
+
 SIDECOMPILERS = ['AOCC', 'Clang']
 
 common_site_contact = 'Support <sc@fz-juelich.de>'
@@ -614,3 +619,14 @@ def pre_ready_hook(self, *args, **kwargs):
                 path_to_ec,
             )
             exit(1)
+
+
+def pre_module_hook(self, *args, **kwargs):
+    # Compilers need to set MKL_THREADING_LAYER
+    if self.name in MKL_THREADING_LAYER:
+        # Must be done this way, updating self.cfg['modextravars']
+        # directly doesn't work due to templating.
+        with self.cfg.disable_templating():
+            self.cfg['modextravars'].update({
+                'MKL_THREADING_LAYER': MKL_THREADING_LAYER[self.name]
+            })
-- 
GitLab