From 01198127811184bbcd6a88843adaed7d46003a3d Mon Sep 17 00:00:00 2001 From: Mark Olesen <Mark.Olesen@esi-group.com> Date: Thu, 27 Jun 2019 17:14:33 +0100 Subject: [PATCH] Update openfoam (#11866) * OpenFOAM: rationalize architecture options - older versions of OpenFOAM had WM_ARCH_OPTION to choose a 32-bit build on 64-bit architectures. This is not exactly relevant anymore and has now been largely removed from OpenFOAM. - simultaneously the newest version of OpenFOAM has rationalized the handling of special settings for KNL by rolling these into the compiler options. We now do the same thing here in spack. 1. Reuse the internal variable arch_option to convey processor-specific optimizations and add these into the C++OPT=... statement. 2. Drop spack support for configuring a 32-bit build on 64-bit hardware. These changes can also be applied to older OpenFOAM versions, and to various OpenFOAM forks without issue. * update openfoam versions. New release 1906, patched 1812 version. --- .../builtin/packages/openfoam-com/package.py | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/var/spack/repos/builtin/packages/openfoam-com/package.py b/var/spack/repos/builtin/packages/openfoam-com/package.py index 4dfa1644f4..318b2cb5b1 100644 --- a/var/spack/repos/builtin/packages/openfoam-com/package.py +++ b/var/spack/repos/builtin/packages/openfoam-com/package.py @@ -264,6 +264,8 @@ class OpenfoamCom(Package): list_depth = 2 version('develop', branch='develop', submodules='True') # Needs credentials + version('1906', 'ab7017e262c0c0fceec55c31e2153180') + version('1812_190531', 'a4b416838a8a76fdec22706a33c96de3') version('1812', '6a315687b3601eeece7ff7c7aed3d9a5') version('1806', 'bb244a3bde7048a03edfccffc46c763f') version('1712', '6ad92df051f4d52c7d0ec34f4b8eb3bc') @@ -762,7 +764,7 @@ class OpenfoamArch(object): def __init__(self, spec, **kwargs): # Some user settings, to be adjusted manually or via variants self.compiler = None # <- %compiler - self.arch_option = '64' # (32/64-bit on x86_64) + self.arch_option = '' # Eg, -march=knl self.label_size = None # <- +int64 self.precision_option = 'DP' # <- +float32 self.compile_option = kwargs.get('compile-option', 'RpathOpt') @@ -780,6 +782,10 @@ def __init__(self, spec, **kwargs): if '+float32' in spec: self.precision_option = 'SP' + # Processor/architecture-specific optimizations + if '+knl' in spec: + self.arch_option = '-march=knl' + # spec.architecture.platform is like `uname -s`, but lower-case platform = spec.architecture.platform @@ -787,13 +793,10 @@ def __init__(self, spec, **kwargs): target = spec.architecture.target if platform == 'linux': - if target == 'i686': - self.arch_option = '32' # Force consistency - elif target == 'x86_64': - if self.arch_option == '64': - platform += '64' + if target == 'x86_64': + platform += '64' elif target == 'ia64': - platform += 'ia64' + platform += 'IA64' elif target == 'armv7l': platform += 'ARM7' elif target == 'aarch64': @@ -804,9 +807,7 @@ def __init__(self, spec, **kwargs): platform += 'PPC64le' elif platform == 'darwin': if target == 'x86_64': - platform += 'Intel' - if self.arch_option == '64': - platform += '64' + platform += '64' # ... and others? self.arch = platform @@ -821,8 +822,6 @@ def __init__(self, spec, **kwargs): comp = self.compiler_mapping[comp] comp = comp.capitalize() - if '+knl' in spec: - comp += 'KNL' self.compiler = comp self.rule = self.arch + self.compiler @@ -849,7 +848,6 @@ def foam_dict(self): """Returns a dictionary for OpenFOAM prefs, bashrc, cshrc.""" return dict([ ('WM_COMPILER', self.compiler), - ('WM_ARCH_OPTION', self.arch_option), ('WM_LABEL_SIZE', self.label_size), ('WM_PRECISION_OPTION', self.precision_option), ('WM_COMPILE_OPTION', self.compile_option), @@ -918,6 +916,10 @@ def create_rules(self, projdir, foam_pkg): if re.match(r'^\S+DBUG\s*=', line): outfile.write(' ') outfile.write(rpath) + elif re.match(r'^\S+OPT\s*=', line): + if self.arch_option: + outfile.write(' ') + outfile.write(self.arch_option) outfile.write('\n') # MPI rules -- GitLab