public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Alfredo Tupone" <tupone@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: sci-libs/pytorch/files/, sci-libs/pytorch/
Date: Wed, 15 Feb 2023 19:40:54 +0000 (UTC)	[thread overview]
Message-ID: <1676490024.de632cbceb0e91127bcaefb47e3538ca48477b15.tupone@gentoo> (raw)

commit:     de632cbceb0e91127bcaefb47e3538ca48477b15
Author:     Alfredo Tupone <tupone <AT> gentoo <DOT> org>
AuthorDate: Wed Feb 15 19:40:24 2023 +0000
Commit:     Alfredo Tupone <tupone <AT> gentoo <DOT> org>
CommitDate: Wed Feb 15 19:40:24 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=de632cbc

sci-libs/pytorch: add 1.13.1

Closes: https://bugs.gentoo.org/893594
Signed-off-by: Alfredo Tupone <tupone <AT> gentoo.org>

 sci-libs/pytorch/Manifest                          |  1 +
 .../files/pytorch-1.13.1-global-dlopen.patch       | 23 ++++++++
 sci-libs/pytorch/pytorch-1.13.1.ebuild             | 62 ++++++++++++++++++++++
 3 files changed, 86 insertions(+)

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
+}


             reply	other threads:[~2023-02-15 19:40 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-15 19:40 Alfredo Tupone [this message]
  -- strict thread matches above, loose matches on Subject: below --
2025-02-27 21:27 [gentoo-commits] repo/gentoo:master commit in: sci-libs/pytorch/files/, sci-libs/pytorch/ Alfredo Tupone
2024-11-14 10:00 Alfredo Tupone
2024-10-27 13:45 Alfredo Tupone
2024-08-08 16:27 Alfredo Tupone
2023-04-05 19:37 Alfredo Tupone
2023-03-24 21:42 Alfredo Tupone
2023-02-22  8:04 Alfredo Tupone
2022-11-30 18:13 Alfredo Tupone

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1676490024.de632cbceb0e91127bcaefb47e3538ca48477b15.tupone@gentoo \
    --to=tupone@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox