Skip to content

add WRF/3.9.1.1-foss-2020a-dmpar to EESSI 2021.12 pilot repo#162

Merged
boegel merged 6 commits intoEESSI:mainfrom
hmeiland:feature-WRF
Jan 16, 2022
Merged

add WRF/3.9.1.1-foss-2020a-dmpar to EESSI 2021.12 pilot repo#162
boegel merged 6 commits intoEESSI:mainfrom
hmeiland:feature-WRF

Conversation

@hmeiland
Copy link
Contributor

@hmeiland hmeiland commented Dec 21, 2021

adding WRF to the default EESSI stack; let's see if the process works here ;)
if no big blockers, target date of Jan 14th would be awesome!
initial target archs: zen2 and skylake_avx512

edit: checklist:

  • aarch64/generic (done, ingested)
  • aarch64/graviton2 (done, ingested)
  • ppc64le/generic (done, ingested)
  • ppc64le/power9le (done, ingested)
  • x86_64/generic (done, ingested)
  • x86_64/amd/zen2 (done, ingested)
  • x86_64/amd/zen3 (done, ingested)
  • x86_64/intel/haswell (done, ingested)
  • x86_64/intel/skylake_avx512 (done, ingested)

Copy link
Contributor

@boegel boegel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hmeiland Can you also add WRF to the easystack file for 2021.12 (eessi-2021.12.yml)?

Eventually that will be the main driver to determine what's installed in EESSI, and it's already being used at the end of the install script to check which installations are missing.

@boegel boegel added the enhancement New feature or request label Jan 6, 2022
@boegel
Copy link
Contributor

boegel commented Jan 6, 2022

When the installation prefix is very long, a problem pops up:

== 2022-01-06 16:27:38,670 build_log.py:169 ERROR EasyBuild crashed with an error (at easybuild/base/exceptions.py:124 in __init__): cmd "/cvmfs/pilot.eessi-hpc.org/versions/2021.12/software/linux/x86_64/intel/skylake_avx512/software/WRF/3.9.1.1-foss-2020a-dmpar/WRFV3/compile -j 18 wrf" exited with exit code 126 and output:
/bin/bash: /cvmfs/pilot.eessi-hpc.org/versions/2021.12/software/linux/x86_64/intel/skylake_avx512/software/WRF/3.9.1.1-foss-2020a-dmpar/WRFV3/compile: /cvmfs/pilot.eessi-hpc.org/versions/2021.12/software/linux/x86_64/intel/skylake_avx512/software/tcsh/6.22.02-GCCcore-9.3.0/bi: bad interpreter: No such file or directory

This occurs because we patch the shebang of the compile script:

== 2022-01-06 16:27:38,571 filetools.py:1658 INFO Applied the following substitutions to /cvmfs/pilot.eessi-hpc.org/versions/2021.12/software/linux/x86_64/intel/skylake_avx512/software/WRF/3.9.1.1-foss-2020a-dmpar/WRFV3/compile:
Replaced in line 1: '/bin/csh' -> '/cvmfs/pilot.eessi-hpc.org/versions/2021.12/software/linux/x86_64/intel/skylake_avx512/software/tcsh/6.22.02-GCCcore-9.3.0/bin/tcsh'

This can be fixed by patching the script to use <sysroot>/usr/bin/env tcsh instead, a change that we should make in the build_step of the WRF easyblock... (I'll take a look into that)

@boegel
Copy link
Contributor

boegel commented Jan 6, 2022

WRF easyblock update in easybuilders/easybuild-easyblocks#2648, should work, testing it now...

@hmeiland
Copy link
Contributor Author

hmeiland commented Jan 7, 2022

@hmeiland Can you also add WRF to the easystack file for 2021.12 (eessi-2021.12.yml)?

eessi-2021.12.yml file updated

@boegel
Copy link
Contributor

boegel commented Jan 7, 2022

WRF installation on aarch64 fails, because there's no configuration for aarch64 available in WRF 3.9.1.1

That was only added recently in WRF 4.x (see wrf-model/WRF#1557), so we may need to inject a configuration like this through a patch file for arch/configure_new.defaults for WRF 3.9.1.1...

@boegel
Copy link
Contributor

boegel commented Jan 7, 2022

Testing following changes to EasyBuild hooks to get build on aarch64 to work:

diff --git a/eb_hooks.py b/eb_hooks.py
index 126d89c..6530942 100644
--- a/eb_hooks.py
+++ b/eb_hooks.py
@@ -4,7 +4,7 @@ import os

 from easybuild.tools.build_log import EasyBuildError, print_msg
 from easybuild.tools.config import build_option, update_build_option
-from easybuild.tools.systemtools import POWER, get_cpu_architecture
+from easybuild.tools.systemtools import AARCH64, POWER, get_cpu_architecture

 EESSI_RPATH_OVERRIDE_ATTR = 'orig_rpath_override_dirs'

@@ -124,8 +124,32 @@ def ucx_eprefix(ec, eprefix):
         raise EasyBuildError("UCX-specific hook triggered for non-UCX easyconfig?!")


+def pre_configure_hook(self, *args, **kwargs):
+    """Main pre-configure hook: trigger custom functions based on software name."""
+    if self.name in PRE_CONFIGURE_HOOKS:
+        PRE_CONFIGURE_HOOKS[self.name](self, *args, **kwargs)
+
+
+def wrf_preconfigure(self, *args, **kwargs):
+    """
+    Pre-configure hook for WRF:
+    - patch arch/configure_new.defaults so building WRF with foss toolchain works on aarch64
+    """
+    if self.name == 'WRF':
+        if get_cpu_architecture() == AARCH64:
+            pattern = "Linux x86_64 ppc64le, gfortran"
+            repl = "Linux x86_64 aarch64 ppc64le, gfortran"
+            self.cfg.update('preconfigopts', "sed -i 's/%s/%s/g' arch/configure_new.defaults && " % (pattern, repl))
+            print_msg("Using custom preconfigopts for %s: %s", self.name, self.cfg['preconfigopts'])
+    else:
+        raise EasyBuildError("WRF-specific hook triggered for non-WRF easyconfig?!")
+
 PARSE_HOOKS = {
     'CGAL': cgal_toolchainopts_precise,
     'fontconfig': fontconfig_add_fonts,
     'UCX': ucx_eprefix,
 }
+
+PRE_CONFIGURE_HOOKS = {
+    'WRF': wrf_preconfigure,
+}

Eventually this should probably be implemented directly in the WRF easyblock, since it's not exactly custom to EESSI (but required for anyone building on aarch64).

Copy link
Contributor

@boegel boegel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hmeiland Some tweaking is needed to fix installation of WRF on aarch64, see hmeiland#1

implement pre-configure hook to fix installation of WRF 3.9.1.1 on aarch64
@boegel boegel changed the title adding WRF 3.9.1.1 add WRF/3.9.1.1-foss-2020a-dmpar to EESSI 2021.12 pilot repo Jan 16, 2022
@boegel boegel merged commit 6a3205f into EESSI:main Jan 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants