diff options
author | Massimiliano Culpo <massimiliano.culpo@gmail.com> | 2021-10-04 09:34:53 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-04 09:34:53 +0200 |
commit | 69abc4d860695eeaaa314ac3bf5655b57f2f5b55 (patch) | |
tree | de5e3ea35605cdc2bc5135d80e59be03595abce1 | |
parent | e91815de7cfe7a058cc8cb664f4a5a64329fb6f4 (diff) | |
download | spack-69abc4d860695eeaaa314ac3bf5655b57f2f5b55.tar.gz spack-69abc4d860695eeaaa314ac3bf5655b57f2f5b55.tar.bz2 spack-69abc4d860695eeaaa314ac3bf5655b57f2f5b55.tar.xz spack-69abc4d860695eeaaa314ac3bf5655b57f2f5b55.zip |
Build ppc64le docker images (#26442)
* Update archspec
* Add ppc64le to docker images
-rw-r--r-- | .github/workflows/build-containers.yml | 10 | ||||
-rw-r--r-- | lib/spack/external/__init__.py | 2 | ||||
-rw-r--r-- | lib/spack/external/archspec/cpu/detect.py | 29 | ||||
-rw-r--r-- | lib/spack/external/archspec/cpu/microarchitecture.py | 6 |
4 files changed, 37 insertions, 10 deletions
diff --git a/.github/workflows/build-containers.yml b/.github/workflows/build-containers.yml index 74c7c9e1b1..908c4ebdf2 100644 --- a/.github/workflows/build-containers.yml +++ b/.github/workflows/build-containers.yml @@ -25,11 +25,11 @@ jobs: # A matrix of Dockerfile paths, associated tags, and which architectures # they support. matrix: - dockerfile: [[amazon-linux, amazonlinux-2.dockerfile, 'linux/amd64,linux/arm64'], - [centos7, centos-7.dockerfile, 'linux/amd64,linux/arm64'], - [leap15, leap-15.dockerfile, 'linux/amd64,linux/arm64'], - [ubuntu-xenial, ubuntu-1604.dockerfile, 'linux/amd64,linux/arm64'], - [ubuntu-bionic, ubuntu-1804.dockerfile, 'linux/amd64,linux/arm64']] + dockerfile: [[amazon-linux, amazonlinux-2.dockerfile, 'linux/amd64,linux/arm64'], + [centos7, centos-7.dockerfile, 'linux/amd64,linux/arm64,linux/ppc64le'], + [leap15, leap-15.dockerfile, 'linux/amd64,linux/arm64,linux/ppc64le'], + [ubuntu-xenial, ubuntu-1604.dockerfile, 'linux/amd64,linux/arm64,linux/ppc64le'], + [ubuntu-bionic, ubuntu-1804.dockerfile, 'linux/amd64,linux/arm64,linux/ppc64le']] name: Build ${{ matrix.dockerfile[0] }} steps: - name: Checkout diff --git a/lib/spack/external/__init__.py b/lib/spack/external/__init__.py index 7ae506a46b..112ad9e9af 100644 --- a/lib/spack/external/__init__.py +++ b/lib/spack/external/__init__.py @@ -11,7 +11,7 @@ archspec * Homepage: https://pypi.python.org/pypi/archspec * Usage: Labeling, comparison and detection of microarchitectures -* Version: 0.1.2 (commit 4dbf253daf37e4a008e4beb6489f347b4a35aed4) +* Version: 0.1.2 (commit 8940a8b099a54ded21f8cf4314c4b83b558bb6d1) argparse -------- diff --git a/lib/spack/external/archspec/cpu/detect.py b/lib/spack/external/archspec/cpu/detect.py index eb75cdfb0e..56b73b3a75 100644 --- a/lib/spack/external/archspec/cpu/detect.py +++ b/lib/spack/external/archspec/cpu/detect.py @@ -206,11 +206,26 @@ def host(): # Get a list of possible candidates for this micro-architecture candidates = compatible_microarchitectures(info) + # Sorting criteria for candidates + def sorting_fn(item): + return len(item.ancestors), len(item.features) + + # Get the best generic micro-architecture + generic_candidates = [c for c in candidates if c.vendor == "generic"] + best_generic = max(generic_candidates, key=sorting_fn) + + # Filter the candidates to be descendant of the best generic candidate. + # This is to avoid that the lack of a niche feature that can be disabled + # from e.g. BIOS prevents detection of a reasonably performant architecture + candidates = [c for c in candidates if c > best_generic] + + # If we don't have candidates, return the best generic micro-architecture + if not candidates: + return best_generic + # Reverse sort of the depth for the inheritance tree among only targets we # can use. This gets the newest target we satisfy. - return sorted( - candidates, key=lambda t: (len(t.ancestors), len(t.features)), reverse=True - )[0] + return max(candidates, key=sorting_fn) def compatibility_check(architecture_family): @@ -245,7 +260,13 @@ def compatibility_check_for_power(info, target): """Compatibility check for PPC64 and PPC64LE architectures.""" basename = platform.machine() generation_match = re.search(r"POWER(\d+)", info.get("cpu", "")) - generation = int(generation_match.group(1)) + try: + generation = int(generation_match.group(1)) + except AttributeError: + # There might be no match under emulated environments. For instance + # emulating a ppc64le with QEMU and Docker still reports the host + # /proc/cpuinfo and not a Power + generation = 0 # We can use a target if it descends from our machine type and our # generation (9 for POWER9, etc) is at least its generation. diff --git a/lib/spack/external/archspec/cpu/microarchitecture.py b/lib/spack/external/archspec/cpu/microarchitecture.py index 1b4f6485d5..410d83c3dc 100644 --- a/lib/spack/external/archspec/cpu/microarchitecture.py +++ b/lib/spack/external/archspec/cpu/microarchitecture.py @@ -173,6 +173,12 @@ class Microarchitecture(object): return roots.pop() + @property + def generic(self): + """Returns the best generic architecture that is compatible with self""" + generics = [x for x in [self] + self.ancestors if x.vendor == "generic"] + return max(generics, key=lambda x: len(x.ancestors)) + def to_dict(self, return_list_of_items=False): """Returns a dictionary representation of this object. |