Gentoo Archives: gentoo-commits

From: Ionen Wolkens <ionen@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-python/pycuda/
Date: Tue, 31 May 2022 09:50:13
Message-Id: 1653990490.8f0d3c2067afb9f443ec2dad61f28401d31365f2.ionen@gentoo
1 commit: 8f0d3c2067afb9f443ec2dad61f28401d31365f2
2 Author: Ionen Wolkens <ionen <AT> gentoo <DOT> org>
3 AuthorDate: Tue May 31 09:36:56 2022 +0000
4 Commit: Ionen Wolkens <ionen <AT> gentoo <DOT> org>
5 CommitDate: Tue May 31 09:48:10 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8f0d3c20
7
8 dev-python/pycuda: add 2021.1, enable py3.10
9
10 Also:
11 - use pep517=setuptools
12 - depend on nvidia-cuda-toolkit[profiler] wrt bug #748537
13 - drop two no-op sed expressions (was no-op in previous version too)
14 - only restrict userpriv when running tests
15 - EPREFIX->ESYSROOT, these paths aren't stored as far as I can see
16 - update LICENSE, did not see any reference to GPL-2
17 - misc cleanups
18
19 Unsure if entirely setup right as I don't use this nor dug deep,
20 and two failing tests on my hardware (with any python version) and
21 couldn't get the old version's test suite to run right to compare
22 (90% failures).
23
24 Closes: https://bugs.gentoo.org/748537
25 Closes: https://bugs.gentoo.org/845795
26 Signed-off-by: Ionen Wolkens <ionen <AT> gentoo.org>
27
28 dev-python/pycuda/Manifest | 1 +
29 dev-python/pycuda/pycuda-2021.1.ebuild | 93 ++++++++++++++++++++++++++++++++++
30 2 files changed, 94 insertions(+)
31
32 diff --git a/dev-python/pycuda/Manifest b/dev-python/pycuda/Manifest
33 index 43b7de5f8e50..10348ce0b78a 100644
34 --- a/dev-python/pycuda/Manifest
35 +++ b/dev-python/pycuda/Manifest
36 @@ -1 +1,2 @@
37 DIST pycuda-2019.1.2.tar.gz 1584807 BLAKE2B 3250430ad626b28242ff44ab9576cf1f5ecf77530e789470dfebab324de95a735c0f56e67134891bace44b1f9b7a25133ffcb74c652c6568c5afedce26907fdb SHA512 22829daa5923342eec400a24342b1d738226073bb676476e4af97629d9311426b5d2465e60811696e55401568b90e152ac96d877c6262c416099a609862db742
38 +DIST pycuda-2021.1.tar.gz 1682423 BLAKE2B 0ebd7554a5f92cd0d39ce7b5f64218f0b0dcfa1f3e63d3180306a149ad0581150630813eee7fbc17e32bb35ea711a46b84332705d6ffece7b11e7e928ef07aad SHA512 1df09f59e254f7e39b630ff41d22237ab0c81c0e6e7b7611c57eb98ade8531356b9cb3e381e6fa7e8495a46c465458febaf8ad56ceb8d570b5b25defb6dd55a9
39
40 diff --git a/dev-python/pycuda/pycuda-2021.1.ebuild b/dev-python/pycuda/pycuda-2021.1.ebuild
41 new file mode 100644
42 index 000000000000..ffc9b069deb9
43 --- /dev/null
44 +++ b/dev-python/pycuda/pycuda-2021.1.ebuild
45 @@ -0,0 +1,93 @@
46 +# Copyright 1999-2022 Gentoo Authors
47 +# Distributed under the terms of the GNU General Public License v2
48 +
49 +EAPI=8
50 +
51 +DISTUTILS_USE_PEP517=setuptools
52 +PYTHON_COMPAT=( python3_{8..10} )
53 +inherit cuda distutils-r1
54 +
55 +DESCRIPTION="Python wrapper for NVIDIA CUDA"
56 +HOMEPAGE="https://mathema.tician.de/software/pycuda/ https://pypi.org/project/pycuda/"
57 +SRC_URI="mirror://pypi/${P::1}/${PN}/${P}.tar.gz"
58 +
59 +LICENSE="Apache-2.0 MIT"
60 +SLOT="0"
61 +KEYWORDS="~amd64"
62 +IUSE="examples opengl test"
63 +
64 +RDEPEND="
65 + dev-libs/boost:=[python,${PYTHON_USEDEP}]
66 + dev-python/appdirs[${PYTHON_USEDEP}]
67 + dev-python/decorator[${PYTHON_USEDEP}]
68 + dev-python/mako[${PYTHON_USEDEP}]
69 + dev-python/numpy[${PYTHON_USEDEP}]
70 + dev-python/pytools[${PYTHON_USEDEP}]
71 + dev-util/nvidia-cuda-toolkit[profiler]
72 + x11-drivers/nvidia-drivers
73 + opengl? ( virtual/opengl )"
74 +DEPEND="${RDEPEND}"
75 +
76 +# We need write acccess /dev/nvidia0 and /dev/nvidiactl and the portage
77 +# user is (usually) not in the video group
78 +RESTRICT="test? ( userpriv ) !test? ( test )"
79 +
80 +distutils_enable_tests pytest
81 +
82 +src_prepare() {
83 + cuda_sanitize
84 +
85 + sed "s|\"--preprocess\"|&,\"--compiler-bindir=$(cuda_gccdir)\"|" \
86 + -i pycuda/compiler.py || die
87 +
88 + > siteconf.py || die
89 +
90 + distutils-r1_src_prepare
91 +}
92 +
93 +python_configure() {
94 + mkdir -p "${BUILD_DIR}" || die
95 + cd "${BUILD_DIR}" || die
96 +
97 + local conf=(
98 + "${EPYTHON}" "${S}"/configure.py
99 + --boost-inc-dir="${ESYSROOT}"/usr/include
100 + --boost-lib-dir="${ESYSROOT}"/usr/$(get_libdir)
101 + --boost-python-libname=boost_${EPYTHON/./}.so
102 + --boost-thread-libname=boost_thread
103 + --cuda-inc-dir="${ESYSROOT}"/opt/cuda/include
104 + --cuda-root="${ESYSROOT}"/opt/cuda
105 + --cudadrv-lib-dir="${ESYSROOT}"/usr/$(get_libdir)
106 + --cudart-lib-dir="${ESYSROOT}"/opt/cuda/$(get_libdir)
107 + --no-use-shipped-boost
108 + $(usev opengl --cuda-enable-gl)
109 + )
110 + echo ${conf[*]}
111 + "${conf[@]}" || die
112 +}
113 +
114 +python_test() {
115 + # we need write access to this to run the tests
116 + addwrite /dev/nvidia0
117 + addwrite /dev/nvidiactl
118 + addwrite /dev/nvidia-uvm
119 + addwrite /dev/nvidia-uvm-tools
120 +
121 + EPYTEST_DESELECT=(
122 + # needs investigation, perhaps failure is hardware-specific
123 + test/test_driver.py::test_pass_cai_array
124 + test/test_driver.py::test_pointer_holder_base
125 + )
126 +
127 + cd "${T}" || die
128 + epytest "${S}"/test
129 +}
130 +
131 +python_install_all() {
132 + distutils-r1_python_install_all
133 +
134 + if use examples; then
135 + dodoc -r examples
136 + docompress -x /usr/share/doc/${PF}/examples
137 + fi
138 +}