Skip to content

Commit 109d5cc

Browse files
committed
Torch: Changed recipe to not use MKL on any platforms
Also, * Changed recipe to use OpenBLAS and not BLIS on Linux platforms. Building with BLIS is broken - it cannot find ATLAS.
1 parent 96d8526 commit 109d5cc

1 file changed

Lines changed: 38 additions & 18 deletions

File tree

T/Torch/build_tarballs.jl

Lines changed: 38 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -38,21 +38,32 @@ if [[ $bb_full_target == *cxx11* ]]; then
3838
cmake_extra_args+="-DGLIBCXX_USE_CXX11_ABI=1 "
3939
fi
4040
41-
if [[ $target == i686-linux-gnu*
42-
|| $target == x86_64-linux-gnu*
43-
|| $target == x86_64-apple-darwin*
41+
# MKL is avoided for all platforms are excluded due to https://github.com/JuliaRegistries/General/pull/68946#issuecomment-1257308450
42+
if [[ 0 -eq 1
43+
# || $target == i686-linux-gnu*
44+
# || $target == x86_64-linux-gnu*
45+
# || $target == x86_64-apple-darwin*
4446
]]; then
4547
cmake_extra_args+="-DBLAS=MKL "
46-
elif [[ $target == aarch64-linux-gnu*
48+
elif [[ $target == x86_64-apple-darwin*
49+
|| $target == aarch64-apple-darwin*
50+
]]; then
51+
cmake_extra_args+="-DBLAS=vecLib "
52+
elif [[ 0 -eq 1
53+
|| $target == aarch64-linux-gnu*
4754
|| $bb_full_target == armv7l-linux-gnu*
55+
|| $target == x86_64-linux-gnu*
4856
|| $target == x86_64-linux-musl*
4957
|| $target == x86_64-unknown-freebsd*
58+
|| $target == x86_64-apple-darwin*
5059
|| $target == aarch64-apple-darwin*
5160
|| $target == i686-w64-mingw32*
5261
|| $target == x86_64-w64-mingw32*
5362
]]; then
5463
cmake_extra_args+="-DBLAS=BLIS "
55-
elif [[ $bb_full_target == armv6l-linux-gnu* ]]; then
64+
elif [[ 0 -eq 1
65+
|| $target == i686-linux-gnu*
66+
]]; then
5667
cmake_extra_args+="-DBLAS=OpenBLAS "
5768
fi
5869
@@ -203,14 +214,20 @@ filter!(p -> arch(p) != "armv7l", platforms) # armv7l is not supported by XNNPAC
203214
filter!(p -> arch(p) != "powerpc64le", platforms) # PowerPC64LE is not supported by XNNPACK
204215
filter!(!Sys.isfreebsd, platforms) # Build fails: Clang v12 crashes compiling aten/src/ATen/native/cpu/MaxUnpoolKernel.cpp.
205216

206-
mkl_platforms = [
207-
Platform("x86_64", "Linux"),
208-
Platform("i686", "Linux"),
209-
Platform("x86_64", "MacOS"),
210-
Platform("x86_64", "Windows"),
217+
accelerate_platforms = [
218+
Platform("aarch64", "macos"),
219+
Platform("x86_64", "macos"),
220+
]
221+
222+
# MKL is avoided for all platforms due to https://github.com/JuliaRegistries/General/pull/68946#issuecomment-1257308450
223+
mkl_platforms = Platform[
224+
# Platform("x86_64", "Linux"),
225+
# Platform("i686", "Linux"),
226+
# Platform("x86_64", "MacOS"),
227+
# Platform("x86_64", "Windows"),
211228
]
212229

213-
blis_platforms = filter(p -> p mkl_platforms, [
230+
blis_platforms = [
214231
Platform("x86_64", "linux"; libc = "glibc"),
215232
Platform("aarch64", "linux"; libc = "glibc"),
216233
Platform("armv7l", "linux"; call_abi = "eabihf", libc = "glibc"),
@@ -219,9 +236,11 @@ blis_platforms = filter(p -> p ∉ mkl_platforms, [
219236
Platform("aarch64", "macos"),
220237
Platform("x86_64", "macos"),
221238
Platform("x86_64", "windows"),
222-
])
239+
]
240+
filter!(p -> p platforms, blis_platforms)
241+
filter!(p -> p union(mkl_platforms, accelerate_platforms), blis_platforms)
223242

224-
openblas_platforms = filter(p -> p union(mkl_platforms, blis_platforms), platforms)
243+
openblas_platforms = filter(p -> p union(mkl_platforms, accelerate_platforms, blis_platforms), platforms)
225244

226245
cuda_platforms = [
227246
Platform("x86_64", "Linux"; cuda = "10.2"),
@@ -232,6 +251,7 @@ for p in cuda_platforms
232251
end
233252

234253
platforms = expand_cxxstring_abis(platforms)
254+
accelerate_platforms = expand_cxxstring_abis(accelerate_platforms)
235255
mkl_platforms = expand_cxxstring_abis(mkl_platforms)
236256
blis_platforms = expand_cxxstring_abis(blis_platforms)
237257
openblas_platforms = expand_cxxstring_abis(openblas_platforms)
@@ -250,13 +270,13 @@ dependencies = [
250270
Dependency("CPUInfo_jll"; compat = "0.0.20201217"),
251271
Dependency("CUDNN_jll", v"8.2.4"; compat = "8", platforms = cuda_platforms),
252272
Dependency("Gloo_jll"; compat = "0.0.20210521", platforms = filter(p -> nbits(p) == 64, platforms)),
253-
Dependency("LAPACK_jll"; platforms = openblas_platforms),
254-
Dependency("MKL_jll"; platforms = mkl_platforms),
255-
BuildDependency("MKL_Headers_jll"; platforms = mkl_platforms),
256-
Dependency("OpenBLAS_jll"; platforms = openblas_platforms),
273+
Dependency("LAPACK_jll"; platforms = union(blis_platforms, openblas_platforms)),
274+
# Dependency("MKL_jll"; platforms = mkl_platforms), # MKL is avoided for all platforms
275+
# BuildDependency("MKL_Headers_jll"; platforms = mkl_platforms), # MKL is avoided for all platforms
276+
Dependency("OpenBLAS_jll"; platforms = union(blis_platforms, openblas_platforms)),
257277
Dependency("PThreadPool_jll"; compat = "0.0.20210414"),
258278
Dependency("SLEEF_jll", v"3.5.2"; compat = "3"),
259-
# Dependency("TensorRT_jll"; platforms = cuda_platforms), # Building with TensorRT is not supported: https://github.com/pytorch/pytorch/issues/60228
279+
# Dependency("TensorRT_jll"; platforms = cuda_platforms), # Building with TensorRT is not supported: https://github.com/pytorch/pytorch/issues/60228
260280
Dependency("XNNPACK_jll"; compat = "0.0.20210622"),
261281
Dependency(PackageSpec("protoc_jll", Base.UUID("c7845625-083e-5bbe-8504-b32d602b7110")); compat="~3.13.0"),
262282
HostBuildDependency(PackageSpec("protoc_jll", Base.UUID("c7845625-083e-5bbe-8504-b32d602b7110"), v"3.13.0")),

0 commit comments

Comments
 (0)