Sleef: fix build on macOS arm64, add test support (#42583)

This commit is contained in:
Adam J. Stewart 2024-02-12 09:59:12 +01:00 committed by GitHub
parent 167a168a63
commit 2d3eeecef8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 32 additions and 23 deletions

View File

@ -188,9 +188,8 @@ class PyTorch(PythonPackage, CudaPackage, ROCmPackage):
# depends_on("cpuinfo@2022-08-19", when="@1.13:2.0")
# depends_on("cpuinfo@2020-12-17", when="@1.8:1.12")
# depends_on("cpuinfo@2020-06-11", when="@1.6:1.7")
# https://github.com/shibatch/sleef/issues/474
# depends_on("sleef@3.5.1_2020-12-22", when="@1.8:")
# depends_on("sleef@3.4.0_2019-07-30", when="@1.6:1.7")
depends_on("sleef@3.5.1_2020-12-22", when="@1.8:")
depends_on("sleef@3.4.0_2019-07-30", when="@1.6:1.7")
depends_on("fp16@2020-05-14", when="@1.6:")
depends_on("pthreadpool@2023-08-29", when="@2.2:")
depends_on("pthreadpool@2021-04-13", when="@1.9:2.1")
@ -626,8 +625,7 @@ def enable_or_disable(variant, keyword="USE", var=None):
# env.set("USE_SYSTEM_LIBS", "ON")
# https://github.com/pytorch/pytorch/issues/60329
# env.set("USE_SYSTEM_CPUINFO", "ON")
# https://github.com/shibatch/sleef/issues/474
# env.set("USE_SYSTEM_SLEEF", "ON")
env.set("USE_SYSTEM_SLEEF", "ON")
env.set("USE_SYSTEM_GLOO", "ON")
env.set("USE_SYSTEM_FP16", "ON")
env.set("USE_SYSTEM_PTHREADPOOL", "ON")

View File

@ -29,35 +29,46 @@ class Sleef(CMakePackage):
"3.4.0_2019-05-13",
commit="9b249c53a80343cc1a394ca961d7d5696ea76409", # py-torch@1.2
git="https://github.com/zdevito/sleef.git",
deprecated=True,
)
version(
"3.3.1_2018-12-09",
commit="191f655caa25526ae226cf88dd2529265176014a", # py-torch@1.1
git="https://github.com/zdevito/sleef.git",
deprecated=True,
)
version(
"3.2_2018-05-09", commit="6ff7a135a1e31979d1e1844a2e7171dfbd34f54f"
"3.2_2018-05-09", commit="6ff7a135a1e31979d1e1844a2e7171dfbd34f54f", deprecated=True
) # py-torch@0.4.1:1.0
version("3.2", sha256="3130c5966e204e6d6a3ace81e543d12b5b21f60897f1c185bfa587c1bd77bee2")
# https://github.com/shibatch/sleef/issues/474
conflicts("%apple-clang@15:")
version(
"3.2",
sha256="3130c5966e204e6d6a3ace81e543d12b5b21f60897f1c185bfa587c1bd77bee2",
deprecated=True,
)
generator("ninja")
depends_on("cmake@3.4.3:", type="build")
depends_on("cmake@3.18:", type="build")
# # https://github.com/shibatch/sleef/issues/475
# depends_on("fftw-api")
# depends_on("mpfr")
# depends_on("openssl")
depends_on("fftw-api", type="test")
depends_on("mpfr", type="test")
depends_on("openssl", type="test")
# # https://github.com/shibatch/sleef/issues/458
# conflicts("^mpfr@4.2:")
# https://github.com/shibatch/sleef/issues/458
# https://github.com/shibatch/sleef/pull/471
conflicts("^mpfr@4.2:", when="@:3.5.1_2023-11-20")
def sleef_define(self, cmake_var, value):
# https://github.com/shibatch/sleef/pull/509
if self.spec.satisfies("@3.5.1_2024-02-07:"):
cmake_var = "SLEEF_" + cmake_var
return self.define(cmake_var, value)
def cmake_args(self):
# https://salsa.debian.org/science-team/sleef/-/blob/master/debian/rules
return [
self.define("BUILD_DFT", False),
self.define("SLEEF_TEST_ALL_IUT", True),
self.define("BUILD_TESTS", False),
]
args = [self.sleef_define("BUILD_TESTS", self.run_tests)]
# https://github.com/shibatch/sleef/issues/474
if self.spec.satisfies("@:3.5.1_2024-02-08 platform=darwin"):
args.append(self.sleef_define("DISABLE_SVE", True))
return args