aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYiyang Wu <xgreenlandforwyy@gmail.com>2024-10-30 14:09:19 +0800
committerAndrew Ammerlaan <andrewammerlaan@gentoo.org>2024-10-30 08:51:02 +0100
commit98ac6bd1abbfbb2ce9e988cff500046fa515674a (patch)
tree43fab971445b46246e0adbf81736d0e16d5bea51 /sci-libs
parentsci-physics/cernlib: add 2024.06.12.0 (diff)
downloadsci-98ac6bd1abbfbb2ce9e988cff500046fa515674a.tar.gz
sci-98ac6bd1abbfbb2ce9e988cff500046fa515674a.tar.bz2
sci-98ac6bd1abbfbb2ce9e988cff500046fa515674a.zip
sci-libs/torchvision: add 0.19.1, drop olds
Enable tests. torchvision should be rebuilt if caffe2 turns on/off cuda or rocm. So adding cuda/rocm to USE flag and dependencies to handle this. Reference: https://bugs.gentoo.org/680496 Signed-off-by: Yiyang Wu <xgreenlandforwyy@gmail.com> Closes: https://github.com/gentoo/sci/pull/1293 Signed-off-by: Andrew Ammerlaan <andrewammerlaan@gentoo.org>
Diffstat (limited to 'sci-libs')
-rw-r--r--sci-libs/torchvision/Manifest3
-rw-r--r--sci-libs/torchvision/files/torchvision-0.17.1-ffmpeg-6.patch36
-rw-r--r--sci-libs/torchvision/metadata.xml3
-rw-r--r--sci-libs/torchvision/torchvision-0.14.1.ebuild40
-rw-r--r--sci-libs/torchvision/torchvision-0.19.1.ebuild (renamed from sci-libs/torchvision/torchvision-0.17.1.ebuild)26
5 files changed, 25 insertions, 83 deletions
diff --git a/sci-libs/torchvision/Manifest b/sci-libs/torchvision/Manifest
index 7cf5fa956..d30501570 100644
--- a/sci-libs/torchvision/Manifest
+++ b/sci-libs/torchvision/Manifest
@@ -1,2 +1 @@
-DIST torchvision-0.14.1.tar.gz 9265179 BLAKE2B 0708635b00ac7c2cf4e54799f1190f01f3240f53233695819f691313b8a369b8922520e2f3cf96184bab671877b5826b84e0936d9ca5b58004d6e2a098c6cbbf SHA512 08fb1e35da1c3f1d0446ef879d9b6a7ae839a5137c3b5b46ef8111c2ae890299e2b555d1bd3b3d61f96b8778b831d8f895487cf8a4e36e371fcd4b8acda67d1f
-DIST torchvision-0.17.1.tar.gz 13091686 BLAKE2B db25faab565412f2892ca4cf8d13c459b8045aaab83009a686a93272f0b3e3e8c0da930f1d7b0682e0adc7a600195b035ca19f71fd15a26f77b349206e3ed324 SHA512 c9ef5704a337a43c1ab3a5865b2a20d09d07a9b5eeda66c7aa1e1931772bad9acee822bb400cf627960a84ace01188cd32e95f0e709eb392bf9028d36cfc50be
+DIST torchvision-0.19.1.tar.gz 13135101 BLAKE2B 1d8ed851750840518dab6ff1153bbdcac723832500c072e78036282ef9396c33862b9f72cfd09456daea89e8c496d04a01e880a533e0f4c01779ed8add30bc55 SHA512 87ba1616ac6ed92851b0908bf7e5a3f840a3de8ab6fa5d7d3b27f9ed37efc5082540a88b4216a4fd91284c27dd69625ea04f2c1b81a6e5149e4ba3bea261b22b
diff --git a/sci-libs/torchvision/files/torchvision-0.17.1-ffmpeg-6.patch b/sci-libs/torchvision/files/torchvision-0.17.1-ffmpeg-6.patch
deleted file mode 100644
index 7a3637f3a..000000000
--- a/sci-libs/torchvision/files/torchvision-0.17.1-ffmpeg-6.patch
+++ /dev/null
@@ -1,36 +0,0 @@
-From 86620bd84b872b76db0acafec167949dca03a29e Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Zolt=C3=A1n=20B=C3=B6sz=C3=B6rm=C3=A9nyi?=
- <zboszor@gmail.com>
-Date: Tue, 7 Nov 2023 10:43:11 +0100
-Subject: [PATCH] Fix build with ffmpeg 6.0
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Signed-off-by: Zoltán Böszörményi <zboszor@gmail.com>
----
- torchvision/csrc/io/decoder/stream.cpp | 11 ++---------
- 1 file changed, 2 insertions(+), 9 deletions(-)
-
-diff --git a/torchvision/csrc/io/decoder/stream.cpp b/torchvision/csrc/io/decoder/stream.cpp
-index 0d625ef211c..8c914050587 100644
---- a/torchvision/csrc/io/decoder/stream.cpp
-+++ b/torchvision/csrc/io/decoder/stream.cpp
-@@ -63,15 +63,8 @@ int Stream::openCodec(std::vector<DecoderMetadata>* metadata, int num_threads) {
- codecCtx_->thread_count = num_threads;
- } else {
- // otherwise set sensible defaults
-- // with the special case for the different MPEG4 codecs
-- // that don't have threading context functions
-- if (codecCtx_->codec->capabilities & AV_CODEC_CAP_INTRA_ONLY) {
-- codecCtx_->thread_type = FF_THREAD_FRAME;
-- codecCtx_->thread_count = 2;
-- } else {
-- codecCtx_->thread_count = 8;
-- codecCtx_->thread_type = FF_THREAD_SLICE;
-- }
-+ codecCtx_->thread_count = 8;
-+ codecCtx_->thread_type = FF_THREAD_SLICE;
- }
-
- int ret;
diff --git a/sci-libs/torchvision/metadata.xml b/sci-libs/torchvision/metadata.xml
index 9c4ddaefd..3ba68fb09 100644
--- a/sci-libs/torchvision/metadata.xml
+++ b/sci-libs/torchvision/metadata.xml
@@ -5,6 +5,9 @@
<email>jpizarrocallejas@gmail.com</email>
<name>Jorge Pizarro Callejas</name>
</maintainer>
+ <use>
+ <flag name="rocm">Enable ROCm gpu computing support</flag>
+ </use>
<upstream>
<remote-id type="github">pytorch/vision</remote-id>
</upstream>
diff --git a/sci-libs/torchvision/torchvision-0.14.1.ebuild b/sci-libs/torchvision/torchvision-0.14.1.ebuild
deleted file mode 100644
index 7f40fe556..000000000
--- a/sci-libs/torchvision/torchvision-0.14.1.ebuild
+++ /dev/null
@@ -1,40 +0,0 @@
-# Copyright 2020-2021 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-PYTHON_COMPAT=( python3_10 )
-DISTUTILS_SINGLE_IMPL=1
-DISTUTILS_USE_PEP517=setuptools
-inherit distutils-r1
-
-DESCRIPTION="Datasets, transforms and models to specific to computer vision"
-HOMEPAGE="https://github.com/pytorch/vision"
-SRC_URI="https://github.com/pytorch/vision/archive/v${PV}.tar.gz -> ${P}.tar.gz"
-S="${WORKDIR}/vision-${PV}"
-
-LICENSE="BSD"
-SLOT="0"
-KEYWORDS="~amd64"
-
-RDEPEND="
- $(python_gen_cond_dep '
- dev-python/numpy[${PYTHON_USEDEP}]
- dev-python/typing-extensions[${PYTHON_USEDEP}]
- dev-python/pillow[${PYTHON_USEDEP}]
- dev-python/requests[${PYTHON_USEDEP}]
- dev-python/scipy[${PYTHON_USEDEP}]
- ')
- sci-libs/pytorch[${PYTHON_SINGLE_USEDEP}]
- media-video/ffmpeg
- dev-qt/qtcore:5
-"
-DEPEND="${RDEPEND}"
-BDEPEND="
- test? (
- $(python_gen_cond_dep '
- dev-python/mock[${PYTHON_USEDEP}]
- ')
- )"
-
-distutils_enable_tests pytest
diff --git a/sci-libs/torchvision/torchvision-0.17.1.ebuild b/sci-libs/torchvision/torchvision-0.19.1.ebuild
index e0c72684c..a8fc6f5f7 100644
--- a/sci-libs/torchvision/torchvision-0.17.1.ebuild
+++ b/sci-libs/torchvision/torchvision-0.19.1.ebuild
@@ -3,11 +3,12 @@
EAPI=8
-PYTHON_COMPAT=( python3_{10..12} )
+PYTHON_COMPAT=( python3_{11..12} )
DISTUTILS_SINGLE_IMPL=1
DISTUTILS_USE_PEP517=setuptools
DISTUTILS_EXT=1
-inherit distutils-r1 multiprocessing
+ROCM_SKIP_GLOBALS=1
+inherit cuda distutils-r1 multiprocessing rocm
DESCRIPTION="Datasets, transforms and models to specific to computer vision"
HOMEPAGE="https://github.com/pytorch/vision"
@@ -17,7 +18,11 @@ S="${WORKDIR}/vision-${PV}"
LICENSE="BSD"
SLOT="0"
KEYWORDS="~amd64"
-RESTRICT="test"
+IUSE="cuda rocm test"
+REQUIRED_USE="?? ( cuda rocm )"
+RESTRICT="!test? ( test )"
+
+distutils_enable_tests pytest
RDEPEND="
$(python_gen_cond_dep '
@@ -27,13 +32,12 @@ RDEPEND="
dev-python/requests[${PYTHON_USEDEP}]
dev-python/scipy[${PYTHON_USEDEP}]
')
+ sci-libs/caffe2[cuda?,rocm?]
sci-libs/pytorch[${PYTHON_SINGLE_USEDEP}]
media-video/ffmpeg:=
"
DEPEND="${RDEPEND}"
-PATCHES=( "${FILESDIR}/${PN}-0.17.1-ffmpeg-6.patch" )
-
src_compile()
{
export MAX_JOBS="$(makeopts_jobs)" # Let ninja respect MAKEOPTS
@@ -41,5 +45,17 @@ src_compile()
# Ensure some ext_module sources are compiled before linking
export MAKEOPTS="-j1"
+ use cuda && export NVCC_FLAGS="$(cuda_gccdir -f | tr -d \")"
+ use rocm && addpredict /dev/kfd
+
distutils-r1_src_compile
}
+
+python_test() {
+ use rocm && check_amdgpu
+
+ # https://projects.gentoo.org/python/guide/test.html#importerrors-for-c-extensions
+ rm -rf torchvision || die
+
+ epytest
+}