Skip to content
Snippets Groups Projects
Commit 01198127 authored by Mark Olesen's avatar Mark Olesen Committed by Adam J. Stewart
Browse files

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.
parent eb00436e
No related branches found
No related tags found
No related merge requests found
...@@ -264,6 +264,8 @@ class OpenfoamCom(Package): ...@@ -264,6 +264,8 @@ class OpenfoamCom(Package):
list_depth = 2 list_depth = 2
version('develop', branch='develop', submodules='True') # Needs credentials version('develop', branch='develop', submodules='True') # Needs credentials
version('1906', 'ab7017e262c0c0fceec55c31e2153180')
version('1812_190531', 'a4b416838a8a76fdec22706a33c96de3')
version('1812', '6a315687b3601eeece7ff7c7aed3d9a5') version('1812', '6a315687b3601eeece7ff7c7aed3d9a5')
version('1806', 'bb244a3bde7048a03edfccffc46c763f') version('1806', 'bb244a3bde7048a03edfccffc46c763f')
version('1712', '6ad92df051f4d52c7d0ec34f4b8eb3bc') version('1712', '6ad92df051f4d52c7d0ec34f4b8eb3bc')
...@@ -762,7 +764,7 @@ class OpenfoamArch(object): ...@@ -762,7 +764,7 @@ class OpenfoamArch(object):
def __init__(self, spec, **kwargs): def __init__(self, spec, **kwargs):
# Some user settings, to be adjusted manually or via variants # Some user settings, to be adjusted manually or via variants
self.compiler = None # <- %compiler 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.label_size = None # <- +int64
self.precision_option = 'DP' # <- +float32 self.precision_option = 'DP' # <- +float32
self.compile_option = kwargs.get('compile-option', 'RpathOpt') self.compile_option = kwargs.get('compile-option', 'RpathOpt')
...@@ -780,6 +782,10 @@ def __init__(self, spec, **kwargs): ...@@ -780,6 +782,10 @@ def __init__(self, spec, **kwargs):
if '+float32' in spec: if '+float32' in spec:
self.precision_option = 'SP' 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 # spec.architecture.platform is like `uname -s`, but lower-case
platform = spec.architecture.platform platform = spec.architecture.platform
...@@ -787,13 +793,10 @@ def __init__(self, spec, **kwargs): ...@@ -787,13 +793,10 @@ def __init__(self, spec, **kwargs):
target = spec.architecture.target target = spec.architecture.target
if platform == 'linux': if platform == 'linux':
if target == 'i686': if target == 'x86_64':
self.arch_option = '32' # Force consistency platform += '64'
elif target == 'x86_64':
if self.arch_option == '64':
platform += '64'
elif target == 'ia64': elif target == 'ia64':
platform += 'ia64' platform += 'IA64'
elif target == 'armv7l': elif target == 'armv7l':
platform += 'ARM7' platform += 'ARM7'
elif target == 'aarch64': elif target == 'aarch64':
...@@ -804,9 +807,7 @@ def __init__(self, spec, **kwargs): ...@@ -804,9 +807,7 @@ def __init__(self, spec, **kwargs):
platform += 'PPC64le' platform += 'PPC64le'
elif platform == 'darwin': elif platform == 'darwin':
if target == 'x86_64': if target == 'x86_64':
platform += 'Intel' platform += '64'
if self.arch_option == '64':
platform += '64'
# ... and others? # ... and others?
self.arch = platform self.arch = platform
...@@ -821,8 +822,6 @@ def __init__(self, spec, **kwargs): ...@@ -821,8 +822,6 @@ def __init__(self, spec, **kwargs):
comp = self.compiler_mapping[comp] comp = self.compiler_mapping[comp]
comp = comp.capitalize() comp = comp.capitalize()
if '+knl' in spec:
comp += 'KNL'
self.compiler = comp self.compiler = comp
self.rule = self.arch + self.compiler self.rule = self.arch + self.compiler
...@@ -849,7 +848,6 @@ def foam_dict(self): ...@@ -849,7 +848,6 @@ def foam_dict(self):
"""Returns a dictionary for OpenFOAM prefs, bashrc, cshrc.""" """Returns a dictionary for OpenFOAM prefs, bashrc, cshrc."""
return dict([ return dict([
('WM_COMPILER', self.compiler), ('WM_COMPILER', self.compiler),
('WM_ARCH_OPTION', self.arch_option),
('WM_LABEL_SIZE', self.label_size), ('WM_LABEL_SIZE', self.label_size),
('WM_PRECISION_OPTION', self.precision_option), ('WM_PRECISION_OPTION', self.precision_option),
('WM_COMPILE_OPTION', self.compile_option), ('WM_COMPILE_OPTION', self.compile_option),
...@@ -918,6 +916,10 @@ def create_rules(self, projdir, foam_pkg): ...@@ -918,6 +916,10 @@ def create_rules(self, projdir, foam_pkg):
if re.match(r'^\S+DBUG\s*=', line): if re.match(r'^\S+DBUG\s*=', line):
outfile.write(' ') outfile.write(' ')
outfile.write(rpath) 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') outfile.write('\n')
# MPI rules # MPI rules
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment