diff options
author | Alfredo Tupone <tupone@gentoo.org> | 2023-02-15 20:40:24 +0100 |
---|---|---|
committer | Alfredo Tupone <tupone@gentoo.org> | 2023-02-15 20:40:24 +0100 |
commit | de632cbceb0e91127bcaefb47e3538ca48477b15 (patch) | |
tree | 7096efc0d6f6a883fb73fb6bfaf87ad7e9105d53 /sci-libs | |
parent | sci-libs/caffe2: add 1.13.1 (diff) | |
download | gentoo-de632cbceb0e91127bcaefb47e3538ca48477b15.tar.gz gentoo-de632cbceb0e91127bcaefb47e3538ca48477b15.tar.bz2 gentoo-de632cbceb0e91127bcaefb47e3538ca48477b15.zip |
sci-libs/pytorch: add 1.13.1
Closes: https://bugs.gentoo.org/893594
Signed-off-by: Alfredo Tupone <tupone@gentoo.org>
Diffstat (limited to 'sci-libs')
-rw-r--r-- | sci-libs/pytorch/Manifest | 1 | ||||
-rw-r--r-- | sci-libs/pytorch/files/pytorch-1.13.1-global-dlopen.patch | 23 | ||||
-rw-r--r-- | sci-libs/pytorch/pytorch-1.13.1.ebuild | 62 |
3 files changed, 86 insertions, 0 deletions
diff --git a/sci-libs/pytorch/Manifest b/sci-libs/pytorch/Manifest index fba79e4a9a24..7a1c9e4370ae 100644 --- a/sci-libs/pytorch/Manifest +++ b/sci-libs/pytorch/Manifest @@ -1,3 +1,4 @@ DIST pytorch-1.12.0.tar.gz 106286765 BLAKE2B ff9bafedb35f859f7dccb9b606299cf9c345bdaa0deb87ecfe0c0c30c3c828414d989e1d9a243d9b7cd3f376d56a2f81c241ca2e3c9a8a2b30cddcdeddd3a5c7 SHA512 c9c748a2e0047daaaf199a1ba3198d2d1aee47f664170a9b34ccacd3deeb95f2070e4035eeb900012ef48dc62cf6fb6806f1a1dfe22de8c94892963076e593b7 DIST pytorch-1.12.1.tar.gz 106311625 BLAKE2B e8ca19d0e1987449c33ad4c36722a3a467f7f8a9f90be2a7f2de643cbd665038f6802b5ff1f1d3da09b6253d8f29e11549a24295de013d97f73affe538c84c99 SHA512 afeb551904ebd9b5901ae623a98eadbb3045115247cedf8006a940742cfad04e5ce24cfaf363336a9ed88d7ce6a4ac53dbb6a5c690aef6efdf20477c3a22c7ca DIST pytorch-1.13.0.tar.gz 108276317 BLAKE2B 8149775dea06d8e4027b741c828169d33f768a96aef58cd2f86daa3bbad5bf36143454e26b683a992aca34e7fb52e6483c46168b698db48ff6978c9605d7a3d2 SHA512 5a0e8c589bdf552ccf682511a8860c754ab6f5844f51e568c5034793f787b97707af4340b338b9b8606dd27a6ced6ef50091f0cc514458b3021a2220409d7f20 +DIST pytorch-1.13.1.tar.gz 108279745 BLAKE2B 75de03b74dfdaf8d8fb5ea743fcc0c1b0e408a714ad4160c487921220a7b1755e5fa6e587e6bbc8c9f34dd75e096d2e6dd69c80d24821835fff6c833314434d3 SHA512 f16f89d027efade11d057245cad5b69a390e88b458398310ae30de2dbff7c8fd7f1165be7b8da7ea989c81ac3f5a66c5cb9050610e441a97c83fb8aa28c0bd62 diff --git a/sci-libs/pytorch/files/pytorch-1.13.1-global-dlopen.patch b/sci-libs/pytorch/files/pytorch-1.13.1-global-dlopen.patch new file mode 100644 index 000000000000..4f414be67a29 --- /dev/null +++ b/sci-libs/pytorch/files/pytorch-1.13.1-global-dlopen.patch @@ -0,0 +1,23 @@ +Don't hardcode the library path. Leave it to the dynamic loader. + +Index: pytorch-1.13.1/torch/__init__.py +=================================================================== +--- a/torch/__init__.py 2023-02-15 20:27:51.747853677 +0100 ++++ b/torch/__init__.py 2023-02-15 20:28:23.506341918 +0100 +@@ -169,14 +169,14 @@ + lib_path = os.path.join(os.path.dirname(here), 'lib', lib_name) + + try: +- ctypes.CDLL(lib_path, mode=ctypes.RTLD_GLOBAL) ++ ctypes.CDLL(lib_name, mode=ctypes.RTLD_GLOBAL) + except OSError as err: + # Can only happen of wheel with cublas as PYPI deps + # As PyTorch is not purelib, but nvidia-cublas-cu11 is + if 'libcublas.so.11' not in err.args[0]: + raise err + _preload_cuda_deps() +- ctypes.CDLL(lib_path, mode=ctypes.RTLD_GLOBAL) ++ ctypes.CDLL(lib_name, mode=ctypes.RTLD_GLOBAL) + + + if (USE_RTLD_GLOBAL_WITH_LIBTORCH or os.getenv('TORCH_USE_RTLD_GLOBAL')) and \ diff --git a/sci-libs/pytorch/pytorch-1.13.1.ebuild b/sci-libs/pytorch/pytorch-1.13.1.ebuild new file mode 100644 index 000000000000..898c43a39ba9 --- /dev/null +++ b/sci-libs/pytorch/pytorch-1.13.1.ebuild @@ -0,0 +1,62 @@ +# Copyright 2022-2023 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +DISTUTILS_USE_PEP517=setuptools +PYTHON_COMPAT=( python3_{9,10} ) +DISTUTILS_SINGLE_IMPL=1 +inherit distutils-r1 + +DESCRIPTION="Tensors and Dynamic neural networks in Python" +HOMEPAGE="https://pytorch.org/" +SRC_URI="https://github.com/pytorch/${PN}/archive/refs/tags/v${PV}.tar.gz + -> ${P}.tar.gz" + +LICENSE="BSD" +SLOT="0" +KEYWORDS="~amd64" +RESTRICT="test" + +REQUIRED_USE=${PYTHON_REQUIRED_USE} +RDEPEND=" + ${PYTHON_DEPS} + ~sci-libs/caffe2-${PV}[${PYTHON_SINGLE_USEDEP}] + $(python_gen_cond_dep ' + dev-python/typing-extensions[${PYTHON_USEDEP}] + ') +" +DEPEND="${RDEPEND} + $(python_gen_cond_dep ' + dev-python/pyyaml[${PYTHON_USEDEP}] + ') +" + +src_prepare() { + eapply \ + "${FILESDIR}"/0002-Don-t-build-libtorch-again-for-PyTorch-1.7.1.patch \ + "${FILESDIR}"/pytorch-1.9.0-Change-library-directory-according-to-CMake-build.patch \ + "${FILESDIR}"/${P}-global-dlopen.patch \ + "${FILESDIR}"/pytorch-1.7.1-torch_shm_manager.patch \ + "${FILESDIR}"/${PN}-1.13.0-setup.patch \ + + # Set build dir for pytorch's setup + sed -i \ + -e "/BUILD_DIR/s|build|/var/lib/caffe2/|" \ + tools/setup_helpers/env.py \ + || die + distutils-r1_src_prepare +} + +src_compile() { + PYTORCH_BUILD_VERSION=${PV} \ + PYTORCH_BUILD_NUMBER=0 \ + USE_SYSTEM_LIBS=ON \ + CMAKE_BUILD_DIR="${BUILD_DIR}" \ + BUILD_DIR= \ + distutils-r1_src_compile +} + +src_install() { + USE_SYSTEM_LIBS=ON distutils-r1_src_install +} |