summaryrefslogtreecommitdiff
path: root/lib/spack/llnl
diff options
context:
space:
mode:
authorMassimiliano Culpo <massimiliano.culpo@gmail.com>2020-06-25 18:18:48 +0200
committerGitHub <noreply@github.com>2020-06-25 11:18:48 -0500
commit14599f09be6cd6eac4dc4d9d2d01a0ad001ae3f5 (patch)
tree62b50d312323e206a11a0d8c7b4db58024768439 /lib/spack/llnl
parenta31c115d799c364f60e82fed02ba1fcc80bd935f (diff)
downloadspack-14599f09be6cd6eac4dc4d9d2d01a0ad001ae3f5.tar.gz
spack-14599f09be6cd6eac4dc4d9d2d01a0ad001ae3f5.tar.bz2
spack-14599f09be6cd6eac4dc4d9d2d01a0ad001ae3f5.tar.xz
spack-14599f09be6cd6eac4dc4d9d2d01a0ad001ae3f5.zip
Separate Apple Clang from LLVM Clang (#17110)
* Separate Apple Clang from LLVM Clang Apple Clang is a compiler of its own. All places referring to "-apple" suffix have been updated. * Hack to use a dash in 'apple-clang' To be able to use autodoc from Sphinx we need a valid Python name for the module that contains Apple's Clang code. * Updated packages to account for the existence of apple-clang Co-authored-by: Adam J. Stewart <ajstewart426@gmail.com> * Added unit test for XCode related functions Co-authored-by: Gregory Becker <becker33@llnl.gov> Co-authored-by: Adam J. Stewart <ajstewart426@gmail.com>
Diffstat (limited to 'lib/spack/llnl')
-rw-r--r--lib/spack/llnl/util/cpu/microarchitecture.py29
-rw-r--r--lib/spack/llnl/util/cpu/microarchitectures.json8
2 files changed, 23 insertions, 14 deletions
diff --git a/lib/spack/llnl/util/cpu/microarchitecture.py b/lib/spack/llnl/util/cpu/microarchitecture.py
index f507837f89..284bfebb7e 100644
--- a/lib/spack/llnl/util/cpu/microarchitecture.py
+++ b/lib/spack/llnl/util/cpu/microarchitecture.py
@@ -204,10 +204,22 @@ class Microarchitecture(object):
compiler (str): name of the compiler to be used
version (str): version of the compiler to be used
"""
- # If we don't have information on compiler return an empty string
- if compiler not in self.compilers:
+ # If we don't have information on compiler at all
+ # return an empty string
+ if compiler not in self.family.compilers:
return ''
+ # If we have information but it stops before this
+ # microarchitecture, fall back to the best known target
+ if compiler not in self.compilers:
+ best_target = [
+ x for x in self.ancestors if compiler in x.compilers
+ ][0]
+ msg = ("'{0}' compiler is known to optimize up to the '{1}'"
+ " microarchitecture in the '{2}' architecture family")
+ msg = msg.format(compiler, best_target, best_target.family)
+ raise UnsupportedMicroarchitecture(msg)
+
# If we have information on this compiler we need to check the
# version being used
compiler_info = self.compilers[compiler]
@@ -219,15 +231,10 @@ class Microarchitecture(object):
def satisfies_constraint(entry, version):
min_version, max_version = entry['versions'].split(':')
- # Check version suffixes
- min_version, min_suffix = version_components(min_version)
- max_version, max_suffix = version_components(max_version)
- version, suffix = version_components(version)
-
- # If the suffixes are not all equal there's no match
- if ((suffix != min_suffix and min_version) or
- (suffix != max_suffix and max_version)):
- return False
+ # Extract numeric part of the version
+ min_version, _ = version_components(min_version)
+ max_version, _ = version_components(max_version)
+ version, _ = version_components(version)
# Assume compiler versions fit into semver
tuplify = lambda x: tuple(int(y) for y in x.split('.'))
diff --git a/lib/spack/llnl/util/cpu/microarchitectures.json b/lib/spack/llnl/util/cpu/microarchitectures.json
index 51411d4a24..e94146bf85 100644
--- a/lib/spack/llnl/util/cpu/microarchitectures.json
+++ b/lib/spack/llnl/util/cpu/microarchitectures.json
@@ -61,12 +61,14 @@
"flags": "-march={name} -mtune={name}"
}
],
- "clang": [
+ "apple-clang": [
{
- "versions": "0.0.0-apple:",
+ "versions": ":",
"name": "x86-64",
"flags": "-march={name}"
- },
+ }
+ ],
+ "clang": [
{
"versions": ":",
"name": "x86-64",