1 |
commit: ce9798e81de7fea2bbe6dfc6d0645b80db649300 |
2 |
Author: Benda Xu <heroxbd <AT> gentoo <DOT> org> |
3 |
AuthorDate: Thu Feb 20 04:38:02 2020 +0000 |
4 |
Commit: Benda XU <heroxbd <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Feb 20 04:38:06 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/sci.git/commit/?id=ce9798e8 |
7 |
|
8 |
sci-libs/pytorch: add support for cuda. |
9 |
|
10 |
Bug: https://github.com/gentoo/sci/pull/941 |
11 |
Package-Manager: Portage-2.3.88, Repoman-2.3.18 |
12 |
Signed-off-by: Benda Xu <heroxbd <AT> gentoo.org> |
13 |
|
14 |
sci-libs/pytorch/files/pytorch-1.4.0-eigen.patch | 13 ---------- |
15 |
sci-libs/pytorch/pytorch-1.4.0_p0.ebuild | 33 ++++++------------------ |
16 |
2 files changed, 8 insertions(+), 38 deletions(-) |
17 |
|
18 |
diff --git a/sci-libs/pytorch/files/pytorch-1.4.0-eigen.patch b/sci-libs/pytorch/files/pytorch-1.4.0-eigen.patch |
19 |
deleted file mode 100644 |
20 |
index 54ea3a5e0..000000000 |
21 |
--- a/sci-libs/pytorch/files/pytorch-1.4.0-eigen.patch |
22 |
+++ /dev/null |
23 |
@@ -1,13 +0,0 @@ |
24 |
-Index: pytorch-1.4.0/CMakeLists.txt |
25 |
-=================================================================== |
26 |
---- pytorch-1.4.0.orig/CMakeLists.txt |
27 |
-+++ pytorch-1.4.0/CMakeLists.txt |
28 |
-@@ -173,7 +173,7 @@ option(USE_REDIS "Use Redis" OFF) |
29 |
- option(USE_ROCKSDB "Use RocksDB" OFF) |
30 |
- option(USE_SNPE "Use Qualcomm's SNPE library" OFF) |
31 |
- option(USE_SYSTEM_EIGEN_INSTALL |
32 |
-- "Use system Eigen instead of the one under third_party" OFF) |
33 |
-+ "Use system Eigen instead of the one under third_party" ON) |
34 |
- option(USE_TENSORRT "Using Nvidia TensorRT library" OFF) |
35 |
- option(USE_ZMQ "Use ZMQ" OFF) |
36 |
- option(USE_ZSTD "Use ZSTD" OFF) |
37 |
|
38 |
diff --git a/sci-libs/pytorch/pytorch-1.4.0_p0.ebuild b/sci-libs/pytorch/pytorch-1.4.0_p0.ebuild |
39 |
index 06ee528f2..90c7e9a9d 100644 |
40 |
--- a/sci-libs/pytorch/pytorch-1.4.0_p0.ebuild |
41 |
+++ b/sci-libs/pytorch/pytorch-1.4.0_p0.ebuild |
42 |
@@ -39,7 +39,7 @@ LICENSE="BSD" |
43 |
SLOT="0" |
44 |
KEYWORDS="~amd64" |
45 |
|
46 |
-IUSE="asan atlas cuda doc 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" |
47 |
+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" |
48 |
|
49 |
REQUIRED_USE=" |
50 |
python? ( ${PYTHON_REQUIRED_USE} ) |
51 |
@@ -52,8 +52,8 @@ DEPEND=" |
52 |
dev-python/pyyaml[${PYTHON_USEDEP}] |
53 |
virtual/python-typing[${PYTHON_USEDEP}] |
54 |
atlas? ( sci-libs/atlas ) |
55 |
- cuda? ( dev-util/nvidia-cuda-toolkit:0= ) |
56 |
- doc? ( dev-python/pytorch-sphinx-theme[${PYTHON_USEDEP}] ) |
57 |
+ cuda? ( dev-libs/cudnn |
58 |
+ dev-cpp/eigen[cuda] ) |
59 |
ffmpeg? ( virtual/ffmpeg ) |
60 |
gflags? ( dev-cpp/gflags ) |
61 |
glog? ( dev-cpp/glog ) |
62 |
@@ -70,13 +70,10 @@ DEPEND=" |
63 |
) |
64 |
redis? ( dev-db/redis ) |
65 |
zeromq? ( net-libs/zeromq ) |
66 |
- eigen? ( dev-cpp/eigen |
67 |
- cuda? ( dev-cpp/eigen[cuda] ) ) |
68 |
+ eigen? ( dev-cpp/eigen ) |
69 |
" |
70 |
RDEPEND="${DEPEND}" |
71 |
-BDEPEND=" |
72 |
- doc? ( app-doc/doxygen ) |
73 |
-" |
74 |
+BDEPEND="" |
75 |
|
76 |
DEPEND=" |
77 |
test? ( dev-python/pytest[${PYTHON_USEDEP}] ) |
78 |
@@ -91,7 +88,6 @@ DEPEND=" |
79 |
|
80 |
PATCHES=( |
81 |
"${FILESDIR}"/${PN}-1.2.0-setup.patch |
82 |
- "${FILESDIR}"/${PN}-1.4.0-eigen.patch |
83 |
"${FILESDIR}"/${PN}-1.4.0-sleef.patch |
84 |
"${FILESDIR}"/${PN}-1.4.0-skip-tests.patch |
85 |
"${FILESDIR}"/0002-Don-t-build-libtorch-again-for-PyTorch-1.4.0.patch |
86 |
@@ -155,13 +151,13 @@ src_configure() { |
87 |
-DTORCH_INSTALL_LIB_DIR=$(get_libdir) |
88 |
-DBUILD_BINARY=$(usex tools ON OFF) |
89 |
-DBUILD_CUSTOM_PROTOBUF=OFF |
90 |
- -DBUILD_DOCS=$(usex doc ON OFF) |
91 |
-DBUILD_PYTHON=$(usex python ON OFF) |
92 |
-DBUILD_SHARED_LIBS=$(usex static OFF ON) |
93 |
-DBUILD_TEST=$(usex test ON OFF) |
94 |
-DUSE_ASAN=$(usex asan ON OFF) |
95 |
-DUSE_CUDA=$(usex cuda ON OFF) |
96 |
-DUSE_NCCL=$(usex cuda ON OFF) |
97 |
+ -DUSE_SYSTEM_NCCL=OFF |
98 |
-DUSE_ROCM=OFF |
99 |
-DUSE_FBGEMM=$(usex fbgemm ON OFF) |
100 |
-DUSE_FFMPEG=$(usex ffmpeg ON OFF) |
101 |
@@ -173,7 +169,6 @@ src_configure() { |
102 |
-DCAFFE2_USE_MKL=$(usex mkl ON OFF) |
103 |
-DUSE_MKLDNN=$(usex mkldnn ON OFF) |
104 |
-DUSE_MKLDNN_CBLAS=OFF |
105 |
- -DUSE_NCCL=OFF |
106 |
-DUSE_NNPACK=$(usex nnpack ON OFF) |
107 |
-DUSE_NUMPY=$(usex numpy ON OFF) |
108 |
-DUSE_NUMA=$(usex numa ON OFF) |
109 |
@@ -189,9 +184,9 @@ src_configure() { |
110 |
-DUSE_ZMQ=$(usex zeromq ON OFF) |
111 |
-DUSE_MPI=$(usex mpi ON OFF) |
112 |
-DUSE_GLOO=$(usex gloo ON OFF) |
113 |
+ -DUSE_SYSTEM_EIGEN_INSTALL=ON |
114 |
-DBUILD_NAMEDTENSOR=$(usex namedtensor ON OFF) |
115 |
-DBLAS=${blas} |
116 |
- -DBUILDING_SYSTEM_WIDE=ON # to remove insecure DT_RUNPATH header |
117 |
) |
118 |
|
119 |
cmake-utils_src_configure |
120 |
@@ -212,19 +207,9 @@ src_compile() { |
121 |
src_install() { |
122 |
cmake-utils_src_install |
123 |
|
124 |
- local multilib_failing_files=( |
125 |
- libc10.so |
126 |
- libtbb.so |
127 |
- libcaffe2_observers.so |
128 |
- libshm.so |
129 |
- libcaffe2_detectron_ops.so |
130 |
- ) |
131 |
- |
132 |
local LIB=$(get_libdir) |
133 |
if [[ ${LIB} != lib ]]; then |
134 |
- for file in ${multilib_failing_files[@]}; do |
135 |
- mv -fv "${ED}/usr/lib/$file" "${ED}/usr/${LIB}" |
136 |
- done |
137 |
+ mv -fv "${ED}"/usr/lib/*.so "${ED}"/usr/${LIB}/ || die |
138 |
fi |
139 |
|
140 |
rm -rfv "${ED}/torch" |
141 |
@@ -245,8 +230,6 @@ src_install() { |
142 |
rm -fv "${ED}/usr/lib64/libtbb.so" |
143 |
rm -rfv "${ED}/usr/lib64/cmake" |
144 |
|
145 |
- rm -rfv "${ED}/usr/share/doc/mkldnn" |
146 |
- |
147 |
if use python; then |
148 |
install_shm_manager() { |
149 |
TORCH_BIN_DIR="${ED}/usr/lib64/${EPYTHON}/site-packages/torch/bin" |