PyTorch: build with external sleef (#40763)
Co-authored-by: adamjstewart <adamjstewart@users.noreply.github.com>
This commit is contained in:
parent
8b0ab67de4
commit
bb64b22066
3 changed files with 19 additions and 34 deletions
|
@ -194,10 +194,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/427
|
||||
# depends_on("sleef@3.5.1_2020-12-22", when="@1.8:")
|
||||
# https://github.com/pytorch/pytorch/issues/60334
|
||||
# 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@2021-04-13", when="@1.9:")
|
||||
depends_on("pthreadpool@2020-10-05", when="@1.8")
|
||||
|
@ -308,11 +306,6 @@ class PyTorch(PythonPackage, CudaPackage, ROCmPackage):
|
|||
# Fixes build error when ROCm is enabled for pytorch-1.5 release
|
||||
patch("rocm.patch", when="@1.5+rocm")
|
||||
|
||||
# Fixes fatal error: sleef.h: No such file or directory
|
||||
# https://github.com/pytorch/pytorch/pull/35359
|
||||
# https://github.com/pytorch/pytorch/issues/26555
|
||||
# patch("sleef.patch", when="@:1.5")
|
||||
|
||||
# Fixes compilation with Clang 9.0.0 and Apple Clang 11.0.3
|
||||
# https://github.com/pytorch/pytorch/pull/37086
|
||||
patch(
|
||||
|
@ -628,13 +621,11 @@ def enable_or_disable(variant, keyword="USE", var=None, newer=False):
|
|||
env.set("pybind11_INCLUDE_DIR", self.spec["py-pybind11"].prefix.include)
|
||||
if self.spec.satisfies("@1.10:"):
|
||||
env.set("USE_SYSTEM_PYBIND11", "ON")
|
||||
# https://github.com/pytorch/pytorch/issues/60334
|
||||
# if self.spec.satisfies("@1.8:"):
|
||||
# env.set("USE_SYSTEM_SLEEF", "ON")
|
||||
if self.spec.satisfies("@1.6:"):
|
||||
# env.set("USE_SYSTEM_LIBS", "ON")
|
||||
# https://github.com/pytorch/pytorch/issues/60329
|
||||
# env.set("USE_SYSTEM_CPUINFO", "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")
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
diff --git a/caffe2/CMakeLists.txt b/caffe2/CMakeLists.txt
|
||||
index 8025a7de3c..2e5cdbb5c9 100644
|
||||
--- a/caffe2/CMakeLists.txt
|
||||
+++ b/caffe2/CMakeLists.txt
|
||||
@@ -1232,6 +1232,7 @@ if (BUILD_TEST)
|
||||
add_executable(${test_name} "${test_src}")
|
||||
target_link_libraries(${test_name} ${Caffe2_MAIN_LIBS} gtest_main)
|
||||
target_include_directories(${test_name} PRIVATE $<INSTALL_INTERFACE:include>)
|
||||
+ target_include_directories(${test_name} PRIVATE $<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/include>)
|
||||
target_include_directories(${test_name} PRIVATE ${Caffe2_CPU_INCLUDE})
|
||||
add_test(NAME ${test_name} COMMAND $<TARGET_FILE:${test_name}>)
|
||||
if (INSTALL_TEST)
|
|
@ -14,9 +14,7 @@ class Sleef(CMakePackage):
|
|||
git = "https://github.com/shibatch/sleef.git"
|
||||
|
||||
version("master", branch="master")
|
||||
version(
|
||||
"3.5.1_2020-12-22", commit="e0a003ee838b75d11763aa9c3ef17bf71a725bff"
|
||||
) # py-torch@1.8:1.9
|
||||
version("3.5.1_2020-12-22", commit="e0a003ee838b75d11763aa9c3ef17bf71a725bff") # py-torch@1.8:
|
||||
version(
|
||||
"3.5.1",
|
||||
sha256="415ee9b1bcc5816989d3d4d92afd0cd3f9ee89cbd5a33eb008e69751e40438ab",
|
||||
|
@ -40,17 +38,25 @@ class Sleef(CMakePackage):
|
|||
) # py-torch@0.4.1:1.0
|
||||
version("3.2", sha256="3130c5966e204e6d6a3ace81e543d12b5b21f60897f1c185bfa587c1bd77bee2")
|
||||
|
||||
# Some versions have ICE when building RelWithDebInfo with GCC 7
|
||||
# See https://github.com/shibatch/sleef/issues/234
|
||||
# See https://github.com/pytorch/pytorch/issues/26892
|
||||
# See https://github.com/pytorch/pytorch/pull/26993
|
||||
# https://github.com/shibatch/sleef/issues/474
|
||||
conflicts("%apple-clang@15:")
|
||||
|
||||
generator("ninja")
|
||||
depends_on("cmake@3.4.3:", type="build")
|
||||
|
||||
# # https://github.com/shibatch/sleef/issues/475
|
||||
# depends_on("fftw-api")
|
||||
# depends_on("mpfr")
|
||||
# depends_on("openssl")
|
||||
|
||||
# # https://github.com/shibatch/sleef/issues/458
|
||||
# conflicts("^mpfr@4.2:")
|
||||
|
||||
def cmake_args(self):
|
||||
# Taken from PyTorch's aten/src/ATen/CMakeLists.txt
|
||||
return [
|
||||
self.define("DISABLE_FFTW", True),
|
||||
self.define("DISABLE_MPFR", True),
|
||||
self.define("DISABLE_SSL", True),
|
||||
self.define("BUILD_SHARED_LIBS", False),
|
||||
self.define("BUILD_DFT", False),
|
||||
self.define("BUILD_GNUABI_LIBS", False),
|
||||
self.define("BUILD_TESTS", False),
|
||||
]
|
||||
|
|
Loading…
Reference in a new issue