Gentoo Archives: gentoo-commits

From: Andrew Ammerlaan <andrewammerlaan@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/sci:master commit in: sci-libs/pytorch/, sci-libs/pytorch/files/
Date: Sun, 03 Jul 2022 08:37:10
Message-Id: 1656837415.c6c1ae168e2ebd9bb070c31b7468f44ee4884d0d.andrewammerlaan@gentoo
1 commit: c6c1ae168e2ebd9bb070c31b7468f44ee4884d0d
2 Author: Andrew Ammerlaan <andrewammerlaan <AT> gentoo <DOT> org>
3 AuthorDate: Sun Jul 3 08:36:55 2022 +0000
4 Commit: Andrew Ammerlaan <andrewammerlaan <AT> gentoo <DOT> org>
5 CommitDate: Sun Jul 3 08:36:55 2022 +0000
6 URL: https://gitweb.gentoo.org/proj/sci.git/commit/?id=c6c1ae16
7
8 sci-libs/pytorch: moved to ::gentoo
9
10 Signed-off-by: Andrew Ammerlaan <andrewammerlaan <AT> gentoo.org>
11
12 ...-t-build-libtorch-again-for-PyTorch-1.4.0.patch | 30 --
13 ...-t-build-libtorch-again-for-PyTorch-1.7.1.patch | 18 --
14 ...path-to-caffe2-build-dir-made-by-libtorch.patch | 46 ---
15 ...rpath-of-Caffe2-library-for-system-wide-i.patch | 104 -------
16 ...ibrary-directory-according-to-CMake-build.patch | 31 --
17 ...conversion-ambiguity-in-ternary-operators.patch | 38 ---
18 sci-libs/pytorch/files/get_third_parties | 20 --
19 sci-libs/pytorch/files/pytorch-1.10.0-clhpp2.patch | 52 ----
20 .../files/pytorch-1.10.0-fix-distutils.patch | 93 ------
21 sci-libs/pytorch/files/pytorch-1.10.0-nonull.patch | 12 -
22 .../files/pytorch-1.10.1-nccl-nvccflags.patch | 37 ---
23 sci-libs/pytorch/files/pytorch-1.2.0-setup.patch | 24 --
24 .../files/pytorch-1.4.0-nccl-nvccflags.patch | 28 --
25 .../pytorch/files/pytorch-1.4.0-skip-tests.patch | 28 --
26 sci-libs/pytorch/files/pytorch-1.4.0-sleef.patch | 15 -
27 .../files/pytorch-1.6.0-global-dlopen.patch | 15 -
28 .../files/pytorch-1.6.0-nccl-nvccflags.patch | 27 --
29 sci-libs/pytorch/files/pytorch-1.6.0-setup.patch | 14 -
30 .../pytorch/files/pytorch-1.6.0-skip-tests.patch | 14 -
31 .../pytorch-1.6.0-tensorpipe-unbundle-libuv.patch | 13 -
32 .../pytorch/files/pytorch-1.7.1-no-rpath.patch | 12 -
33 sci-libs/pytorch/files/pytorch-1.7.1-setup.patch | 12 -
34 .../pytorch-1.7.1-tensorpipe-unbundle-libuv.patch | 12 -
35 .../files/pytorch-1.7.1-torch_shm_manager.patch | 13 -
36 ...ibrary-directory-according-to-CMake-build.patch | 32 --
37 .../files/pytorch-1.9.1-fix-wrong-hipify.patch | 13 -
38 sci-libs/pytorch/metadata.xml | 34 ---
39 sci-libs/pytorch/pytorch-1.10.2.ebuild | 339 ---------------------
40 28 files changed, 1126 deletions(-)
41
42 diff --git a/sci-libs/pytorch/files/0002-Don-t-build-libtorch-again-for-PyTorch-1.4.0.patch b/sci-libs/pytorch/files/0002-Don-t-build-libtorch-again-for-PyTorch-1.4.0.patch
43 deleted file mode 100644
44 index de9fe9a0d..000000000
45 --- a/sci-libs/pytorch/files/0002-Don-t-build-libtorch-again-for-PyTorch-1.4.0.patch
46 +++ /dev/null
47 @@ -1,30 +0,0 @@
48 -From e5003b88ad3a504eb04c0ba66c2f439149de2ee3 Mon Sep 17 00:00:00 2001
49 -From: Alexey Chernov <4ernov@×××××.com>
50 -Date: Tue, 5 Nov 2019 00:58:17 +0300
51 -Subject: [PATCH 2/7] Don't build `libtorch` again for PyTorch
52 -
53 -If starting with building of `libtorch` using CMake,
54 -don't build it again for the sake of running `setup.py`
55 -to build Python version (PyTorch).
56 ----
57 - setup.py | 7 -------
58 - 1 file changed, 7 deletions(-)
59 -
60 -Index: pytorch-1.4.0_p0/setup.py
61 -===================================================================
62 ---- pytorch-1.4.0_p0.orig/setup.py
63 -+++ pytorch-1.4.0_p0/setup.py
64 -@@ -303,13 +303,6 @@ def build_deps():
65 - check_pydep('yaml', 'pyyaml')
66 - check_pydep('typing', 'typing')
67 -
68 -- build_caffe2(version=version,
69 -- cmake_python_library=cmake_python_library,
70 -- build_python=True,
71 -- rerun_cmake=RERUN_CMAKE,
72 -- cmake_only=CMAKE_ONLY,
73 -- cmake=cmake)
74 --
75 - version_path = os.path.join(cwd, 'torch', 'version.py')
76 - with open(version_path, 'w') as f:
77 - f.write("__version__ = '{}'\n".format(version))
78
79 diff --git a/sci-libs/pytorch/files/0002-Don-t-build-libtorch-again-for-PyTorch-1.7.1.patch b/sci-libs/pytorch/files/0002-Don-t-build-libtorch-again-for-PyTorch-1.7.1.patch
80 deleted file mode 100644
81 index 16d2c1f2e..000000000
82 --- a/sci-libs/pytorch/files/0002-Don-t-build-libtorch-again-for-PyTorch-1.7.1.patch
83 +++ /dev/null
84 @@ -1,18 +0,0 @@
85 -diff --git a/setup.py b/setup.py
86 -index 2db381644c..2241a33015 100644
87 ---- a/setup.py
88 -+++ b/setup.py
89 -@@ -307,13 +307,6 @@ def build_deps():
90 - check_pydep('yaml', 'pyyaml')
91 - check_pydep('typing', 'typing')
92 -
93 -- build_caffe2(version=version,
94 -- cmake_python_library=cmake_python_library,
95 -- build_python=True,
96 -- rerun_cmake=RERUN_CMAKE,
97 -- cmake_only=CMAKE_ONLY,
98 -- cmake=cmake)
99 --
100 - if CMAKE_ONLY:
101 - report('Finished running cmake. Run "ccmake build" or '
102 - '"cmake-gui build" to adjust build options and '
103
104 diff --git a/sci-libs/pytorch/files/0003-Change-path-to-caffe2-build-dir-made-by-libtorch.patch b/sci-libs/pytorch/files/0003-Change-path-to-caffe2-build-dir-made-by-libtorch.patch
105 deleted file mode 100644
106 index f71ba17bc..000000000
107 --- a/sci-libs/pytorch/files/0003-Change-path-to-caffe2-build-dir-made-by-libtorch.patch
108 +++ /dev/null
109 @@ -1,46 +0,0 @@
110 -From dbb0bac77986016217cdfe779499a2ccd0e10570 Mon Sep 17 00:00:00 2001
111 -From: Alexey Chernov <4ernov@×××××.com>
112 -Date: Wed, 6 Nov 2019 00:16:24 +0300
113 -Subject: [PATCH 3/4] Change path to `caffe2` build dir made by `libtorch`
114 -
115 -Setup and use properly `caffe2` build dir made while
116 -`libtorch` building with CMake, so that it was used
117 -by the Python installation.
118 ----
119 - setup.py | 6 +++---
120 - 1 file changed, 3 insertions(+), 3 deletions(-)
121 -
122 -diff --git a/setup.py b/setup.py
123 -index f4bfdc99cd..60502b6add 100644
124 ---- a/setup.py
125 -+++ b/setup.py
126 -@@ -236,7 +236,7 @@ else:
127 - cwd = os.path.dirname(os.path.abspath(__file__))
128 - lib_path = os.path.join(cwd, "torch", "lib")
129 - third_party_path = os.path.join(cwd, "third_party")
130 --caffe2_build_dir = os.path.join(cwd, "build")
131 -+caffe2_build_dir = os.environ.get("CMAKE_BUILD_DIR", os.path.join(cwd, "build"))
132 - # lib/pythonx.x/site-packages
133 - rel_site_packages = distutils.sysconfig.get_python_lib(prefix='')
134 - # full absolute path to the dir above
135 -@@ -279,7 +279,7 @@ elif sha != 'Unknown':
136 - version += '+' + sha[:7]
137 - report("Building wheel {}-{}".format(package_name, version))
138 -
139 --cmake = CMake()
140 -+cmake = CMake(caffe2_build_dir)
141 -
142 - # all the work we need to do _before_ setup runs
143 - def build_deps():
144 -@@ -445,7 +445,7 @@ class build_ext(setuptools.command.build_ext.build_ext):
145 - filename = self.get_ext_filename(fullname)
146 - report("\nCopying extension {}".format(ext.name))
147 -
148 -- src = os.path.join("torch", rel_site_packages, filename)
149 -+ src = os.path.join(caffe2_build_dir, filename)
150 - if not os.path.exists(src):
151 - report("{} does not exist".format(src))
152 - del self.extensions[i]
153 ---
154 -2.23.0
155 -
156
157 diff --git a/sci-libs/pytorch/files/0004-Don-t-fill-rpath-of-Caffe2-library-for-system-wide-i.patch b/sci-libs/pytorch/files/0004-Don-t-fill-rpath-of-Caffe2-library-for-system-wide-i.patch
158 deleted file mode 100644
159 index c8f57d9e6..000000000
160 --- a/sci-libs/pytorch/files/0004-Don-t-fill-rpath-of-Caffe2-library-for-system-wide-i.patch
161 +++ /dev/null
162 @@ -1,104 +0,0 @@
163 -From a0ace7295b6895954d2a0f8d6fe311a34a7c4e85 Mon Sep 17 00:00:00 2001
164 -From: Alexey Chernov <4ernov@×××××.com>
165 -Date: Tue, 12 Nov 2019 02:01:36 +0300
166 -Subject: [PATCH 4/4] Don't fill rpath of Caffe2 library for system-wide
167 - install
168 -
169 -Don't fill in runtime path of Caffe2 library for the case of
170 -building for system-wide installation.
171 ----
172 - CMakeLists.txt | 3 +++
173 - caffe2/CMakeLists.txt | 18 +++++++++++++++---
174 - cmake/Dependencies.cmake | 19 +++++++++++--------
175 - 3 files changed, 29 insertions(+), 11 deletions(-)
176 -
177 -diff --git a/CMakeLists.txt b/CMakeLists.txt
178 -index 20923c0544..45a882ae0e 100644
179 ---- a/CMakeLists.txt
180 -+++ b/CMakeLists.txt
181 -@@ -193,6 +193,9 @@ option(USE_TBB "Use TBB" OFF)
182 - # Used when building Caffe2 through setup.py
183 - option(BUILDING_WITH_TORCH_LIBS "Tell cmake if Caffe2 is being built alongside torch libs" ON)
184 -
185 -+# Used when building Caffe2 for further system-wide installation
186 -+option(BUILDING_SYSTEM_WIDE "Tell cmake if Caffe2 is being built for system-wide installation" OFF)
187 -+
188 - # /Z7 override option
189 - # When generating debug symbols, CMake default to use the flag /Zi.
190 - # However, it is not compatible with sccache. So we rewrite it off.
191 -diff --git a/caffe2/CMakeLists.txt b/caffe2/CMakeLists.txt
192 -index 1f7d037243..30d5615cdb 100644
193 ---- a/caffe2/CMakeLists.txt
194 -+++ b/caffe2/CMakeLists.txt
195 -@@ -1235,7 +1235,11 @@ if (BUILD_PYTHON)
196 - if (MSVC AND BUILD_SHARED_LIBS)
197 - install(FILES $<TARGET_PDB_FILE:caffe2_pybind11_state> DESTINATION "${PYTHON_LIB_REL_PATH}/caffe2/python" OPTIONAL)
198 - endif()
199 -- set_target_properties(caffe2_pybind11_state PROPERTIES INSTALL_RPATH "${caffe2_pybind11_rpath}")
200 -+ if (NOT BUILDING_SYSTEM_WIDE)
201 -+ set_target_properties(caffe2_pybind11_state PROPERTIES INSTALL_RPATH "${caffe2_pybind11_rpath}")
202 -+else()
203 -+ set_target_properties(caffe2_pybind11_state PROPERTIES SKIP_BUILD_RPATH ON)
204 -+ endif()
205 -
206 - if(USE_CUDA)
207 - add_library(caffe2_pybind11_state_gpu MODULE ${Caffe2_GPU_PYTHON_SRCS})
208 -@@ -1261,7 +1265,11 @@ if (BUILD_PYTHON)
209 - if (MSVC AND BUILD_SHARED_LIBS)
210 - install(FILES $<TARGET_PDB_FILE:caffe2_pybind11_state_gpu> DESTINATION "${PYTHON_LIB_REL_PATH}/caffe2/python" OPTIONAL)
211 - endif()
212 -- set_target_properties(caffe2_pybind11_state_gpu PROPERTIES INSTALL_RPATH "${caffe2_pybind11_rpath}")
213 -+ if (NOT BUILDING_SYSTEM_WIDE)
214 -+ set_target_properties(caffe2_pybind11_state_gpu PROPERTIES INSTALL_RPATH "${caffe2_pybind11_rpath}")
215 -+ else()
216 -+ set_target_properties(caffe2_pybind11_state_gpu PROPERTIES SKIP_BUILD_RPATH ON)
217 -+ endif()
218 - endif()
219 -
220 - if(USE_ROCM)
221 -@@ -1284,7 +1292,11 @@ if (BUILD_PYTHON)
222 - caffe2_pybind11_state_hip PROPERTIES LIBRARY_OUTPUT_DIRECTORY
223 - ${CMAKE_BINARY_DIR}/caffe2/python)
224 - install(TARGETS caffe2_pybind11_state_hip DESTINATION "${PYTHON_LIB_REL_PATH}/caffe2/python")
225 -- set_target_properties(caffe2_pybind11_state_hip PROPERTIES INSTALL_RPATH "${caffe2_pybind11_rpath}")
226 -+ if (NOT BUILDING_SYSTEM_WIDE)
227 -+ set_target_properties(caffe2_pybind11_state_hip PROPERTIES INSTALL_RPATH "${caffe2_pybind11_rpath}")
228 -+ else()
229 -+ set_target_properties(caffe2_pybind11_state_hip PROPERTIES SKIP_BUILD_RPATH ON)
230 -+ endif()
231 - endif()
232 -
233 - if (MSVC AND CMAKE_GENERATOR MATCHES "Visual Studio")
234 -diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake
235 -index a8e9769536..6ef9d7b0e2 100644
236 ---- a/cmake/Dependencies.cmake
237 -+++ b/cmake/Dependencies.cmake
238 -@@ -6,14 +6,17 @@ if (APPLE)
239 - else()
240 - set(_rpath_portable_origin $ORIGIN)
241 - endif(APPLE)
242 --# Use separate rpaths during build and install phases
243 --set(CMAKE_SKIP_BUILD_RPATH FALSE)
244 --# Don't use the install-rpath during the build phase
245 --set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
246 --set(CMAKE_INSTALL_RPATH "${_rpath_portable_origin}")
247 --# Automatically add all linked folders that are NOT in the build directory to
248 --# the rpath (per library?)
249 --set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
250 -+
251 -+if (NOT BUILDING_SYSTEM_WIDE)
252 -+ # Use separate rpaths during build and install phases
253 -+ set(CMAKE_SKIP_BUILD_RPATH FALSE)
254 -+ # Don't use the install-rpath during the build phase
255 -+ set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
256 -+ set(CMAKE_INSTALL_RPATH "${_rpath_portable_origin}")
257 -+ # Automatically add all linked folders that are NOT in the build directory to
258 -+ # the rpath (per library?)
259 -+ set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
260 -+endif()
261 -
262 - # UBSAN triggers when compiling protobuf, so we need to disable it.
263 - set(UBSAN_FLAG "-fsanitize=undefined")
264 ---
265 -2.23.0
266 -
267
268 diff --git a/sci-libs/pytorch/files/0005-Change-library-directory-according-to-CMake-build.patch b/sci-libs/pytorch/files/0005-Change-library-directory-according-to-CMake-build.patch
269 deleted file mode 100644
270 index 324b8f682..000000000
271 --- a/sci-libs/pytorch/files/0005-Change-library-directory-according-to-CMake-build.patch
272 +++ /dev/null
273 @@ -1,31 +0,0 @@
274 -From 52019a3f395e5fa97b26d424152d91f73b400f8e Mon Sep 17 00:00:00 2001
275 -From: Alexey Chernov <4ernov@×××××.com>
276 -Date: Wed, 13 Nov 2019 23:44:12 +0300
277 -Subject: [PATCH 5/5] Change library directory according to CMake build
278 -
279 -Change `lib_path` in favour of out-of-tree CMake build
280 -directory, so that all the C++ libraries be found.
281 ----
282 - setup.py | 5 +++--
283 - 1 file changed, 3 insertions(+), 2 deletions(-)
284 -
285 -diff --git a/setup.py b/setup.py
286 -index 60502b6add..cbced52192 100644
287 ---- a/setup.py
288 -+++ b/setup.py
289 -@@ -234,9 +234,10 @@ else:
290 -
291 - # Constant known variables used throughout this file
292 - cwd = os.path.dirname(os.path.abspath(__file__))
293 --lib_path = os.path.join(cwd, "torch", "lib")
294 -+cmake_build_dir = os.environ.get("CMAKE_BUILD_DIR", os.path.join(cwd, "build"))
295 -+lib_path = os.path.join(cmake_build_dir, "lib")
296 - third_party_path = os.path.join(cwd, "third_party")
297 --caffe2_build_dir = os.environ.get("CMAKE_BUILD_DIR", os.path.join(cwd, "build"))
298 -+caffe2_build_dir = cmake_build_dir
299 - # lib/pythonx.x/site-packages
300 - rel_site_packages = distutils.sysconfig.get_python_lib(prefix='')
301 - # full absolute path to the dir above
302 ---
303 -2.23.0
304 -
305
306 diff --git a/sci-libs/pytorch/files/0010-Remove-conversion-ambiguity-in-ternary-operators.patch b/sci-libs/pytorch/files/0010-Remove-conversion-ambiguity-in-ternary-operators.patch
307 deleted file mode 100644
308 index 49835d201..000000000
309 --- a/sci-libs/pytorch/files/0010-Remove-conversion-ambiguity-in-ternary-operators.patch
310 +++ /dev/null
311 @@ -1,38 +0,0 @@
312 -From 0f3a0d9a948fdd8481a5f7751a255ecd9ed4d37a Mon Sep 17 00:00:00 2001
313 -From: Alexey Chernov <4ernov@×××××.com>
314 -Date: Mon, 20 Jan 2020 01:21:22 +0300
315 -Subject: [PATCH 3/3] Remove conversion ambiguity in ternary operators
316 -
317 -It fails to compile with recent versions of Clang
318 -(namely, version 10 used behind HCC compiler when
319 -being built with ROCm support) with the
320 -`conditional expression is ambiguous` error.
321 ----
322 - caffe2/operators/relu_op.cu | 4 ++--
323 - 1 file changed, 2 insertions(+), 2 deletions(-)
324 -
325 -diff --git a/caffe2/operators/relu_op.cu b/caffe2/operators/relu_op.cu
326 -index f6edf7105e..ab49540fc9 100644
327 ---- a/caffe2/operators/relu_op.cu
328 -+++ b/caffe2/operators/relu_op.cu
329 -@@ -51,7 +51,7 @@ __global__ void ReluCUDAKernel<half2>(const int N, const half2* X, half2* Y) {
330 - #else
331 - const float2 xx = __half22float2(X[i]);
332 - Y[i] =
333 -- __floats2half2_rn(xx.x > 0.0f ? xx.x : 0.0f, xx.y > 0.0f ? xx.y : 0.0f);
334 -+ __floats2half2_rn(xx.x > 0.0f ? float(xx.x) : 0.0f, xx.y > 0.0f ? float(xx.y) : 0.0f);
335 - #endif
336 - }
337 - }
338 -@@ -101,7 +101,7 @@ __global__ void ReluGradientCUDAKernel<half2>(
339 - const float2 dy = __half22float2(dY[i]);
340 - const float2 yy = __half22float2(Y[i]);
341 - dX[i] =
342 -- __floats2half2_rn(yy.x > 0.0f ? dy.x : 0.0f, yy.y > 0.0f ? dy.y : 0.0f);
343 -+ __floats2half2_rn(yy.x > 0.0f ? float(dy.x) : 0.0f, yy.y > 0.0f ? float(dy.y) : 0.0f);
344 - #endif
345 - }
346 - }
347 ---
348 -2.24.1
349 -
350
351 diff --git a/sci-libs/pytorch/files/get_third_parties b/sci-libs/pytorch/files/get_third_parties
352 deleted file mode 100644
353 index 8c38a9b73..000000000
354 --- a/sci-libs/pytorch/files/get_third_parties
355 +++ /dev/null
356 @@ -1,20 +0,0 @@
357 -#!/bin/bash
358 -
359 -path_url() {
360 - local dir=$(dirname $1)/
361 - git config --file $1 --get-regexp '(path|url)' | sed -r -e "N;s,[^ ]* ([^ ]*)\n[^ ]* ([^ ]*),${dir#./}\1 \2,"
362 -}
363 -
364 -join \
365 - <(for gm in $(find . -name '.gitmodules' | sort -r); do path_url $gm; done | sort -u) \
366 - <(git submodule status --recursive | awk '{print $2 " " $1}' | sort -u) | \
367 -while read path url hash; do
368 - [[ ${path} =~ (eigen|six|ios|neon2sse|protobuf|pybind11|python-enum|tbb|zstd|fbjni) ]] && continue
369 - u=${url%.git}
370 - hfull=${hash#-}
371 - h=${hfull:0:8}
372 - p=$(basename $u)
373 - echo "${u}/archive/${h}.tar.gz -> ${p}-${h}.tar.gz" >> SRC_URI
374 - [[ $p = fbgemm ]] && p=${p^^}
375 - echo "rmdir ${path} && ln -sv \"\${WORKDIR}\"/${p}-${hfull} ${path}" >> src_prepare
376 -done
377
378 diff --git a/sci-libs/pytorch/files/pytorch-1.10.0-clhpp2.patch b/sci-libs/pytorch/files/pytorch-1.10.0-clhpp2.patch
379 deleted file mode 100644
380 index 9c267dc6e..000000000
381 --- a/sci-libs/pytorch/files/pytorch-1.10.0-clhpp2.patch
382 +++ /dev/null
383 @@ -1,52 +0,0 @@
384 -diff --git a/caffe2/contrib/opencl/OpenCL/cl.hpp b/caffe2/contrib/opencl/OpenCL/cl.hpp
385 -index 87cc4a1..7c27e33 100644
386 ---- a/caffe2/contrib/opencl/OpenCL/cl.hpp
387 -+++ b/caffe2/contrib/opencl/OpenCL/cl.hpp
388 -@@ -76,7 +76,7 @@
389 - * #if defined(__APPLE__) || defined(__MACOSX)
390 - * #include <OpenCL/cl.hpp>
391 - * #else
392 -- * #include <CL/cl.hpp>
393 -+ * #include <CL/cl2.hpp>
394 - * #endif
395 - * #include <cstdio>
396 - * #include <cstdlib>
397 -diff --git a/caffe2/contrib/opencl/context.h b/caffe2/contrib/opencl/context.h
398 -index b1e61c2..968d3c7 100644
399 ---- a/caffe2/contrib/opencl/context.h
400 -+++ b/caffe2/contrib/opencl/context.h
401 -@@ -11,7 +11,7 @@
402 - #if defined(__APPLE__) || defined(__MACOSX)
403 - #include <OpenCL/cl.hpp>
404 - #else
405 --#include <CL/cl.hpp>
406 -+#include <CL/cl2.hpp>
407 - #endif
408 -
409 - #define OPENCL_CHECK(expr) (void)expr
410 -diff --git a/caffe2/mobile/contrib/libopencl-stub/include/CL/cl.hpp b/caffe2/mobile/contrib/libopencl-stub/include/CL/cl.hpp
411 -index f3badf7..928c9f0 100644
412 ---- a/caffe2/mobile/contrib/libopencl-stub/include/CL/cl.hpp
413 -+++ b/caffe2/mobile/contrib/libopencl-stub/include/CL/cl.hpp
414 -@@ -76,7 +76,7 @@
415 - * #if defined(__APPLE__) || defined(__MACOSX)
416 - * #include <OpenCL/cl.hpp>
417 - * #else
418 -- * #include <CL/cl.hpp>
419 -+ * #include <CL/cl2.hpp>
420 - * #endif
421 - * #include <cstdio>
422 - * #include <cstdlib>
423 -diff --git a/third_party/tensorflow_cuda_bazel_build/cuda/BUILD b/third_party/tensorflow_cuda_bazel_build/cuda/BUILD
424 -index f7271af..334f4ec 100755
425 ---- a/third_party/tensorflow_cuda_bazel_build/cuda/BUILD
426 -+++ b/third_party/tensorflow_cuda_bazel_build/cuda/BUILD
427 -@@ -188,7 +188,7 @@ CUDA_INCLUDES_FILES = [
428 - "include/CL/cl_gl_ext.h",
429 - "include/CL/cl_gl.h",
430 - "include/CL/cl.h",
431 -- "include/CL/cl.hpp",
432 -+ "include/CL/cl2.hpp",
433 - "include/CL/cl_platform.h",
434 - "include/CL/opencl.h",
435 - "include/common_functions.h",
436
437 diff --git a/sci-libs/pytorch/files/pytorch-1.10.0-fix-distutils.patch b/sci-libs/pytorch/files/pytorch-1.10.0-fix-distutils.patch
438 deleted file mode 100644
439 index 334bcda6f..000000000
440 --- a/sci-libs/pytorch/files/pytorch-1.10.0-fix-distutils.patch
441 +++ /dev/null
442 @@ -1,93 +0,0 @@
443 -This fix distutils-r1_src_install failure with setuptools-59
444 -
445 -From 9af2edb158b3603c44eff6e12896f1d215e8b898 Mon Sep 17 00:00:00 2001
446 -From: Nikita Shulga <nshulga@××.com>
447 -Date: Tue, 14 Dec 2021 07:15:34 -0800
448 -Subject: [PATCH] Properly import LooseVersion
449 -
450 -This fixes regression introduced by https://github.com/pytorch/pytorch/pull/57040
451 -
452 -Somehow importing `distutils` from `setuptool` caused import of
453 -`distutils.versions`, which is not a documented dependency and got
454 -change with the release of
455 -[setuptools-59.6.0](https://github.com/pypa/setuptools/tree/v59.6.0)
456 -We should not rely on that, as
457 -`import distutils` never re-imports `distutils.version`, which one can
458 -see by observing
459 -https://github.com/python/cpython/blob/3.9/Lib/distutils/__init__.py
460 -or by running:
461 -```
462 -% python3 -c "import distutils;print(distutils.__version__, dir(distutils))"
463 -3.7.5 ['__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__path__', '__spec__', '__version__', 'sys']
464 -% python3 -c "from setuptools import distutils;print(distutils.__version__, dir(distutils))"
465 -3.7.5 ['__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__path__', '__spec__', '__version__', 'archive_util', 'ccompiler', 'cmd', 'config', 'core', 'debug', 'dep_util', 'dir_util', 'dist', 'errors', 'extension', 'fancy_getopt', 'file_util', 'filelist', 'log', 'spawn', 'sys', 'sysconfig', 'util', 'version']
466 -```
467 ----
468 - test/run_test.py | 4 ++--
469 - tools/setup_helpers/cmake.py | 8 ++++----
470 - torch/testing/_internal/common_methods_invocations.py | 8 ++++----
471 - 3 files changed, 10 insertions(+), 10 deletions(-)
472 -
473 -diff --git a/tools/setup_helpers/cmake.py b/tools/setup_helpers/cmake.py
474 -index 01e87b4bca879..686b5c4a34f4c 100644
475 ---- a/tools/setup_helpers/cmake.py
476 -+++ b/tools/setup_helpers/cmake.py
477 -@@ -8,7 +8,7 @@
478 - from subprocess import check_call, check_output, CalledProcessError
479 - import sys
480 - import sysconfig
481 --from setuptools import distutils # type: ignore[import]
482 -+from distutils.version import LooseVersion
483 - from typing import IO, Any, Dict, List, Optional, Union, cast
484 -
485 - from . import which
486 -@@ -120,10 +120,10 @@ def _get_cmake_command() -> str:
487 - return cmake_command
488 - cmake3 = which('cmake3')
489 - cmake = which('cmake')
490 -- if cmake3 is not None and CMake._get_version(cmake3) >= distutils.version.LooseVersion("3.10.0"):
491 -+ if cmake3 is not None and CMake._get_version(cmake3) >= LooseVersion("3.10.0"):
492 - cmake_command = 'cmake3'
493 - return cmake_command
494 -- elif cmake is not None and CMake._get_version(cmake) >= distutils.version.LooseVersion("3.10.0"):
495 -+ elif cmake is not None and CMake._get_version(cmake) >= LooseVersion("3.10.0"):
496 - return cmake_command
497 - else:
498 - raise RuntimeError('no cmake or cmake3 with version >= 3.10.0 found')
499 -@@ -134,7 +134,7 @@ def _get_version(cmd: str) -> Any:
500 -
501 - for line in check_output([cmd, '--version']).decode('utf-8').split('\n'):
502 - if 'version' in line:
503 -- return distutils.version.LooseVersion(line.strip().split(' ')[2])
504 -+ return LooseVersion(line.strip().split(' ')[2])
505 - raise RuntimeError('no version found')
506 -
507 - def run(self, args: List[str], env: Dict[str, str]) -> None:
508 -diff --git a/torch/testing/_internal/common_methods_invocations.py b/torch/testing/_internal/common_methods_invocations.py
509 -index b66e6470b590c..6ec77c2b0ce2e 100644
510 ---- a/torch/testing/_internal/common_methods_invocations.py
511 -+++ b/torch/testing/_internal/common_methods_invocations.py
512 -@@ -40,7 +40,7 @@
513 - freeze_rng_state)
514 - import torch.testing._internal.opinfo_helper as opinfo_helper
515 -
516 --from setuptools import distutils
517 -+from distutils.version import LooseVersion
518 -
519 - has_scipy_fft = False
520 - if TEST_SCIPY:
521 -@@ -14008,11 +14008,11 @@ def ref_pairwise_distance(input1, input2):
522 - skips=(
523 - # Reference: https://github.com/pytorch/pytorch/pull/49155#issuecomment-742664611
524 - DecorateInfo(unittest.skip("Skipped!"), 'TestUnaryUfuncs', 'test_reference_numerics_extremal',
525 -- active_if=TEST_SCIPY and distutils.version.LooseVersion(scipy.__version__) < "1.4.0"),
526 -+ active_if=TEST_SCIPY and LooseVersion(scipy.__version__) < "1.4.0"),
527 - DecorateInfo(unittest.skip("Skipped!"), 'TestUnaryUfuncs', 'test_reference_numerics_hard',
528 -- active_if=TEST_SCIPY and distutils.version.LooseVersion(scipy.__version__) < "1.4.0"),
529 -+ active_if=TEST_SCIPY and LooseVersion(scipy.__version__) < "1.4.0"),
530 - DecorateInfo(unittest.skip("Skipped!"), 'TestUnaryUfuncs', 'test_reference_numerics_normal',
531 -- active_if=TEST_SCIPY and distutils.version.LooseVersion(scipy.__version__) < "1.4.0"),
532 -+ active_if=TEST_SCIPY and LooseVersion(scipy.__version__) < "1.4.0"),
533 - )),
534 - UnaryUfuncInfo('lgamma',
535 - ref=reference_lgamma if TEST_SCIPY else _NOTHING,
536
537 diff --git a/sci-libs/pytorch/files/pytorch-1.10.0-nonull.patch b/sci-libs/pytorch/files/pytorch-1.10.0-nonull.patch
538 deleted file mode 100644
539 index adc258556..000000000
540 --- a/sci-libs/pytorch/files/pytorch-1.10.0-nonull.patch
541 +++ /dev/null
542 @@ -1,12 +0,0 @@
543 ---- a/torch/csrc/jit/frontend/ir_emitter.cpp 2021-10-15 05:35:23.000000000 +0400
544 -+++ b/torch/csrc/jit/frontend/ir_emitter.cpp 2021-10-15 05:35:23.000000000 +0400
545 -@@ -1678,7 +1678,7 @@
546 - << "Union type annotation `" << type_hint->repr_str()
547 - << "` can hold " << vector_repr.str() << ", but none of "
548 - << "those list types can hold the types of the given dict"
549 -- << " elements, which were unified to " << candidate->repr_str();
550 -+ << " elements, which were unified";
551 - } else {
552 - refined_type_hint = candidate;
553 - }
554 -
555
556 diff --git a/sci-libs/pytorch/files/pytorch-1.10.1-nccl-nvccflags.patch b/sci-libs/pytorch/files/pytorch-1.10.1-nccl-nvccflags.patch
557 deleted file mode 100644
558 index 0ac12a1e7..000000000
559 --- a/sci-libs/pytorch/files/pytorch-1.10.1-nccl-nvccflags.patch
560 +++ /dev/null
561 @@ -1,37 +0,0 @@
562 -From 7b04cd503fa1a6265893e0320ee246bcc0bd98cf Mon Sep 17 00:00:00 2001
563 -From: Miezhiko <Miezhiko@×××××.com>
564 -Date: Mon, 27 Dec 2021 14:48:12 +0400
565 -Subject: [PATCH] neutral flags
566 -
567 ----
568 - makefiles/common.mk | 10 +---------
569 - 1 file changed, 1 insertion(+), 9 deletions(-)
570 -
571 -diff --git a/makefiles/common.mk b/makefiles/common.mk
572 -index 64f8d2dc6..7a979c90f 100644
573 ---- a/makefiles/common.mk
574 -+++ b/makefiles/common.mk
575 -@@ -55,7 +55,7 @@ CXXFLAGS := -DCUDA_MAJOR=$(CUDA_MAJOR) -DCUDA_MINOR=$(CUDA_MINOR) -fPIC -fvisi
576 - # Maxrregcount needs to be set accordingly to NCCL_MAX_NTHREADS (otherwise it will cause kernel launch errors)
577 - # 512 : 120, 640 : 96, 768 : 80, 1024 : 60
578 - # We would not have to set this if we used __launch_bounds__, but this only works on kernels, not on functions.
579 --NVCUFLAGS := -ccbin $(CXX) $(NVCC_GENCODE) -std=c++11 --expt-extended-lambda -Xptxas -maxrregcount=96 -Xfatbin -compress-all
580 -+NVCUFLAGS := $(NVCCFLAGS) $(NVCC_GENCODE) -std=c++11 --expt-extended-lambda -Xptxas -maxrregcount=96 -Xfatbin -compress-all
581 - # Use addprefix so that we can specify more than one path
582 - NVLDFLAGS := -L${CUDA_LIB} -lcudart -lrt
583 -
584 -@@ -69,14 +69,6 @@ NVLDFLAGS += ${GCOV_FLAGS:%=-Xcompiler %}
585 - # $(warning GCOV_FLAGS=${GCOV_FLAGS})
586 - ########## GCOV ##########
587 -
588 --ifeq ($(DEBUG), 0)
589 --NVCUFLAGS += -O3
590 --CXXFLAGS += -O3 -g
591 --else
592 --NVCUFLAGS += -O0 -G -g
593 --CXXFLAGS += -O0 -g -ggdb3
594 --endif
595 --
596 - ifneq ($(VERBOSE), 0)
597 - NVCUFLAGS += -Xptxas -v -Xcompiler -Wall,-Wextra,-Wno-unused-parameter
598 - CXXFLAGS += -Wall -Wextra
599
600 diff --git a/sci-libs/pytorch/files/pytorch-1.2.0-setup.patch b/sci-libs/pytorch/files/pytorch-1.2.0-setup.patch
601 deleted file mode 100644
602 index 85e796a60..000000000
603 --- a/sci-libs/pytorch/files/pytorch-1.2.0-setup.patch
604 +++ /dev/null
605 @@ -1,24 +0,0 @@
606 -Index: pytorch-1.4.0_p0/setup.py
607 -===================================================================
608 ---- pytorch-1.4.0_p0.orig/setup.py
609 -+++ pytorch-1.4.0_p0/setup.py
610 -@@ -288,9 +288,7 @@ def build_deps():
611 - sys.exit(1)
612 -
613 - check_file(os.path.join(third_party_path, "gloo", "CMakeLists.txt"))
614 -- check_file(os.path.join(third_party_path, "pybind11", "CMakeLists.txt"))
615 - check_file(os.path.join(third_party_path, 'cpuinfo', 'CMakeLists.txt'))
616 -- check_file(os.path.join(third_party_path, 'tbb', 'Makefile'))
617 - check_file(os.path.join(third_party_path, 'onnx', 'CMakeLists.txt'))
618 - check_file(os.path.join(third_party_path, 'foxi', 'CMakeLists.txt'))
619 - check_file(os.path.join(third_party_path, 'QNNPACK', 'CMakeLists.txt'))
620 -@@ -341,9 +339,6 @@ def build_deps():
621 - if not same:
622 - shutil.copyfile(orig_file, sym_file)
623 -
624 -- dir_util.copy_tree('third_party/pybind11/include/pybind11/',
625 -- 'torch/include/pybind11')
626 --
627 - ################################################################################
628 - # Building dependent libraries
629 - ################################################################################
630
631 diff --git a/sci-libs/pytorch/files/pytorch-1.4.0-nccl-nvccflags.patch b/sci-libs/pytorch/files/pytorch-1.4.0-nccl-nvccflags.patch
632 deleted file mode 100644
633 index 165e79dd4..000000000
634 --- a/sci-libs/pytorch/files/pytorch-1.4.0-nccl-nvccflags.patch
635 +++ /dev/null
636 @@ -1,28 +0,0 @@
637 -Index: nccl-7c72dee660e4d055b81721dd6b03e4e1c0a983cf/makefiles/common.mk
638 -===================================================================
639 ---- nccl-7c72dee660e4d055b81721dd6b03e4e1c0a983cf.orig/makefiles/common.mk
640 -+++ nccl-7c72dee660e4d055b81721dd6b03e4e1c0a983cf/makefiles/common.mk
641 -@@ -46,7 +46,7 @@ endif
642 - CXXFLAGS := -DCUDA_MAJOR=$(CUDA_MAJOR) -DCUDA_MINOR=$(CUDA_MINOR) -fPIC -fvisibility=hidden
643 - CXXFLAGS += -Wall -Wno-unused-function -Wno-sign-compare -std=c++11 -Wvla
644 - CXXFLAGS += -I $(CUDA_INC)
645 --NVCUFLAGS := -ccbin $(CXX) $(NVCC_GENCODE) -lineinfo -std=c++11 -Xptxas -maxrregcount=96 -Xfatbin -compress-all
646 -+NVCUFLAGS := $(NVCCFLAGS) $(NVCC_GENCODE) -lineinfo -std=c++11 -Xptxas -maxrregcount=96 -Xfatbin -compress-all
647 - # Use addprefix so that we can specify more than one path
648 - NVLDFLAGS := -L${CUDA_LIB} -lcudart -lrt
649 -
650 -@@ -60,14 +60,6 @@ NVLDFLAGS += ${GCOV_FLAGS:%=-Xcompiler
651 - # $(warning GCOV_FLAGS=${GCOV_FLAGS})
652 - ########## GCOV ##########
653 -
654 --ifeq ($(DEBUG), 0)
655 --NVCUFLAGS += -O3
656 --CXXFLAGS += -O3 -g
657 --else
658 --NVCUFLAGS += -O0 -G -g
659 --CXXFLAGS += -O0 -g -ggdb3
660 --endif
661 --
662 - ifneq ($(VERBOSE), 0)
663 - NVCUFLAGS += -Xptxas -v -Xcompiler -Wall,-Wextra,-Wno-unused-parameter
664 - CXXFLAGS += -Wall -Wextra
665
666 diff --git a/sci-libs/pytorch/files/pytorch-1.4.0-skip-tests.patch b/sci-libs/pytorch/files/pytorch-1.4.0-skip-tests.patch
667 deleted file mode 100644
668 index 3682469d7..000000000
669 --- a/sci-libs/pytorch/files/pytorch-1.4.0-skip-tests.patch
670 +++ /dev/null
671 @@ -1,28 +0,0 @@
672 -Disable expected test failures.
673 -
674 -TCPStoreTest is too slow to run.
675 -
676 -Reference: https://github.com/pytorch/pytorch/issues/13746
677 -Reference: https://github.com/pytorch/pytorch/issues/21873
678 -
679 -Index: pytorch-1.4.0_p0/torch/lib/c10d/test/CMakeLists.txt
680 -===================================================================
681 ---- pytorch-1.4.0_p0.orig/torch/lib/c10d/test/CMakeLists.txt
682 -+++ pytorch-1.4.0_p0/torch/lib/c10d/test/CMakeLists.txt
683 -@@ -14,7 +14,6 @@ function(c10d_add_test test_src)
684 - endfunction()
685 -
686 - c10d_add_test(FileStoreTest.cpp c10d)
687 --c10d_add_test(TCPStoreTest.cpp c10d)
688 -
689 - if(USE_CUDA)
690 - if(USE_C10D_GLOO)
691 -Index: pytorch-1.4.0_p0/caffe2/share/contrib/depthwise/CMakeLists.txt
692 -===================================================================
693 ---- pytorch-1.4.0_p0.orig/caffe2/share/contrib/depthwise/CMakeLists.txt
694 -+++ pytorch-1.4.0_p0/caffe2/share/contrib/depthwise/CMakeLists.txt
695 -@@ -6,4 +6,3 @@ set(Caffe2_CONTRIB_DEPTHWISE3x3_TEST_CPU
696 - )
697 -
698 - set(Caffe2_CPU_SRCS ${Caffe2_CPU_SRCS} ${Caffe2_CONTRIB_DEPTHWISE3x3_CPU_SRC} PARENT_SCOPE)
699 --set(Caffe2_CPU_TEST_SRCS ${Caffe2_CPU_TEST_SRCS} ${Caffe2_CONTRIB_DEPTHWISE3x3_TEST_CPU_SRC} PARENT_SCOPE)
700
701 diff --git a/sci-libs/pytorch/files/pytorch-1.4.0-sleef.patch b/sci-libs/pytorch/files/pytorch-1.4.0-sleef.patch
702 deleted file mode 100644
703 index 222a0f73e..000000000
704 --- a/sci-libs/pytorch/files/pytorch-1.4.0-sleef.patch
705 +++ /dev/null
706 @@ -1,15 +0,0 @@
707 -Give the location of sleef.h.
708 -
709 -Reference: https://github.com/pytorch/pytorch/issues/26555
710 -Index: pytorch-1.4.0/caffe2/CMakeLists.txt
711 -===================================================================
712 ---- pytorch-1.4.0.orig/caffe2/CMakeLists.txt
713 -+++ pytorch-1.4.0/caffe2/CMakeLists.txt
714 -@@ -1062,6 +1062,7 @@ if (BUILD_TEST)
715 - add_executable(${test_name} "${test_src}")
716 - target_link_libraries(${test_name} ${Caffe2_MAIN_LIBS} gtest_main)
717 - target_include_directories(${test_name} PRIVATE $<INSTALL_INTERFACE:include>)
718 -+ target_include_directories(${test_name} PRIVATE $<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/include>)
719 - target_include_directories(${test_name} PRIVATE ${Caffe2_CPU_INCLUDE})
720 - add_test(NAME ${test_name} COMMAND $<TARGET_FILE:${test_name}>)
721 - if (INSTALL_TEST)
722
723 diff --git a/sci-libs/pytorch/files/pytorch-1.6.0-global-dlopen.patch b/sci-libs/pytorch/files/pytorch-1.6.0-global-dlopen.patch
724 deleted file mode 100644
725 index 1e9388ff1..000000000
726 --- a/sci-libs/pytorch/files/pytorch-1.6.0-global-dlopen.patch
727 +++ /dev/null
728 @@ -1,15 +0,0 @@
729 -Don't hardcode the library path. Leave it to the dynamic loader.
730 -
731 -Index: pytorch-1.6.0/torch/__init__.py
732 -===================================================================
733 ---- pytorch-1.6.0.orig/torch/__init__.py
734 -+++ pytorch-1.6.0/torch/__init__.py
735 -@@ -138,7 +138,7 @@ def _load_global_deps():
736 - here = os.path.abspath(__file__)
737 - lib_path = os.path.join(os.path.dirname(here), 'lib', lib_name)
738 -
739 -- ctypes.CDLL(lib_path, mode=ctypes.RTLD_GLOBAL)
740 -+ ctypes.CDLL(lib_name, mode=ctypes.RTLD_GLOBAL)
741 -
742 -
743 - if (USE_RTLD_GLOBAL_WITH_LIBTORCH or os.getenv('TORCH_USE_RTLD_GLOBAL')) and \
744
745 diff --git a/sci-libs/pytorch/files/pytorch-1.6.0-nccl-nvccflags.patch b/sci-libs/pytorch/files/pytorch-1.6.0-nccl-nvccflags.patch
746 deleted file mode 100644
747 index 052474ee4..000000000
748 --- a/sci-libs/pytorch/files/pytorch-1.6.0-nccl-nvccflags.patch
749 +++ /dev/null
750 @@ -1,27 +0,0 @@
751 -diff -uprN nccl-5949d96f36d050e59d05872f8bbffd2549318e95/makefiles/common.mk nccl-patched/makefiles/common.mk
752 ---- nccl-5949d96f36d050e59d05872f8bbffd2549318e95/makefiles/common.mk 2020-06-09 00:31:44.000000000 +0800
753 -+++ nccl-patched/makefiles/common.mk 2020-08-06 21:25:57.784279738 +0800
754 -@@ -54,7 +54,7 @@ CXXFLAGS := -DCUDA_MAJOR=$(CUDA_MAJOR)
755 - # Maxrregcount needs to be set accordingly to NCCL_MAX_NTHREADS (otherwise it will cause kernel launch errors)
756 - # 512 : 120, 640 : 96, 768 : 80, 1024 : 60
757 - # We would not have to set this if we used __launch_bounds__, but this only works on kernels, not on functions.
758 --NVCUFLAGS := -ccbin $(CXX) $(NVCC_GENCODE) -std=c++11 -Xptxas -maxrregcount=96 -Xfatbin -compress-all
759 -+NVCUFLAGS := $(NVCCFLAGS) $(NVCC_GENCODE) -std=c++11 -Xptxas -maxrregcount=96 -Xfatbin -compress-all
760 - # Use addprefix so that we can specify more than one path
761 - NVLDFLAGS := -L${CUDA_LIB} -lcudart -lrt
762 -
763 -@@ -68,14 +68,6 @@ NVLDFLAGS += ${GCOV_FLAGS:%=-Xcompiler
764 - # $(warning GCOV_FLAGS=${GCOV_FLAGS})
765 - ########## GCOV ##########
766 -
767 --ifeq ($(DEBUG), 0)
768 --NVCUFLAGS += -O3
769 --CXXFLAGS += -O3 -g
770 --else
771 --NVCUFLAGS += -O0 -G -g
772 --CXXFLAGS += -O0 -g -ggdb3
773 --endif
774 --
775 - ifneq ($(VERBOSE), 0)
776 - NVCUFLAGS += -Xptxas -v -Xcompiler -Wall,-Wextra,-Wno-unused-parameter
777 - CXXFLAGS += -Wall -Wextra
778
779 diff --git a/sci-libs/pytorch/files/pytorch-1.6.0-setup.patch b/sci-libs/pytorch/files/pytorch-1.6.0-setup.patch
780 deleted file mode 100644
781 index 6a197a907..000000000
782 --- a/sci-libs/pytorch/files/pytorch-1.6.0-setup.patch
783 +++ /dev/null
784 @@ -1,14 +0,0 @@
785 -Index: pytorch-1.4.0_p0/setup.py
786 -===================================================================
787 ---- pytorch-1.4.0_p0.orig/setup.py
788 -+++ pytorch-1.4.0_p0/setup.py
789 -@@ -288,9 +288,7 @@ def build_deps():
790 - sys.exit(1)
791 -
792 - check_file(os.path.join(third_party_path, "gloo", "CMakeLists.txt"))
793 -- check_file(os.path.join(third_party_path, "pybind11", "CMakeLists.txt"))
794 - check_file(os.path.join(third_party_path, 'cpuinfo', 'CMakeLists.txt'))
795 -- check_file(os.path.join(third_party_path, 'tbb', 'Makefile'))
796 - check_file(os.path.join(third_party_path, 'onnx', 'CMakeLists.txt'))
797 - check_file(os.path.join(third_party_path, 'foxi', 'CMakeLists.txt'))
798 - check_file(os.path.join(third_party_path, 'QNNPACK', 'CMakeLists.txt'))
799
800 diff --git a/sci-libs/pytorch/files/pytorch-1.6.0-skip-tests.patch b/sci-libs/pytorch/files/pytorch-1.6.0-skip-tests.patch
801 deleted file mode 100644
802 index 3ef2c533f..000000000
803 --- a/sci-libs/pytorch/files/pytorch-1.6.0-skip-tests.patch
804 +++ /dev/null
805 @@ -1,14 +0,0 @@
806 -Disable expected test failures.
807 -
808 -Reference: https://github.com/pytorch/pytorch/issues/13746
809 -Reference: https://github.com/pytorch/pytorch/issues/21873
810 -
811 -Index: pytorch-1.4.0_p0/caffe2/share/contrib/depthwise/CMakeLists.txt
812 -===================================================================
813 ---- pytorch-1.4.0_p0.orig/caffe2/share/contrib/depthwise/CMakeLists.txt
814 -+++ pytorch-1.4.0_p0/caffe2/share/contrib/depthwise/CMakeLists.txt
815 -@@ -6,4 +6,3 @@ set(Caffe2_CONTRIB_DEPTHWISE3x3_TEST_CPU
816 - )
817 -
818 - set(Caffe2_CPU_SRCS ${Caffe2_CPU_SRCS} ${Caffe2_CONTRIB_DEPTHWISE3x3_CPU_SRC} PARENT_SCOPE)
819 --set(Caffe2_CPU_TEST_SRCS ${Caffe2_CPU_TEST_SRCS} ${Caffe2_CONTRIB_DEPTHWISE3x3_TEST_CPU_SRC} PARENT_SCOPE)
820
821 diff --git a/sci-libs/pytorch/files/pytorch-1.6.0-tensorpipe-unbundle-libuv.patch b/sci-libs/pytorch/files/pytorch-1.6.0-tensorpipe-unbundle-libuv.patch
822 deleted file mode 100644
823 index a4ba38322..000000000
824 --- a/sci-libs/pytorch/files/pytorch-1.6.0-tensorpipe-unbundle-libuv.patch
825 +++ /dev/null
826 @@ -1,13 +0,0 @@
827 -Index: tensorpipe/cmake/pytorch.cmake
828 -===================================================================
829 ---- tensorpipe.orig/cmake/pytorch.cmake
830 -+++ tensorpipe/cmake/pytorch.cmake
831 -@@ -138,7 +138,7 @@ endif()
832 -
833 - add_library(tensorpipe ${TENSORPIPE_SRC})
834 -
835 --set(TP_BUILD_LIBUV ON)
836 -+set(TP_BUILD_LIBUV OFF)
837 - find_package(uv REQUIRED)
838 - target_link_libraries(tensorpipe PRIVATE uv::uv)
839 -
840
841 diff --git a/sci-libs/pytorch/files/pytorch-1.7.1-no-rpath.patch b/sci-libs/pytorch/files/pytorch-1.7.1-no-rpath.patch
842 deleted file mode 100644
843 index eabda092e..000000000
844 --- a/sci-libs/pytorch/files/pytorch-1.7.1-no-rpath.patch
845 +++ /dev/null
846 @@ -1,12 +0,0 @@
847 -diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake
848 -index b3a892cf88..2c8622870c 100644
849 ---- a/cmake/Dependencies.cmake
850 -+++ b/cmake/Dependencies.cmake
851 -@@ -4,7 +4,6 @@ if(APPLE)
852 - set(CMAKE_MACOSX_RPATH ON)
853 - set(_rpath_portable_origin "@loader_path")
854 - else()
855 -- set(_rpath_portable_origin $ORIGIN)
856 - endif(APPLE)
857 - # Use separate rpaths during build and install phases
858 - set(CMAKE_SKIP_BUILD_RPATH FALSE)
859
860 diff --git a/sci-libs/pytorch/files/pytorch-1.7.1-setup.patch b/sci-libs/pytorch/files/pytorch-1.7.1-setup.patch
861 deleted file mode 100644
862 index 28db5692c..000000000
863 --- a/sci-libs/pytorch/files/pytorch-1.7.1-setup.patch
864 +++ /dev/null
865 @@ -1,12 +0,0 @@
866 -diff --git a/setup.py b/setup.py
867 -index 2db381644c..01a2e57aea 100644
868 ---- a/setup.py
869 -+++ b/setup.py
870 -@@ -294,7 +294,6 @@ def build_deps():
871 -
872 - check_file(os.path.join(third_party_path, "gloo", "CMakeLists.txt"))
873 - check_file(os.path.join(third_party_path, 'cpuinfo', 'CMakeLists.txt'))
874 -- check_file(os.path.join(third_party_path, 'tbb', 'Makefile'))
875 - check_file(os.path.join(third_party_path, 'onnx', 'CMakeLists.txt'))
876 - check_file(os.path.join(third_party_path, 'foxi', 'CMakeLists.txt'))
877 - check_file(os.path.join(third_party_path, 'QNNPACK', 'CMakeLists.txt'))
878
879 diff --git a/sci-libs/pytorch/files/pytorch-1.7.1-tensorpipe-unbundle-libuv.patch b/sci-libs/pytorch/files/pytorch-1.7.1-tensorpipe-unbundle-libuv.patch
880 deleted file mode 100644
881 index 960ae3618..000000000
882 --- a/sci-libs/pytorch/files/pytorch-1.7.1-tensorpipe-unbundle-libuv.patch
883 +++ /dev/null
884 @@ -1,12 +0,0 @@
885 -diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake
886 -index d1e4bdaed6..85821a78df 100644
887 ---- a/cmake/Dependencies.cmake
888 -+++ b/cmake/Dependencies.cmake
889 -@@ -1308,7 +1308,6 @@ if(USE_DISTRIBUTED AND USE_TENSORPIPE)
890 - if(MSVC)
891 - message(WARNING "Tensorpipe cannot be used on Windows.")
892 - else()
893 -- set(TP_BUILD_LIBUV ON CACHE BOOL "" FORCE)
894 - set(TP_ENABLE_SHM OFF CACHE BOOL "" FORCE)
895 - set(TP_ENABLE_CMA OFF CACHE BOOL "" FORCE)
896 - set(TP_STATIC_OR_SHARED STATIC CACHE STRING "" FORCE)
897
898 diff --git a/sci-libs/pytorch/files/pytorch-1.7.1-torch_shm_manager.patch b/sci-libs/pytorch/files/pytorch-1.7.1-torch_shm_manager.patch
899 deleted file mode 100644
900 index 44b27cac3..000000000
901 --- a/sci-libs/pytorch/files/pytorch-1.7.1-torch_shm_manager.patch
902 +++ /dev/null
903 @@ -1,13 +0,0 @@
904 -diff --git a/torch/__init__.py b/torch/__init__.py
905 -index 03f6eca622..297fb169a4 100644
906 ---- a/torch/__init__.py
907 -+++ b/torch/__init__.py
908 -@@ -412,7 +412,7 @@ def manager_path():
909 -
910 -
911 - # Shared memory manager needs to know the exact location of manager executable
912 --_C._initExtension(manager_path())
913 -+_C._initExtension(b"@GENTOO_PORTAGE_EPREFIX@/usr/bin/torch_shm_manager")
914 - del manager_path
915 -
916 - # Appease the type checker: it can't deal with direct setting of globals().
917
918 diff --git a/sci-libs/pytorch/files/pytorch-1.9.0-Change-library-directory-according-to-CMake-build.patch b/sci-libs/pytorch/files/pytorch-1.9.0-Change-library-directory-according-to-CMake-build.patch
919 deleted file mode 100644
920 index 214267487..000000000
921 --- a/sci-libs/pytorch/files/pytorch-1.9.0-Change-library-directory-according-to-CMake-build.patch
922 +++ /dev/null
923 @@ -1,32 +0,0 @@
924 -From 52019a3f395e5fa97b26d424152d91f73b400f8e Mon Sep 17 00:00:00 2001
925 -From: Alexey Chernov <4ernov@×××××.com>
926 -Date: Wed, 13 Nov 2019 23:44:12 +0300
927 -Subject: [PATCH 5/5] Change library directory according to CMake build
928 -Modified: Tue, 03 Aug 2021, fit for pytorch-1.9.0
929 -
930 -Change `lib_path` in favour of out-of-tree CMake build
931 -directory, so that all the C++ libraries be found.
932 ----
933 - setup.py | 5 +++--
934 - 1 file changed, 3 insertions(+), 2 deletions(-)
935 -
936 -diff --git a/setup.py b/setup.py
937 -index 60502b6add..cbced52192 100644
938 ---- a/setup.py
939 -+++ b/setup.py
940 -@@ -268,9 +268,10 @@ else:
941 -
942 - # Constant known variables used throughout this file
943 - cwd = os.path.dirname(os.path.abspath(__file__))
944 --lib_path = os.path.join(cwd, "torch", "lib")
945 -+cmake_build_dir = os.environ.get("CMAKE_BUILD_DIR", os.path.join(cwd, "build"))
946 -+lib_path = os.path.join(cmake_build_dir, "lib")
947 - third_party_path = os.path.join(cwd, "third_party")
948 --caffe2_build_dir = os.path.join(cwd, "build")
949 -+caffe2_build_dir = cmake_build_dir
950 -
951 - # CMAKE: full path to python library
952 - if IS_WINDOWS:
953 ---
954 -2.23.0
955 -
956
957 diff --git a/sci-libs/pytorch/files/pytorch-1.9.1-fix-wrong-hipify.patch b/sci-libs/pytorch/files/pytorch-1.9.1-fix-wrong-hipify.patch
958 deleted file mode 100644
959 index 4e37acd3f..000000000
960 --- a/sci-libs/pytorch/files/pytorch-1.9.1-fix-wrong-hipify.patch
961 +++ /dev/null
962 @@ -1,13 +0,0 @@
963 -The hipify misadd a ) and causes compilation error
964 -
965 ---- orig/aten/src/ATen/native/sparse/hip/SparseHIPTensor.hip
966 -+++ pytorch-1.9.1/aten/src/ATen/native/sparse/hip/SparseHIPTensor.hip
967 -@@ -282,7 +282,7 @@ Tensor sparse_mask_helper_cuda(
968 - mask_indices_ti,
969 - t_indices_pos_ti,
970 - t_values_ti,
971 -- r_values_ti);
972 -+ r_values_ti;
973 - C10_HIP_KERNEL_LAUNCH_CHECK();
974 - });
975 - }
976
977 diff --git a/sci-libs/pytorch/metadata.xml b/sci-libs/pytorch/metadata.xml
978 deleted file mode 100644
979 index df07ea4be..000000000
980 --- a/sci-libs/pytorch/metadata.xml
981 +++ /dev/null
982 @@ -1,34 +0,0 @@
983 -<?xml version="1.0" encoding="UTF-8"?>
984 -<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
985 -<pkgmetadata>
986 - <maintainer type="person">
987 - <email>4ernov@×××××.com</email>
988 - <name>Alexey Chernov</name>
989 - </maintainer>
990 - <maintainer type="person">
991 - <email>heroxbd@g.o</email>
992 - <name>Benda Xu</name>
993 - </maintainer>
994 - <use>
995 - <flag name="asan">Build with address sanitizer (ASAN)</flag>
996 - <flag name="cuda">Enable support for nVidia CUDA</flag>
997 - <flag name="fbgemm">Enable FBGEMM (Facebook GEneral Matrix Multiplication) support</flag>
998 - <flag name="gflags">Build with gflags</flag>
999 - <flag name="glog">Build with glog support</flag>
1000 - <flag name="gloo">Build gloo distributed communication backend support</flag>
1001 - <flag name="leveldb">Enable support for LevelDB</flag>
1002 - <flag name="lmdb">Enable support for LMDB</flag>
1003 - <flag name="mkldnn">Build with Intel MKL-DNN support</flag>
1004 - <flag name="namedtensor">Enable support for named tensors</flag>
1005 - <flag name="nnpack">Enable NNPACK support</flag>
1006 - <flag name="numa">Enable support for NUMA</flag>
1007 - <flag name="observers">Build observers</flag>
1008 - <flag name="opencv">Enable support for OpenCV</flag>
1009 - <flag name="opencl">Enable support for OpenCL</flag>
1010 - <flag name="qnnpack">Enable QNNPACK support</flag>
1011 - <flag name="redis">Enable support for Redis</flag>
1012 - <flag name="rocm">Enable AMD ROCm</flag>
1013 - <flag name="tools">Build binary tools</flag>
1014 - <flag name="zeromq">Enable support for ZeroMQ</flag>
1015 - </use>
1016 -</pkgmetadata>
1017
1018 diff --git a/sci-libs/pytorch/pytorch-1.10.2.ebuild b/sci-libs/pytorch/pytorch-1.10.2.ebuild
1019 deleted file mode 100644
1020 index 8ba76f1bd..000000000
1021 --- a/sci-libs/pytorch/pytorch-1.10.2.ebuild
1022 +++ /dev/null
1023 @@ -1,339 +0,0 @@
1024 -# Copyright 1999-2022 Gentoo Authors
1025 -# Distributed under the terms of the GNU General Public License v2
1026 -
1027 -EAPI=8
1028 -
1029 -DISTUTILS_USE_SETUPTOOLS=manual
1030 -DISTUTILS_SINGLE_IMPL=1
1031 -PYTHON_COMPAT=( python3_{8..10} )
1032 -
1033 -inherit cmake cuda distutils-r1 prefix
1034 -
1035 -DESCRIPTION="Tensors and Dynamic neural networks in Python with strong GPU acceleration"
1036 -HOMEPAGE="https://pytorch.org/"
1037 -SRC_URI="https://github.com/pytorch/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz
1038 -https://github.com/google/benchmark/archive/e991355c02b93fe17713efe04cbc2e278e00fdbd.tar.gz -> benchmark-e991355c02b93fe17713efe04cbc2e278e00fdbd.tar.gz
1039 -https://github.com/pytorch/cpuinfo/archive/63b25457.tar.gz -> cpuinfo-63b25457.tar.gz
1040 -https://github.com/NVlabs/cub/archive/d106ddb991a56c3df1b6d51b2409e36ba8181ce4.tar.gz -> cub-d106ddb991a56c3df1b6d51b2409e36ba8181ce4.tar.gz
1041 -https://github.com/pytorch/fbgemm/archive/7588d9d804826b428fc0e4fd418e9cc3f7a72e52.tar.gz -> fbgemm-7588d9d804826b428fc0e4fd418e9cc3f7a72e52.tar.gz
1042 -https://github.com/asmjit/asmjit/archive/d0d14ac774977d0060a351f66e35cb57ba0bf59c.tar.gz -> asmjit-d0d14ac774977d0060a351f66e35cb57ba0bf59c.tar.gz
1043 -https://github.com/pytorch/cpuinfo/archive/5916273f79a21551890fd3d56fc5375a78d1598d.tar.gz -> cpuinfo-5916273f79a21551890fd3d56fc5375a78d1598d.tar.gz
1044 -https://github.com/google/googletest/archive/0fc5466d.tar.gz -> googletest-0fc5466d.tar.gz
1045 -https://github.com/fmtlib/fmt/archive/cd4af11efc9c622896a3e4cb599fa28668ca3d05.tar.gz -> fmt-cd4af11efc9c622896a3e4cb599fa28668ca3d05.tar.gz
1046 -https://github.com/houseroad/foxi/archive/c278588e34e535f0bb8f00df3880d26928038cad.tar.gz -> foxi-c278588e34e535f0bb8f00df3880d26928038cad.tar.gz
1047 -https://github.com/Maratyszcza/FP16/archive/4dfe081cf6bcd15db339cf2680b9281b8451eeb3.tar.gz -> FP16-4dfe081cf6bcd15db339cf2680b9281b8451eeb3.tar.gz
1048 -https://github.com/Maratyszcza/FXdiv/archive/b408327ac2a15ec3e43352421954f5b1967701d1.tar.gz -> FXdiv-b408327ac2a15ec3e43352421954f5b1967701d1.tar.gz
1049 -https://github.com/google/gemmlowp/archive/3fb5c176.tar.gz -> gemmlowp-3fb5c176.tar.gz
1050 -https://github.com/facebookincubator/gloo/archive/c22a5cfba94edf8ea4f53a174d38aa0c629d070f.tar.gz -> gloo-c22a5cfba94edf8ea4f53a174d38aa0c629d070f.tar.gz
1051 -https://github.com/google/googletest/archive/e2239ee6043f73722e7aa812a459f54a28552929.tar.gz -> googletest-e2239ee6043f73722e7aa812a459f54a28552929.tar.gz
1052 -https://github.com/intel/ideep/archive/9ca27bbfd88fa1469cbf0467bd6f14cd1738fa40.tar.gz -> ideep-9ca27bbfd88fa1469cbf0467bd6f14cd1738fa40.tar.gz
1053 -https://github.com/intel/mkl-dnn/archive/5ef631a0.tar.gz -> mkl-dnn-5ef631a0.tar.gz
1054 -cuda? ( https://github.com/NVIDIA/nccl/archive/c5790b36722d5b41ee2a9b2bad69e364180ffd22.tar.gz -> nccl-c5790b36722d5b41ee2a9b2bad69e364180ffd22.tar.gz )
1055 -https://github.com/Maratyszcza/NNPACK/archive/c07e3a0400713d546e0dea2d5466dd22ea389c73.tar.gz -> NNPACK-c07e3a0400713d546e0dea2d5466dd22ea389c73.tar.gz
1056 -https://github.com/onnx/onnx/archive/a82c6a70.tar.gz -> onnx-a82c6a70.tar.gz
1057 -https://github.com/onnx/onnx-tensorrt/archive/c153211418a7c57ce071d9ce2a41f8d1c85a878f.tar.gz -> onnx-tensorrt-c153211418a7c57ce071d9ce2a41f8d1c85a878f.tar.gz
1058 -https://github.com/onnx/onnx/archive/29e7aa7048809784465d06e897f043a4600642b2.tar.gz -> onnx-29e7aa7048809784465d06e897f043a4600642b2.tar.gz
1059 -https://github.com/google/benchmark/archive/e776aa02.tar.gz -> benchmark-e776aa02.tar.gz
1060 -https://github.com/google/benchmark/archive/5b7683f4.tar.gz -> benchmark-5b7683f4.tar.gz
1061 -https://github.com/google/googletest/archive/5ec7f0c4.tar.gz -> googletest-5ec7f0c4.tar.gz
1062 -https://github.com/Maratyszcza/psimd/archive/072586a71b55b7f8c584153d223e95687148a90.tar.gz -> psimd-072586a71b55b7f8c584153d223e95687148a90.tar.gz
1063 -https://github.com/Maratyszcza/pthreadpool/archive/a134dd5d4cee80cce15db81a72e7f929d71dd413.tar.gz -> pthreadpool-a134dd5d4cee80cce15db81a72e7f929d71dd413.tar.gz
1064 -https://github.com/Maratyszcza/PeachPy/archive/07d8fde8ac45d7705129475c0f94ed8925b93473.tar.gz -> PeachPy-07d8fde8ac45d7705129475c0f94ed8925b93473.tar.gz
1065 -https://github.com/pytorch/QNNPACK/archive/7d2a4e9931a82adc3814275b6219a03e24e36b4c.tar.gz -> QNNPACK-7d2a4e9931a82adc3814275b6219a03e24e36b4c.tar.gz
1066 -https://github.com/shibatch/sleef/archive/e0a003ee838b75d11763aa9c3ef17bf71a725bff.tar.gz -> sleef-e0a003ee838b75d11763aa9c3ef17bf71a725bff.tar.gz
1067 -https://github.com/pytorch/tensorpipe/archive/d2aa3485e8229c98891dfd604b514a39d45a5c99.tar.gz -> tensorpipe-d2aa3485e8229c98891dfd604b514a39d45a5c99.tar.gz
1068 -https://github.com/google/googletest/archive/2fe3bd99.tar.gz -> googletest-2fe3bd99.tar.gz
1069 -https://github.com/google/libnop/archive/aa95422e.tar.gz -> libnop-aa95422e.tar.gz
1070 -https://github.com/libuv/libuv/archive/48e04275332f5753427d21a52f17ec6206451f2c.tar.gz -> libuv-48e04275332f5753427d21a52f17ec6206451f2c.tar.gz
1071 -https://github.com/google/XNNPACK/archive/79cd5f9e18ad0925ac9a050b00ea5a36230072db.tar.gz -> XNNPACK-79cd5f9e18ad0925ac9a050b00ea5a36230072db.tar.gz
1072 -https://github.com/pytorch/kineto/archive/879a203d9bf554e95541679ddad6e0326f272dc1.tar.gz -> kineto-879a203d9bf554e95541679ddad6e0326f272dc1.tar.gz
1073 -https://github.com/driazati/breakpad/archive/edbb99f95c75be27d038fffb1d969cdacf705db2.tar.gz -> breakpad-edbb99f95c75be27d038fffb1d969cdacf705db2.tar.gz
1074 -https://github.com/mikey/linux-syscall-support/archive/e1e7b0ad8ee99a875b272c8e33e308472e897660.tar.gz -> lss-e1e7b0ad8ee99a875b272c8e33e308472e897660.tar.gz
1075 -"
1076 -
1077 -# git clone git@××××××.com:pytorch/pytorch.git && cd pytorch
1078 -# git submodules update --init --recursive
1079 -# ${FILESDIR}/get_third_paries
1080 -# cat SRC_URI src_prepare
1081 -
1082 -LICENSE="BSD"
1083 -SLOT="0"
1084 -KEYWORDS="~amd64"
1085 -
1086 -IUSE="asan blas cuda +fbgemm ffmpeg gflags glog +gloo leveldb lmdb mkldnn mpi namedtensor +nnpack numa +observers opencl opencv +openmp +python +qnnpack redis rocm static tools zeromq"
1087 -REQUIRED_USE=" ?? ( cuda rocm )"
1088 -
1089 -RDEPEND="
1090 - $(python_gen_cond_dep '
1091 - dev-python/pyyaml[${PYTHON_USEDEP}]
1092 - ')
1093 - blas? ( virtual/blas )
1094 - cuda? ( dev-libs/cudnn
1095 - dev-cpp/eigen[cuda] )
1096 - rocm? ( >=dev-util/hip-4.3
1097 - >=dev-libs/rccl-4.3
1098 - >=sci-libs/rocThrust-4.3
1099 - >=sci-libs/hipCUB-4.3
1100 - >=sci-libs/rocPRIM-4.3
1101 - >=sci-libs/miopen-4.3
1102 - >=sci-libs/rocBLAS-4.3
1103 - >=sci-libs/rocRAND-4.3
1104 - >=sci-libs/hipSPARSE-4.3
1105 - >=sci-libs/rocFFT-4.3
1106 - >=dev-util/roctracer-4.3 )
1107 - ffmpeg? ( media-video/ffmpeg )
1108 - gflags? ( dev-cpp/gflags )
1109 - glog? ( dev-cpp/glog[gflags] )
1110 - leveldb? ( dev-libs/leveldb )
1111 - lmdb? ( dev-db/lmdb )
1112 - mpi? ( virtual/mpi )
1113 - opencl? ( dev-libs/clhpp )
1114 - opencv? ( media-libs/opencv )
1115 - python? ( ${PYTHON_DEPS}
1116 - $(python_gen_cond_dep '
1117 - dev-python/setuptools[${PYTHON_USEDEP}]
1118 - dev-python/pybind11[${PYTHON_USEDEP}]
1119 - dev-python/numpy[${PYTHON_USEDEP}]
1120 - dev-python/protobuf-python:=[${PYTHON_USEDEP}]
1121 - ')
1122 - )
1123 - redis? ( dev-db/redis )
1124 - zeromq? ( net-libs/zeromq )
1125 - dev-cpp/eigen
1126 - dev-libs/protobuf:=
1127 - dev-libs/libuv
1128 -"
1129 -
1130 -#ATen code generation
1131 -BDEPEND="dev-python/pyyaml"
1132 -
1133 -DEPEND="${RDEPEND}
1134 - dev-cpp/tbb
1135 - app-arch/zstd
1136 - $(python_gen_cond_dep '
1137 - dev-python/pybind11[${PYTHON_USEDEP}]
1138 - dev-python/typing-extensions[${PYTHON_USEDEP}]
1139 - ')
1140 - sys-cluster/rdma-core
1141 - sys-process/numactl
1142 -"
1143 -
1144 -PATCHES=(
1145 - "${FILESDIR}"/${PN}-1.9.0-Change-library-directory-according-to-CMake-build.patch
1146 - "${FILESDIR}"/${PN}-1.6.0-global-dlopen.patch
1147 - "${FILESDIR}"/0002-Don-t-build-libtorch-again-for-PyTorch-1.7.1.patch
1148 - "${FILESDIR}"/${PN}-1.7.1-no-rpath.patch
1149 - "${FILESDIR}"/${PN}-1.7.1-torch_shm_manager.patch
1150 - "${FILESDIR}"/${PN}-1.10.0-nonull.patch
1151 - "${FILESDIR}"/${PN}-1.10.0-fix-distutils.patch
1152 - "${FILESDIR}"/${PN}-1.10.0-clhpp2.patch
1153 -)
1154 -
1155 -distutils_enable_tests --install pytest
1156 -
1157 -src_prepare() {
1158 - cmake_src_prepare
1159 - eprefixify torch/__init__.py
1160 -
1161 - rmdir third_party/benchmark || die
1162 - ln -sv "${WORKDIR}"/benchmark-e991355c02b93fe17713efe04cbc2e278e00fdbd third_party/benchmark || die
1163 - rmdir third_party/cpuinfo || die
1164 - ln -sv "${WORKDIR}"/cpuinfo-5916273f79a21551890fd3d56fc5375a78d1598d third_party/cpuinfo || die
1165 - rmdir third_party/cub || die
1166 - ln -sv "${WORKDIR}"/cub-d106ddb991a56c3df1b6d51b2409e36ba8181ce4 third_party/cub || die
1167 - rmdir third_party/fbgemm || die
1168 - ln -sv "${WORKDIR}"/FBGEMM-7588d9d804826b428fc0e4fd418e9cc3f7a72e52 third_party/fbgemm || die
1169 - rmdir third_party/fbgemm/third_party/asmjit || die
1170 - ln -sv "${WORKDIR}"/asmjit-d0d14ac774977d0060a351f66e35cb57ba0bf59c third_party/fbgemm/third_party/asmjit || die
1171 - rmdir third_party/fbgemm/third_party/cpuinfo || die
1172 - ln -sv "${WORKDIR}"/cpuinfo-d5e37adf1406cf899d7d9ec1d317c47506ccb970 third_party/fbgemm/third_party/cpuinfo || die
1173 - rmdir third_party/fbgemm/third_party/googletest || die
1174 - ln -sv "${WORKDIR}"/googletest-0fc5466dbb9e623029b1ada539717d10bd45e99e third_party/fbgemm/third_party/googletest || die
1175 - rmdir third_party/fmt || die
1176 - ln -sv "${WORKDIR}"/fmt-cd4af11efc9c622896a3e4cb599fa28668ca3d05 third_party/fmt || die
1177 - rmdir third_party/foxi || die
1178 - ln -sv "${WORKDIR}"/foxi-c278588e34e535f0bb8f00df3880d26928038cad third_party/foxi || die
1179 - rmdir third_party/FP16 || die
1180 - ln -sv "${WORKDIR}"/FP16-4dfe081cf6bcd15db339cf2680b9281b8451eeb3 third_party/FP16 || die
1181 - rmdir third_party/FXdiv
1182 - ln -sv "${WORKDIR}"/FXdiv-b408327ac2a15ec3e43352421954f5b1967701d1 third_party/FXdiv || die
1183 - rmdir third_party/gemmlowp/gemmlowp || die
1184 - ln -sv "${WORKDIR}"/gemmlowp-3fb5c176c17c765a3492cd2f0321b0dab712f350 third_party/gemmlowp/gemmlowp || die
1185 - rmdir third_party/gloo || die
1186 - ln -sv "${WORKDIR}"/gloo-c22a5cfba94edf8ea4f53a174d38aa0c629d070f third_party/gloo || die
1187 - rmdir third_party/googletest || die
1188 - ln -sv "${WORKDIR}"/googletest-e2239ee6043f73722e7aa812a459f54a28552929 third_party/googletest || die
1189 - rmdir third_party/ideep || die
1190 - ln -sv "${WORKDIR}"/ideep-9ca27bbfd88fa1469cbf0467bd6f14cd1738fa40 third_party/ideep || die
1191 - rmdir third_party/ideep/mkl-dnn || die
1192 - ln -sv "${WORKDIR}"/mkl-dnn-5ef631a030a6f73131c77892041042805a06064f third_party/ideep/mkl-dnn || die
1193 - rmdir third_party/nccl/nccl || die
1194 - ln -sv "${WORKDIR}"/nccl-c5790b36722d5b41ee2a9b2bad69e364180ffd22 third_party/nccl/nccl || die
1195 - rmdir third_party/NNPACK || die
1196 - ln -sv "${WORKDIR}"/NNPACK-c07e3a0400713d546e0dea2d5466dd22ea389c73 third_party/NNPACK || die
1197 - rmdir third_party/onnx || die
1198 - ln -sv "${WORKDIR}"/onnx-29e7aa7048809784465d06e897f043a4600642b2 third_party/onnx || die
1199 - rmdir third_party/onnx-tensorrt || die
1200 - ln -sv "${WORKDIR}"/onnx-tensorrt-c153211418a7c57ce071d9ce2a41f8d1c85a878f third_party/onnx-tensorrt || die
1201 - rmdir third_party/onnx-tensorrt/third_party/onnx || die
1202 - ln -sv "${WORKDIR}"/onnx-765f5ee823a67a866f4bd28a9860e81f3c811ce8 third_party/onnx-tensorrt/third_party/onnx || die
1203 - rmdir third_party/onnx/third_party/benchmark || die
1204 - ln -sv "${WORKDIR}"/benchmark-e776aa0275e293707b6a0901e0e8d8a8a3679508 third_party/onnx/third_party/benchmark || die
1205 - rmdir third_party/psimd || die
1206 - ln -sv "${WORKDIR}"/psimd-072586a71b55b7f8c584153d223e95687148a900 third_party/psimd || die
1207 - rmdir third_party/pthreadpool || die
1208 - ln -sv "${WORKDIR}"/pthreadpool-a134dd5d4cee80cce15db81a72e7f929d71dd413 third_party/pthreadpool || die
1209 - rmdir third_party/python-peachpy || die
1210 - ln -sv "${WORKDIR}"/PeachPy-07d8fde8ac45d7705129475c0f94ed8925b93473 third_party/python-peachpy || die
1211 - rmdir third_party/QNNPACK || die
1212 - ln -sv "${WORKDIR}"/QNNPACK-7d2a4e9931a82adc3814275b6219a03e24e36b4c third_party/QNNPACK || die
1213 - rmdir third_party/sleef || die
1214 - ln -sv "${WORKDIR}"/sleef-e0a003ee838b75d11763aa9c3ef17bf71a725bff third_party/sleef || die
1215 - rmdir third_party/tensorpipe || die
1216 - ln -sv "${WORKDIR}"/tensorpipe-d2aa3485e8229c98891dfd604b514a39d45a5c99 third_party/tensorpipe || die
1217 - rmdir third_party/tensorpipe/third_party/googletest || die
1218 - ln -sv "${WORKDIR}"/googletest-2fe3bd994b3189899d93f1d5a881e725e046fdc2 third_party/tensorpipe/third_party/googletest || die
1219 - rmdir third_party/tensorpipe/third_party/libnop || die
1220 - ln -sv "${WORKDIR}"/libnop-aa95422ea8c409e3f078d2ee7708a5f59a8b9fa2 third_party/tensorpipe/third_party/libnop || die
1221 - rmdir third_party/tensorpipe/third_party/libuv || die
1222 - ln -sv "${WORKDIR}"/libuv-48e04275332f5753427d21a52f17ec6206451f2c third_party/tensorpipe/third_party/libuv || die
1223 - rmdir third_party/XNNPACK || die
1224 - ln -sv "${WORKDIR}"/XNNPACK-79cd5f9e18ad0925ac9a050b00ea5a36230072db third_party/XNNPACK || die
1225 - rmdir third_party/kineto || die
1226 - ln -sv "${WORKDIR}"/kineto-879a203d9bf554e95541679ddad6e0326f272dc1 third_party/kineto || die
1227 - rmdir third_party/breakpad || die
1228 - ln -sv "${WORKDIR}"/breakpad-edbb99f95c75be27d038fffb1d969cdacf705db2 third_party/breakpad || die
1229 - rmdir third_party/breakpad/src/third_party/lss || die
1230 - ln -sv "${WORKDIR}"/linux-syscall-support-e1e7b0ad8ee99a875b272c8e33e308472e897660 third_party/breakpad/src/third_party/lss || die
1231 -
1232 - if use cuda; then
1233 - cd third_party/nccl/nccl || die
1234 - eapply "${FILESDIR}"/${PN}-1.10.1-nccl-nvccflags.patch
1235 - cuda_src_prepare
1236 - export CUDAHOSTCXX=$(cuda_gccdir)/g++
1237 - cd "${S}"
1238 - fi
1239 -
1240 - if use rocm; then
1241 - #Allow escaping sandbox
1242 - addread /dev/kfd
1243 - addread /dev/dri
1244 - addpredict /dev/kfd
1245 - addpredict /dev/dri
1246 -
1247 - ebegin "HIPifying cuda sources"
1248 - ${EPYTHON} tools/amd_build/build_amd.py || die
1249 - eapply "${FILESDIR}"/${PN}-1.9.1-fix-wrong-hipify.patch
1250 - eend $?
1251 -
1252 - local ROCM_VERSION="$(hipconfig -v)-"
1253 - export PYTORCH_ROCM_ARCH="${AMDGPU_TARGETS}"
1254 - sed -e "/set(roctracer_INCLUDE_DIRS/s,\${ROCTRACER_PATH}/include,${EPREFIX}/usr/include/roctracer," \
1255 - -e "/PYTORCH_HIP_HCC_LIBRARIES/s,\${HIP_PATH}/lib,${EPREFIX}/usr/lib/hip/lib," \
1256 - -e "/set(roctracer_INCLUDE_DIRS/a\ set(thrust_INCLUDE_DIRS ${EPREFIX}/usr/include/rocthrust)" \
1257 - -e "s,\${ROCTRACER_PATH}/lib,${EPREFIX}/usr/lib64/roctracer," \
1258 - -e "/READ.*\.info\/version-dev/c\ set(ROCM_VERSION_DEV_RAW ${ROCM_VERSION})" \
1259 - -i cmake/public/LoadHIP.cmake || die
1260 - sed -r -e '/^if\(USE_ROCM/{:a;N;/\nendif/!ba; s,\{([^\{]*)_PATH\}(/include)?,\{\L\1_\UINCLUDE_DIRS\},g}' -i cmake/Dependencies.cmake || die
1261 - fi
1262 -
1263 - # Set build dir for pytorch's setup
1264 - sed -e "/BUILD_DIR/s,build,${BUILD_DIR}," -i tools/setup_helpers/env.py || die
1265 -}
1266 -
1267 -src_configure() {
1268 - local mycmakeargs=(
1269 - -DWERROR=OFF
1270 - -DTORCH_BUILD_VERSION=${PV}
1271 - -DTORCH_INSTALL_LIB_DIR=$(get_libdir)
1272 - -DBUILD_BINARY=$(usex tools ON OFF)
1273 - -DBUILD_CUSTOM_PROTOBUF=OFF
1274 - -DBUILD_PYTHON=$(usex python ON OFF)
1275 - -DBUILD_SHARED_LIBS=$(usex static OFF ON)
1276 - -DBUILD_TEST=$(usex test ON OFF)
1277 - -DUSE_ASAN=$(usex asan ON OFF)
1278 - -DUSE_CUDA=$(usex cuda ON OFF)
1279 - -DUSE_NCCL=$(usex cuda ON OFF)
1280 - -DUSE_SYSTEM_NCCL=OFF
1281 - -DUSE_ROCM=$(usex rocm ON OFF)
1282 - -DUSE_FBGEMM=$(usex fbgemm ON OFF)
1283 - -DUSE_FFMPEG=$(usex ffmpeg ON OFF)
1284 - -DUSE_GFLAGS=$(usex gflags ON OFF)
1285 - -DUSE_GLOG=$(usex glog ON OFF)
1286 - -DUSE_LEVELDB=$(usex leveldb ON OFF)
1287 - -DUSE_LITE_PROTO=OFF
1288 - -DUSE_LMDB=$(usex lmdb ON OFF)
1289 - -DUSE_MKLDNN=$(usex mkldnn ON OFF)
1290 - -DUSE_MKLDNN_CBLAS=OFF
1291 - -DUSE_NNPACK=$(usex nnpack ON OFF)
1292 - -DUSE_NUMPY=$(usex python ON OFF)
1293 - -DUSE_NUMA=$(usex numa ON OFF)
1294 - -DUSE_OBSERVERS=$(usex observers ON OFF)
1295 - -DUSE_OPENCL=$(usex opencl ON OFF)
1296 - -DUSE_OPENCV=$(usex opencv ON OFF)
1297 - -DUSE_OPENMP=$(usex openmp ON OFF)
1298 - -DUSE_TBB=OFF
1299 - -DUSE_PROF=OFF
1300 - -DUSE_QNNPACK=$(usex qnnpack ON OFF)
1301 - -DUSE_REDIS=$(usex redis ON OFF)
1302 - -DUSE_ROCKSDB=OFF
1303 - -DUSE_ZMQ=$(usex zeromq ON OFF)
1304 - -DUSE_MPI=$(usex mpi ON OFF)
1305 - -DUSE_GLOO=$(usex gloo ON OFF)
1306 - -DUSE_SYSTEM_EIGEN_INSTALL=ON
1307 - -DUSE_SYSTEM_PYBIND11=ON
1308 - -DBLAS=$(usex blas Generic Eigen)
1309 - -DTP_BUILD_LIBUV=OFF
1310 - -Wno-dev
1311 - )
1312 -
1313 - HIP_PATH="${EPREFIX}/usr/lib/hip" cmake_src_configure
1314 -
1315 - if use python; then
1316 - CMAKE_BUILD_DIR="${BUILD_DIR}" distutils-r1_src_configure
1317 - fi
1318 -
1319 - # do not rerun cmake and the build process in src_install
1320 - sed '/RERUN/,+1d' -i "${BUILD_DIR}"/build.ninja || die
1321 -}
1322 -
1323 -src_compile() {
1324 - cmake_src_compile
1325 -
1326 - if use python; then
1327 - USE_SYSTEM_LIBS=ON CMAKE_BUILD_DIR=${BUILD_DIR} distutils-r1_src_compile
1328 - fi
1329 -}
1330 -
1331 -src_install() {
1332 - cmake_src_install
1333 -
1334 - local LIB=$(get_libdir)
1335 - if [[ ${LIB} != lib ]]; then
1336 - mv -fv "${ED}"/usr/lib/*.so "${ED}"/usr/${LIB}/ || die
1337 - fi
1338 -
1339 - rm -r "${ED}/usr/lib" || die
1340 -
1341 - rm -r "${ED}/usr/include/asmjit" || die
1342 - rm -r "${ED}/usr/include/c10d" || die
1343 - rm -r "${ED}/usr/include/fbgemm" || die
1344 - rm -r "${ED}/usr/include/fp16" || die
1345 - rm -r "${ED}/usr/include/gloo" || die
1346 -
1347 - if use python; then
1348 - scanelf -r --fix "${BUILD_DIR}/caffe2/python" || die
1349 - USE_SYSTEM_LIBS=ON CMAKE_BUILD_DIR=${BUILD_DIR} distutils-r1_src_install
1350 -
1351 - python_optimize
1352 - fi
1353 -
1354 - find "${ED}/usr/${LIB}" -name "*.a" -exec rm -fv {} \; || die
1355 -
1356 - if use test; then
1357 - rm -r "${ED}/usr/test" "${ED}"/usr/bin/test_{api,jit} || die
1358 - fi
1359 -
1360 - # Remove the empty directories by CMake Python:
1361 - find "${ED}" -type d -empty -delete || die
1362 -}