Gentoo Archives: gentoo-commits

From: Benda XU <heroxbd@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/sci:master commit in: sci-libs/pytorch/, sci-libs/pytorch/files/
Date: Thu, 06 Aug 2020 01:10:44
Message-Id: 1596676050.fa9ca8f66c0bbbabb61ec8574389bab85862741a.heroxbd@gentoo
1 commit: fa9ca8f66c0bbbabb61ec8574389bab85862741a
2 Author: Benda Xu <heroxbd <AT> gentoo <DOT> org>
3 AuthorDate: Thu Aug 6 01:07:30 2020 +0000
4 Commit: Benda XU <heroxbd <AT> gentoo <DOT> org>
5 CommitDate: Thu Aug 6 01:07:30 2020 +0000
6 URL: https://gitweb.gentoo.org/proj/sci.git/commit/?id=fa9ca8f6
7
8 sci-libs/pytorch: bump to 1.6.0.
9
10 Remove virtual/python-typing dependency. It was removed from tree and only
11 needed by python-2.
12
13 Package-Manager: Portage-2.3.88, Repoman-2.3.18
14 Signed-off-by: Benda Xu <heroxbd <AT> gentoo.org>
15
16 sci-libs/pytorch/files/pytorch-1.6.0-setup.patch | 14 ++++
17 .../pytorch/files/pytorch-1.6.0-skip-tests.patch | 14 ++++
18 .../pytorch-1.6.0-tensorpipe-unbundle-libuv.patch | 13 ++++
19 sci-libs/pytorch/pytorch-1.4.0_p0.ebuild | 1 -
20 ...ytorch-1.4.0_p0.ebuild => pytorch-1.6.0.ebuild} | 87 ++++++++++++++--------
21 5 files changed, 96 insertions(+), 33 deletions(-)
22
23 diff --git a/sci-libs/pytorch/files/pytorch-1.6.0-setup.patch b/sci-libs/pytorch/files/pytorch-1.6.0-setup.patch
24 new file mode 100644
25 index 000000000..6a197a907
26 --- /dev/null
27 +++ b/sci-libs/pytorch/files/pytorch-1.6.0-setup.patch
28 @@ -0,0 +1,14 @@
29 +Index: pytorch-1.4.0_p0/setup.py
30 +===================================================================
31 +--- pytorch-1.4.0_p0.orig/setup.py
32 ++++ pytorch-1.4.0_p0/setup.py
33 +@@ -288,9 +288,7 @@ def build_deps():
34 + sys.exit(1)
35 +
36 + check_file(os.path.join(third_party_path, "gloo", "CMakeLists.txt"))
37 +- check_file(os.path.join(third_party_path, "pybind11", "CMakeLists.txt"))
38 + check_file(os.path.join(third_party_path, 'cpuinfo', 'CMakeLists.txt'))
39 +- check_file(os.path.join(third_party_path, 'tbb', 'Makefile'))
40 + check_file(os.path.join(third_party_path, 'onnx', 'CMakeLists.txt'))
41 + check_file(os.path.join(third_party_path, 'foxi', 'CMakeLists.txt'))
42 + check_file(os.path.join(third_party_path, 'QNNPACK', 'CMakeLists.txt'))
43
44 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
45 new file mode 100644
46 index 000000000..3ef2c533f
47 --- /dev/null
48 +++ b/sci-libs/pytorch/files/pytorch-1.6.0-skip-tests.patch
49 @@ -0,0 +1,14 @@
50 +Disable expected test failures.
51 +
52 +Reference: https://github.com/pytorch/pytorch/issues/13746
53 +Reference: https://github.com/pytorch/pytorch/issues/21873
54 +
55 +Index: pytorch-1.4.0_p0/caffe2/share/contrib/depthwise/CMakeLists.txt
56 +===================================================================
57 +--- pytorch-1.4.0_p0.orig/caffe2/share/contrib/depthwise/CMakeLists.txt
58 ++++ pytorch-1.4.0_p0/caffe2/share/contrib/depthwise/CMakeLists.txt
59 +@@ -6,4 +6,3 @@ set(Caffe2_CONTRIB_DEPTHWISE3x3_TEST_CPU
60 + )
61 +
62 + set(Caffe2_CPU_SRCS ${Caffe2_CPU_SRCS} ${Caffe2_CONTRIB_DEPTHWISE3x3_CPU_SRC} PARENT_SCOPE)
63 +-set(Caffe2_CPU_TEST_SRCS ${Caffe2_CPU_TEST_SRCS} ${Caffe2_CONTRIB_DEPTHWISE3x3_TEST_CPU_SRC} PARENT_SCOPE)
64
65 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
66 new file mode 100644
67 index 000000000..a4ba38322
68 --- /dev/null
69 +++ b/sci-libs/pytorch/files/pytorch-1.6.0-tensorpipe-unbundle-libuv.patch
70 @@ -0,0 +1,13 @@
71 +Index: tensorpipe/cmake/pytorch.cmake
72 +===================================================================
73 +--- tensorpipe.orig/cmake/pytorch.cmake
74 ++++ tensorpipe/cmake/pytorch.cmake
75 +@@ -138,7 +138,7 @@ endif()
76 +
77 + add_library(tensorpipe ${TENSORPIPE_SRC})
78 +
79 +-set(TP_BUILD_LIBUV ON)
80 ++set(TP_BUILD_LIBUV OFF)
81 + find_package(uv REQUIRED)
82 + target_link_libraries(tensorpipe PRIVATE uv::uv)
83 +
84
85 diff --git a/sci-libs/pytorch/pytorch-1.4.0_p0.ebuild b/sci-libs/pytorch/pytorch-1.4.0_p0.ebuild
86 index e77582078..762608507 100644
87 --- a/sci-libs/pytorch/pytorch-1.4.0_p0.ebuild
88 +++ b/sci-libs/pytorch/pytorch-1.4.0_p0.ebuild
89 @@ -50,7 +50,6 @@ REQUIRED_USE="
90 DEPEND="
91 dev-libs/protobuf
92 dev-python/pyyaml[${PYTHON_USEDEP}]
93 - virtual/python-typing[${PYTHON_USEDEP}]
94 atlas? ( sci-libs/atlas )
95 cuda? ( dev-libs/cudnn
96 dev-cpp/eigen[cuda] )
97
98 diff --git a/sci-libs/pytorch/pytorch-1.4.0_p0.ebuild b/sci-libs/pytorch/pytorch-1.6.0.ebuild
99 similarity index 63%
100 copy from sci-libs/pytorch/pytorch-1.4.0_p0.ebuild
101 copy to sci-libs/pytorch/pytorch-1.6.0.ebuild
102 index e77582078..c59b248e2 100644
103 --- a/sci-libs/pytorch/pytorch-1.4.0_p0.ebuild
104 +++ b/sci-libs/pytorch/pytorch-1.6.0.ebuild
105 @@ -12,34 +12,56 @@ MPV=${PV/_p/a}
106 DESCRIPTION="Tensors and Dynamic neural networks in Python with strong GPU acceleration"
107 HOMEPAGE="https://pytorch.org/"
108 SRC_URI="https://github.com/pytorch/${PN}/archive/v${MPV}.tar.gz -> ${P}.tar.gz
109 -https://github.com/facebookincubator/gloo/archive/ca528e32.tar.gz -> gloo-ca528e32.tar.gz
110 -https://github.com/google/benchmark/archive/505be96a.tar.gz -> benchmark-505be96a.tar.gz
111 -https://github.com/google/gemmlowp/archive/3fb5c176.tar.gz -> gemmlowp-3fb5c176.tar.gz
112 -https://github.com/google/googletest/archive/2fe3bd99.tar.gz -> googletest-2fe3bd99.tar.gz
113 -https://github.com/houseroad/foxi/archive/8f74bc4d.tar.gz -> foxi-8f74bc4d.tar.gz
114 -https://github.com/intel/ideep/archive/78eafa5d.tar.gz -> ideep-78eafa5d.tar.gz
115 -https://github.com/Maratyszcza/FP16/archive/febbb1c1.tar.gz -> FP16-febbb1c1.tar.gz
116 -https://github.com/Maratyszcza/FXdiv/archive/b742d114.tar.gz -> FXdiv-b742d114.tar.gz
117 -https://github.com/Maratyszcza/NNPACK/archive/c039579a.tar.gz -> NNPACK-c039579a.tar.gz
118 -https://github.com/Maratyszcza/PeachPy/archive/07d8fde8.tar.gz -> PeachPy-07d8fde8.tar.gz
119 -https://github.com/Maratyszcza/psimd/archive/90a938f3.tar.gz -> psimd-90a938f3.tar.gz
120 -https://github.com/Maratyszcza/pthreadpool/archive/13da0b4c.tar.gz -> pthreadpool-13da0b4c.tar.gz
121 -cuda? ( https://github.com/NVIDIA/nccl/archive/7c72dee6.tar.gz -> nccl-7c72dee6.tar.gz )
122 -https://github.com/NVlabs/cub/archive/285aeeba.tar.gz -> cub-285aeeba.tar.gz
123 -https://github.com/onnx/onnx/archive/2891e145.tar.gz -> onnx-2891e145.tar.gz
124 -https://github.com/onnx/onnx-tensorrt/archive/cb3d8066.tar.gz -> onnx-tensorrt-cb3d8066.tar.gz
125 -https://github.com/pytorch/cpuinfo/archive/89fe1695.tar.gz -> cpuinfo-89fe1695.tar.gz
126 -https://github.com/pytorch/fbgemm/archive/82d259da.tar.gz -> fbgemm-82d259da.tar.gz
127 -https://github.com/pytorch/QNNPACK/archive/7d2a4e99.tar.gz -> QNNPACK-7d2a4e99.tar.gz
128 -https://github.com/shibatch/sleef/archive/7f523de6.tar.gz -> sleef-7f523de6.tar.gz
129 -https://github.com/asmjit/asmjit/archive/17556b2d.tar.gz -> asmjit-17556b2d.tar.gz
130 +https://github.com/google/benchmark/archive/505be96ab.tar.gz -> benchmark-505be96ab.tar.gz
131 +https://github.com/pytorch/cpuinfo/archive/63b254577.tar.gz -> cpuinfo-63b254577.tar.gz
132 +https://github.com/NVlabs/cub/archive/d106ddb99.tar.gz -> cub-d106ddb99.tar.gz
133 +https://github.com/pytorch/fbgemm/archive/87c378172.tar.gz -> fbgemm-87c378172.tar.gz
134 +https://github.com/fmtlib/fmt/archive/9bdd1596c.tar.gz -> fmt-9bdd1596c.tar.gz
135 +https://github.com/houseroad/foxi/archive/8015abb72.tar.gz -> foxi-8015abb72.tar.gz
136 +https://github.com/Maratyszcza/FP16/archive/4dfe081cf.tar.gz -> FP16-4dfe081cf.tar.gz
137 +https://github.com/Maratyszcza/FXdiv/archive/b408327ac.tar.gz -> FXdiv-b408327ac.tar.gz
138 +https://github.com/google/gemmlowp/archive/3fb5c176c.tar.gz -> gemmlowp-3fb5c176c.tar.gz
139 +https://github.com/facebookincubator/gloo/archive/3d08580f9.tar.gz -> gloo-3d08580f9.tar.gz
140 +https://github.com/google/googletest/archive/2fe3bd994.tar.gz -> googletest-2fe3bd994.tar.gz
141 +https://github.com/intel/ideep/archive/938cc6889.tar.gz -> ideep-938cc6889.tar.gz
142 +cuda? ( https://github.com/NVIDIA/nccl/archive/5949d96f3.tar.gz -> nccl-5949d96f3.tar.gz )
143 +https://github.com/Maratyszcza/NNPACK/archive/24b55303f.tar.gz -> NNPACK-24b55303f.tar.gz
144 +https://github.com/onnx/onnx/archive/a82c6a701.tar.gz -> onnx-a82c6a701.tar.gz
145 +https://github.com/onnx/onnx-tensorrt/archive/c15321141.tar.gz -> onnx-tensorrt-c15321141.tar.gz
146 +https://github.com/Maratyszcza/psimd/archive/072586a71.tar.gz -> psimd-072586a71.tar.gz
147 +https://github.com/Maratyszcza/pthreadpool/archive/029c88620.tar.gz -> pthreadpool-029c88620.tar.gz
148 +https://github.com/Maratyszcza/PeachPy/archive/07d8fde8a.tar.gz -> PeachPy-07d8fde8a.tar.gz
149 +https://github.com/pytorch/QNNPACK/archive/7d2a4e993.tar.gz -> QNNPACK-7d2a4e993.tar.gz
150 +https://github.com/shibatch/sleef/archive/7f523de65.tar.gz -> sleef-7f523de65.tar.gz
151 +https://github.com/pytorch/tensorpipe/archive/3b8089c9c.tar.gz -> tensorpipe-3b8089c9c.tar.gz
152 +https://github.com/google/XNNPACK/archive/1b354636b.tar.gz -> XNNPACK-1b354636b.tar.gz
153 +https://github.com/asmjit/asmjit/archive/9057aa30.tar.gz -> asmjit-9057aa30.tar.gz
154 "
155
156 +# git clone git@××××××.com:pytorch/pytorch.git && cd pytorch
157 +# src_uri() {
158 +# join \
159 +# <(git config --file .gitmodules --get-regexp url | sed -r -e 's/^submodule.(.*).url (.*)/\1 \2/' -e 's,NNPACK_deps/,,' -e 's/third-party/third_party/' | sort) \
160 +# <(git submodule status | awk '{print $2 " " $1}' | sort) | \
161 +# while read path url hash; do
162 +# [[ ${path} =~ (eigen|six|ios|neon2sse|protobuf|pybind11|enum34|tbb|zstd|fbjni) ]] && continue
163 +# u=${url%.git}
164 +# h=${hash#-}
165 +# h=${h:0:8}
166 +# echo "${u}/archive/${h}.tar.gz -> $(basename ${u})-${h}.tar.gz"
167 +# done
168 +# }
169 +# src_uri
170 +
171 +# git submodule update --init third_party/fbgemm && cd third_party/fbgemm
172 +# src_uri | grep asmjit
173 +# cd ../..
174 +
175 LICENSE="BSD"
176 SLOT="0"
177 KEYWORDS="~amd64"
178
179 -IUSE="asan atlas cuda eigen +fbgemm ffmpeg gflags glog +gloo leveldb lmdb mkl mkldnn mpi namedtensor +nnpack numa +numpy +observers +openblas opencl opencv +openmp +python +qnnpack redis static tbb test tools zeromq"
180 +IUSE="asan atlas cuda eigen +fbgemm ffmpeg gflags glog +gloo leveldb lmdb mkl mkldnn mpi namedtensor +nnpack numa +numpy +observers +openblas opencl opencv +openmp +python +qnnpack redis static test tools zeromq"
181
182 REQUIRED_USE="
183 python? ( ${PYTHON_REQUIRED_USE} )
184 @@ -47,10 +69,9 @@ REQUIRED_USE="
185 ^^ ( atlas eigen mkl openblas )
186 "
187
188 -DEPEND="
189 +RDEPEND="
190 dev-libs/protobuf
191 dev-python/pyyaml[${PYTHON_USEDEP}]
192 - virtual/python-typing[${PYTHON_USEDEP}]
193 atlas? ( sci-libs/atlas )
194 cuda? ( dev-libs/cudnn
195 dev-cpp/eigen[cuda] )
196 @@ -71,11 +92,11 @@ DEPEND="
197 redis? ( dev-db/redis )
198 zeromq? ( net-libs/zeromq )
199 eigen? ( dev-cpp/eigen )
200 + dev-libs/libuv
201 "
202 -RDEPEND="${DEPEND}"
203 BDEPEND=""
204
205 -DEPEND="
206 +DEPEND="${RDEPEND}
207 test? ( dev-python/pytest[${PYTHON_USEDEP}] )
208 dev-python/setuptools[${PYTHON_USEDEP}]
209 dev-cpp/tbb
210 @@ -87,9 +108,8 @@ DEPEND="
211 "
212
213 PATCHES=(
214 - "${FILESDIR}"/${PN}-1.2.0-setup.patch
215 - "${FILESDIR}"/${PN}-1.4.0-sleef.patch
216 - "${FILESDIR}"/${PN}-1.4.0-skip-tests.patch
217 + "${FILESDIR}"/${PN}-1.6.0-setup.patch
218 + "${FILESDIR}"/${PN}-1.6.0-skip-tests.patch
219 "${FILESDIR}"/0002-Don-t-build-libtorch-again-for-PyTorch-1.4.0.patch
220 "${FILESDIR}"/0003-Change-path-to-caffe2-build-dir-made-by-libtorch.patch
221 "${FILESDIR}"/0005-Change-library-directory-according-to-CMake-build.patch
222 @@ -98,7 +118,7 @@ PATCHES=(
223 src_unpack() {
224 default
225
226 - mv -v ${PN}-${MPV} ${P} || die
227 + [[ -d ${P} ]] || mv -v ${PN}-${MPV} ${P} || die
228 }
229
230 src_prepare() {
231 @@ -133,6 +153,9 @@ src_prepare() {
232 cuda_src_prepare
233 export CUDAHOSTCXX=$(cuda_gccdir)/g++
234 fi
235 +
236 + cd ../tensorpipe || die
237 + eapply "${FILESDIR}"/${PN}-1.6.0-tensorpipe-unbundle-libuv.patch
238 }
239
240 src_configure() {
241 @@ -192,11 +215,11 @@ src_configure() {
242 cmake-utils_src_configure
243
244 if use python; then
245 - CMAKE_BUILD_DIR=${BUILD_DIR} distutils-r1_src_configure
246 + CMAKE_BUILD_DIR="${BUILD_DIR}" distutils-r1_src_configure
247 fi
248
249 # do not rerun cmake and the build process in src_install
250 - sed '/RERUN/,+1d' -i ${BUILD_DIR}/build.ninja || die
251 + sed '/RERUN/,+1d' -i "${BUILD_DIR}"/build.ninja || die
252 }
253
254 src_compile() {