openfoam / openfoam-org : handle arch naming differences #19777 (#19778)

- issue caused by the openfoam-org internal naming for their
  newly added support for aarch64

Co-authored-by: Mark Olesen <Mark.Olesen@esi-group.com>
This commit is contained in:
Mark Olesen 2020-11-09 03:26:51 +01:00 committed by GitHub
parent 0857648313
commit ac8a07ef4a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 35 additions and 16 deletions

View File

@ -174,7 +174,7 @@ def projectdir(self):
@property
def foam_arch(self):
if not self._foam_arch:
self._foam_arch = OpenfoamArch(self.spec, **self.config)
self._foam_arch = OpenfoamOrgArch(self.spec, **self.config)
return self._foam_arch
@property
@ -390,3 +390,17 @@ def install_links(self):
if os.path.isfile(f)
]:
os.symlink(f, os.path.basename(f))
# -----------------------------------------------------------------------------
class OpenfoamOrgArch(OpenfoamArch):
"""An openfoam-org variant of OpenfoamArch
"""
def update_arch(self, spec):
"""Handle differences in WM_ARCH naming
"""
OpenfoamArch.update_arch(self, spec)
# ARM64 (openfoam) -> Arm64 (openfoam-org)
self.arch = self.arch.replace("ARM64", "Arm64")

View File

@ -861,12 +861,13 @@ def __init__(self, spec, **kwargs):
self.options = None
self.mplib = kwargs.get('mplib', 'USERMPI')
# Normally support WM_LABEL_OPTION, but not yet for foam-extend
# WM_LABEL_OPTION, but perhaps not yet for foam-extend
if '+int64' in spec:
self.label_size = '64'
elif kwargs.get('label-size', True):
self.label_size = '32'
# WM_PRECISION_OPTION
if '+spdp' in spec:
self.precision_option = 'SPDP'
elif '+float32' in spec:
@ -876,6 +877,20 @@ def __init__(self, spec, **kwargs):
if '+knl' in spec:
self.arch_option = '-march=knl'
# Capitalize first letter of compiler name to obtain the
# OpenFOAM naming (eg, gcc -> Gcc, clang -> Clang, etc).
# Use compiler_mapping[] for special cases
comp = spec.compiler.name
if comp in self.compiler_mapping:
comp = self.compiler_mapping[comp]
self.compiler = comp.capitalize()
self.update_arch(spec)
self.update_options()
def update_arch(self, spec):
"""Set WM_ARCH string corresponding to spack platform/target
"""
# spec.architecture.platform is like `uname -s`, but lower-case
platform = str(spec.architecture.platform)
@ -883,7 +898,6 @@ def __init__(self, spec, **kwargs):
target = str(spec.target.family)
# No spack platform family for ia64 or armv7l
if platform == 'linux':
if target == 'x86_64':
platform += '64'
@ -901,21 +915,12 @@ def __init__(self, spec, **kwargs):
if target == 'x86_64':
platform += '64'
# ... and others?
self.arch = platform
# Capitalize first letter of compiler name, which corresponds
# to how OpenFOAM handles things (eg, gcc -> Gcc).
# Use compiler_mapping for special cases.
comp = spec.compiler.name
if comp in self.compiler_mapping:
comp = self.compiler_mapping[comp]
comp = comp.capitalize()
self.compiler = comp
# Build WM_OPTIONS
def update_options(self):
"""Set WM_OPTIONS string consistent with current settings
"""
# WM_OPTIONS
# ----
# WM_LABEL_OPTION=Int$WM_LABEL_SIZE
# WM_OPTIONS_BASE=$WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION