diff options
author | Oliver Perks <olly.perks@arm.com> | 2021-10-04 13:35:20 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-04 14:35:20 +0200 |
commit | ad98e881734f6b049087ee82b9bc7dd4b5049b31 (patch) | |
tree | 360eae7aef0a044bbaf90ac0bc6efb84c990e33c /var | |
parent | e557730c969181375000dda9ad1e9545502a51fb (diff) | |
download | spack-ad98e881734f6b049087ee82b9bc7dd4b5049b31.tar.gz spack-ad98e881734f6b049087ee82b9bc7dd4b5049b31.tar.bz2 spack-ad98e881734f6b049087ee82b9bc7dd4b5049b31.tar.xz spack-ad98e881734f6b049087ee82b9bc7dd4b5049b31.zip |
arm: added download and better detection (#25460)
Diffstat (limited to 'var')
-rw-r--r-- | var/spack/repos/builtin/packages/arm/package.py | 107 |
1 files changed, 92 insertions, 15 deletions
diff --git a/var/spack/repos/builtin/packages/arm/package.py b/var/spack/repos/builtin/packages/arm/package.py index 9bbb1638c0..c1d149d80f 100644 --- a/var/spack/repos/builtin/packages/arm/package.py +++ b/var/spack/repos/builtin/packages/arm/package.py @@ -2,13 +2,60 @@ # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) -import os.path import re -import llnl.util.tty as tty +from spack import * -import spack.compiler -import spack.util.executable +_os_map = { + 'ubuntu18.04': 'Ubuntu-18.04', + 'ubuntu20.04': 'Ubuntu-20.04', + 'sles15': 'SLES-15', + 'centos7': 'RHEL-7', + 'centos8': 'RHEL-8', + 'amzn2': 'RHEL-7' +} + + +_versions = { + '21.0': { + 'RHEL-7': ( + 'fa67a4b9c1e562ec73e270aa4ef7a969af99bdd792ce8916b69ee47f7906110b', + 'https://developer.arm.com/-/media/Files/downloads/hpc/arm-allinea-studio/21-0/ACfL/arm-compiler-for-linux_21.0_RHEL-7_aarch64.tar' + ), + 'RHEL-8': ( + 'a1bf517fc108100878233610ec5cc9538ee09cd114670bfacab0419bbdef0780', + 'https://developer.arm.com/-/media/Files/downloads/hpc/arm-allinea-studio/21-0/ACfL/arm-compiler-for-linux_21.0_RHEL-8_aarch64.tar' + ), + 'SLES-15': ( + '0307c67425fcf6c2c171c16732353767f79a7dd45e77cd7e4d94675d769cce77', + 'https://developer.arm.com/-/media/Files/downloads/hpc/arm-allinea-studio/21-0/ACfL/arm-compiler-for-linux_21.0_SLES-15_aarch64.tar' + ), + 'Ubuntu-18.04': ( + 'f57bd4652ea87282705073ea81ca108fef8e0725eb4bc441240ec2fc51ff5980', + 'https://developer.arm.com/-/media/Files/downloads/hpc/arm-allinea-studio/21-0/ACfL/arm-compiler-for-linux_21.0_Ubuntu-18.04_aarch64.tar' + ), + 'Ubuntu-20.04': ( + 'dd93254b9fe9baa802baebb9da5d00e0076a639b47f3515a8645b06742900eea', + 'https://developer.arm.com/-/media/Files/downloads/hpc/arm-allinea-studio/21-0/ACfL/arm-compiler-for-linux_21.0_Ubuntu-20.04_aarch64.tar' + ) + } +} + + +def get_os(): + spack_os = spack.architecture.platform().default_os + return _os_map.get(spack_os, 'RHEL-7') + + +def get_acfl_prefix(spec): + acfl_prefix = spec.prefix + return join_path( + acfl_prefix, + 'arm-linux-compiler-{0}_Generic-AArch64_{1}_aarch64-linux'.format( + spec.version, + get_os() + ) + ) class Arm(Package): @@ -19,18 +66,38 @@ class Arm(Package): homepage = "https://developer.arm.com/tools-and-software/server-and-hpc/arm-allinea-studio" url = "https://developer.arm.com/-/media/Files/downloads/hpc/arm-allinea-studio/20-2-1/Ubuntu16.04/arm-compiler-for-linux_20.2.1_Ubuntu-16.04_aarch64.tar" - # FIXME: The version is checksummed for Ubuntu 16.04, but this is not - # FIXME: important at the moment since the package is only meant to - # FIXME: provide detection - version('20.2.1', sha256='dc3f945b05b867809d9b507cb8ebba9cf72a6818d349207dbe1392c13dc0ad79') + maintainers = ['OliverPerks'] - def install(self, spec, prefix): - raise InstallError( - 'No install method available yet, only system detection.' - ) + # Build Versions: establish OS for URL + acfl_os = get_os() + + # Build Versions + for ver, packages in _versions.items(): + pkg = packages.get(acfl_os) + if pkg: + version(ver, sha256=pkg[0], url=pkg[1]) + + # Only install for Aarch64 + conflicts('target=x86_64:', msg='Only available on Aarch64') + conflicts('target=ppc64:', msg='Only available on Aarch64') + conflicts('target=ppc64le:', msg='Only available on Aarch64') executables = [r'armclang', r'armclang\+\+', r'armflang'] + # Licensing + license_required = True + license_comment = "#" + license_files = ["licences/Licence"] + license_vars = ["ARM_LICENSE_DIR"] + license_url = "https://developer.arm.com/tools-and-software/server-and-hpc/help/help-and-tutorials/system-administration/licensing/arm-licence-server" + + # Run the installer with the desired install directory + def install(self, spec, prefix): + exe = Executable('./arm-compiler-for-linux_{0}_{1}.sh'.format( + spec.version, get_os()) + ) + exe("--accept", "--force", "--install-to", prefix) + @classmethod def determine_version(cls, exe): regex_str = r'Arm C\/C\+\+\/Fortran Compiler version ([\d\.]+) '\ @@ -68,7 +135,7 @@ class Arm(Package): assert self.spec.concrete, msg if self.spec.external: return self.spec.extra_attributes['compilers'].get('c', None) - return str(self.spec.prefix.bin.armclang) + return join_path(get_acfl_prefix(self.spec), 'bin', 'armclang') @property def cxx(self): @@ -76,7 +143,7 @@ class Arm(Package): assert self.spec.concrete, msg if self.spec.external: return self.spec.extra_attributes['compilers'].get('cxx', None) - return os.path.join(self.spec.prefix.bin, 'armclang++') + return join_path(get_acfl_prefix(self.spec), 'bin', 'armclang++') @property def fortran(self): @@ -84,4 +151,14 @@ class Arm(Package): assert self.spec.concrete, msg if self.spec.external: return self.spec.extra_attributes['compilers'].get('fortran', None) - return str(self.spec.prefix.bin.armflang) + return join_path(get_acfl_prefix(self.spec), 'bin', 'armflang') + + def setup_run_environment(self, env): + arm_dir = get_acfl_prefix(self.spec) + env.set("ARM_LINUX_COMPILER_DIR", arm_dir) + env.set("ARM_LINUX_COMPILER_INCLUDES", join_path(arm_dir, 'includes')) + env.prepend_path("LD_LIBRARY_PATH", join_path(arm_dir, 'lib')) + env.prepend_path("PATH", join_path(arm_dir, 'bin')) + env.prepend_path("CPATH", join_path(arm_dir, 'include')) + env.prepend_path("MANPATH", join_path(arm_dir, 'share', 'man')) + env.prepend_path("ARM_LICENSE_DIR", join_path(self.prefix, 'licences')) |