|
| 1 | +# Copyright 2013-2023 Lawrence Livermore National Security, LLC and other |
| 2 | +# Spack Project Developers. See the top-level COPYRIGHT file for details. |
| 3 | +# |
| 4 | +# SPDX-License-Identifier: (Apache-2.0 OR MIT) |
| 5 | + |
| 6 | +import os |
| 7 | +import platform |
| 8 | +import subprocess |
| 9 | + |
| 10 | +from spack.package import * |
| 11 | + |
| 12 | + |
| 13 | +class LinaroForge(Package): |
| 14 | + """Build reliable and optimized code for the right results on multiple |
| 15 | + Server and HPC architectures, from the latest compilers and C++ standards |
| 16 | + to Intel, 64-bit Arm, AMD, OpenPOWER and Nvidia GPU hardware. Linaro Forge |
| 17 | + combines Linaro DDT, the leading debugger for time-saving high performance |
| 18 | + application debugging, Linaro MAP, the trusted performance profiler for |
| 19 | + invaluable optimization advice across native and Python HPC codes, and |
| 20 | + Linaro Performance Reports for advanced reporting capabilities.""" |
| 21 | + |
| 22 | + homepage = "https://www.linaroforge.com" |
| 23 | + maintainers("kenche-linaro") |
| 24 | + |
| 25 | + if platform.machine() in ["aarch64", "arm64"]: |
| 26 | + version( |
| 27 | + "23.0.3", sha256="a7e23ef2a187f8e2d6a6692cafb931c9bb614abf58e45ea9c2287191c4c44f02" |
| 28 | + ) |
| 29 | + version( |
| 30 | + "23.0.2", sha256="698fda8f7cc05a06909e5dcc50b9956f94135d7b12e84ffb21999a5b45c70c74" |
| 31 | + ) |
| 32 | + version( |
| 33 | + "23.0.1", sha256="552e4a3f408ed4eb5f1bfbb83c94530ee8733579c56c3e98050c0ad2d43eb433" |
| 34 | + ) |
| 35 | + version("23.0", sha256="7ae20bb27d539751d1776d1e09a65dcce821fc6a75f924675439f791261783fb") |
| 36 | + version( |
| 37 | + "22.1.4", sha256="4e2af481a37b4c99dba0de6fac75ac945316955fc4170d06e321530adea7ac9f" |
| 38 | + ) |
| 39 | + version( |
| 40 | + "21.1.3", sha256="4a4ff7372aad5a31fc9e18b7b6c493691ab37d8d44a3158584e62d1ab82b0eeb" |
| 41 | + ) |
| 42 | + elif platform.machine() == "ppc64le": |
| 43 | + version( |
| 44 | + "23.0.3", sha256="5ff9770f4bc4a2df4bac8a2544a9d6bad9fba2556420fa2e659e5c21e741caf7" |
| 45 | + ) |
| 46 | + version( |
| 47 | + "23.0.2", sha256="181b157bdfc8609b49addf63023f920ebb609dbc9a126e9dc26605188b756ff0" |
| 48 | + ) |
| 49 | + version( |
| 50 | + "23.0.1", sha256="08cffef2195ea96872d56e827f320eed40aaa82fd3b62d4c661a598fb2fb3a47" |
| 51 | + ) |
| 52 | + version("23.0", sha256="0962c7e0da0f450cf6daffe1156e1f59e02c9f643df458ec8458527afcde5b4d") |
| 53 | + version( |
| 54 | + "22.1.3", sha256="6479c3a4ae6ce6648c37594eb0266161f06d9f89010fca9299855848661dda49" |
| 55 | + ) |
| 56 | + version( |
| 57 | + "22.0.4", sha256="f4cb5bcbaa67f9209299fe4653186a2829760b8b16a2883913aa43766375b04c" |
| 58 | + ) |
| 59 | + version( |
| 60 | + "21.1.3", sha256="eecbc5686d60994c5468b2d7cd37bebe5d9ac0ba37bd1f98fbfc69b071db541e" |
| 61 | + ) |
| 62 | + elif platform.machine() == "x86_64": |
| 63 | + version( |
| 64 | + "23.0.3", sha256="f2a010b94838f174f057cd89d12d03a89ca946163536eab178dd1ec877cdc27f" |
| 65 | + ) |
| 66 | + version( |
| 67 | + "23.0.2", sha256="565f0c073c6c8cbb06c062ca414e3f6ff8c6ca6797b03d247b030a9fbc55a5b1" |
| 68 | + ) |
| 69 | + version( |
| 70 | + "23.0.1", sha256="1d681891c0c725363f0f45584c9b79e669d5c9782158453b7d24b4b865d72755" |
| 71 | + ) |
| 72 | + version("23.0", sha256="f4ab12289c992dd07cb1a15dd985ef4713d1f9c0cf362ec5e9c995cca9b1cf81") |
| 73 | + version( |
| 74 | + "22.1.3", sha256="4f8a8b1df6ad712e89c82eedf4bd85b93b57b3c8d5b37d13480ff058fa8f4467" |
| 75 | + ) |
| 76 | + version( |
| 77 | + "22.0.4", sha256="a2c8c1da38b9684d7c4656a98b3fc42777b03fd474cd0bf969324804f47587e5" |
| 78 | + ) |
| 79 | + version( |
| 80 | + "21.1.3", sha256="03dc82f1d075deb6f08d1e3e6592dc9b630d406c08a1316d89c436b5874f3407" |
| 81 | + ) |
| 82 | + |
| 83 | + variant( |
| 84 | + "probe", |
| 85 | + default=False, |
| 86 | + description='Detect available PMU counters via "forge-probe" during install', |
| 87 | + ) |
| 88 | + |
| 89 | + variant("accept-eula", default=False, description="Accept the EULA") |
| 90 | + |
| 91 | + # forge-probe executes with "/usr/bin/env python" |
| 92 | + depends_on( "[email protected]:", type="build", when="+probe") |
| 93 | + |
| 94 | + # Licensing |
| 95 | + license_required = False |
| 96 | + |
| 97 | + def url_for_version(self, version): |
| 98 | + pre = "arm" if version < Version("23.0") else "linaro" |
| 99 | + return f"https://downloads.linaroforge.com/{version}/{pre}-forge-{version}-linux-{platform.machine()}.tar" |
| 100 | + |
| 101 | + @run_before("install") |
| 102 | + def abort_without_eula_acceptance(self): |
| 103 | + install_example = "spack install linaro-forge +accept-eula" |
| 104 | + license_terms_path = os.path.join(self.stage.source_path, "license_terms") |
| 105 | + if not self.spec.variants["accept-eula"].value: |
| 106 | + raise InstallError( |
| 107 | + "\n\n\nNOTE:\nUse +accept-eula " |
| 108 | + + "during installation " |
| 109 | + + "to accept the license terms in:\n" |
| 110 | + + " {0}\n".format(os.path.join(license_terms_path, "license_agreement.txt")) |
| 111 | + + " {0}\n\n".format(os.path.join(license_terms_path, "supplementary_terms.txt")) |
| 112 | + + "Example: '{0}'\n".format(install_example) |
| 113 | + ) |
| 114 | + |
| 115 | + def install(self, spec, prefix): |
| 116 | + subprocess.call(["./textinstall.sh", "--accept-license", prefix]) |
| 117 | + if spec.satisfies("+probe"): |
| 118 | + probe = join_path(prefix, "bin", "forge-probe") |
| 119 | + subprocess.call([probe, "--install", "global"]) |
| 120 | + |
| 121 | + def setup_run_environment(self, env): |
| 122 | + # Only PATH is needed for Forge. |
| 123 | + # Adding lib to LD_LIBRARY_PATH can cause conflicts with Forge's internal libs. |
| 124 | + env.clear() |
| 125 | + env.prepend_path("PATH", join_path(self.prefix, "bin")) |
| 126 | + |
| 127 | + @run_after("install") |
| 128 | + def cscs_license(self): |
| 129 | + cscs_license = join_path(self.prefix, "licences", "License") |
| 130 | + with open(cscs_license, "w") as f: |
| 131 | + # will expire end of May/2026 |
| 132 | + f.write("type=2\n") |
| 133 | + f.write("serial_number=17741\n") |
| 134 | + f.write("hostname=velan.cscs.ch\n") |
| 135 | + f.write("serverport=4241\n") |
| 136 | + f.write("features=ddt,map,perf-report,cuda,metrics-pack\n") |
| 137 | + f.write("hash2=b013e17d168ebec7291c66401832d113963c0cb5\n") |
0 commit comments