From e23449eacefb14b0049b5a5301b7d544f37a5bdb Mon Sep 17 00:00:00 2001
From: Nicolas Richart <nicolas.richart@epfl.ch>
Date: Tue, 18 Jun 2024 15:13:14 +0200
Subject: [PATCH] Adding target to compilers

---
 ci/install_compilers.sh       | 13 ++++++++++---
 stacks/pinot-noir/config.json |  7 +++++++
 2 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/ci/install_compilers.sh b/ci/install_compilers.sh
index 75d576e..a6d3d04 100755
--- a/ci/install_compilers.sh
+++ b/ci/install_compilers.sh
@@ -73,6 +73,12 @@ for c in  "core_compilers" "compilers"; do
     fi
 done
 
+export target=$(jq -Mrc '
+.stack.targets
+ | to_entries.[]
+ | select(.key == env.environment)
+ |.value' ${STACK_CONFIG})
+
 compilers_specs=$(jq -Mr '
 .stack
  | .system_arch as $arch
@@ -89,14 +95,15 @@ system_compiler=$(jq -Mrc '
 ' ${STACK_CONFIG})
 
 core_compilers=$(jq -Mrc '.stack
+ | .system_arch as $arch
  | .system_compiler + .core_compilers
- | map("\(.compiler)@\(.version)")
+ | map("\(.compiler)@\(.version) \($arch)")
 ' ${STACK_CONFIG})
 
 compilers=$(jq -Mrc '.stack
  | .compilers
  | map(select(.constraint == null))
- | map("\(.compiler)@\(.version)")
+ | map("\(.compiler)@\(.version) target=\(env.target)")
 ' ${STACK_CONFIG})
 
 echo "definitions:" > ${SPACK_SYSTEM_CONFIG_PATH}/compiler_definitions.yaml
@@ -123,7 +130,7 @@ jq -Mrc '
  | .system_arch as $arch
  | .compilers
  | to_entries
- | map(" - compiler_\(.key): [\(.value.compiler)@\(.value.version)]")
+ | map(" - compiler_\(.key): [\(.value.compiler)@\(.value.version) target=\(env.target)]")
  | .[]
 '  ${STACK_CONFIG} >> ${SPACK_SYSTEM_CONFIG_PATH}/compiler_definitions.yaml
 
diff --git a/stacks/pinot-noir/config.json b/stacks/pinot-noir/config.json
index 4be26e5..644aa7d 100644
--- a/stacks/pinot-noir/config.json
+++ b/stacks/pinot-noir/config.json
@@ -22,6 +22,13 @@
                 "version": "11.4.1"
             }
         },
+        "targets": {
+            "helvetios": "skylake_avx512",
+            "izar": "cascadelake",
+            "jed": "icelake",
+            "kuma_l40s": "zen4",
+            "kuma_h100": "zen4"
+        },
         "compilers": {
             "gcc_stable": {
                 "compiler": "gcc",
-- 
GitLab