From 96bdccc7cb6d2d472534935dad78b7adbf8349ef Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Oriol=20Tint=C3=B3?= <oriol.tinto@lmu.de>
Date: Thu, 9 Mar 2023 14:55:13 +0100
Subject: [PATCH] Trying to get icon build pointing to a slurm capable version
 of openmpi.

---
 conf/proj.yaml          | 1 +
 templates/build_icon.sh | 9 ++++-----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/conf/proj.yaml b/conf/proj.yaml
index a656ebb..deb4cf2 100644
--- a/conf/proj.yaml
+++ b/conf/proj.yaml
@@ -1,6 +1,7 @@
 spack:
   url: git@gitlab.physik.uni-muenchen.de:LDAP_rbg/spack.git
   branch: lmu/ubuntu20.04-icon
+  compiler: gcc%11.3.0
 
 icon:
   version: 2.6.4-nwp3
diff --git a/templates/build_icon.sh b/templates/build_icon.sh
index f15c3bf..7e78413 100644
--- a/templates/build_icon.sh
+++ b/templates/build_icon.sh
@@ -4,6 +4,7 @@ WORKDIR=%HPCROOTDIR%
 ICON_VERSION=%ICON_VERSION%
 SPACK_URL=%spack.url%
 SPACK_BRANCH=%spack.branch%
+SPACK_COMPILER=%spack.compiler%
 
 
 # If the workdir directory does not exist create it
@@ -24,14 +25,12 @@ fi
 # Setup the environment
 source ${SPACK_ENV}
 
-# If the model is not installed, install it.
-if [ $( spack find icon-nwp@${ICON_VERSION} &> /dev/null ; echo $? ) -ne 0 ]; then
-  spack install icon-nwp@${ICON_VERSION} ^mpi+slurm
-fi
 
 if [ $( spack find icon-nwp@${ICON_VERSION} &> /dev/null ; echo $? ) -ne 0 ]; then
         echo "Installing icon-nwp@${ICON_VERSION}."
-        spack install icon-nwp@${ICON_VERSION}
+        # Compile openmpi with schedulers=slurm
+        spack install openmpi${SPACK_COMPILER}+legacylaunchers schedulers=slurm
+        spack install icon-nwp@${ICON_VERSION}%${SPACK_COMPILER} ^openmpi%${SPACK_COMPILER}
 else
         echo "icon-nwp@${ICON_VERSION} already installed!"
 fi
-- 
GitLab