5 |
5 |
|
6 |
6 |
inherit check-reqs toolchain-funcs unpacker
|
7 |
7 |
|
8 |
|
DRIVER_PV="520.61.05"
|
|
8 |
DRIVER_PV="535.86.10"
|
9 |
9 |
|
10 |
10 |
DESCRIPTION="NVIDIA CUDA Toolkit (compiler and friends)"
|
11 |
11 |
HOMEPAGE="https://developer.nvidia.com/cuda-zone"
|
... | ... | |
15 |
15 |
LICENSE="NVIDIA-CUDA"
|
16 |
16 |
SLOT="0/${PV}"
|
17 |
17 |
KEYWORDS="-* ~amd64 ~amd64-linux"
|
18 |
|
IUSE="debugger nsight profiler vis-profiler sanitizer"
|
|
18 |
IUSE="debugger examples nsight profiler rdma vis-profiler sanitizer"
|
19 |
19 |
RESTRICT="bindist mirror"
|
20 |
20 |
|
21 |
21 |
# since CUDA 11, the bundled toolkit driver (== ${DRIVER_PV}) and the
|
22 |
|
# actual required minimum driver version are different. Lowering the
|
23 |
|
# bound helps Kepler sm_35 and sm_37 users.
|
24 |
|
# https://docs.nvidia.com/cuda/cuda-toolkit-release-notes/index.html#cuda-major-component-versions
|
|
22 |
# actual required minimum driver version are different.
|
25 |
23 |
RDEPEND="
|
26 |
|
<sys-devel/gcc-12_pre[cxx]
|
27 |
|
>=x11-drivers/nvidia-drivers-450.80.02
|
|
24 |
<sys-devel/gcc-13_pre[cxx]
|
|
25 |
>=x11-drivers/nvidia-drivers-525.60.13
|
|
26 |
examples? (
|
|
27 |
media-libs/freeglut
|
|
28 |
media-libs/glu
|
|
29 |
)
|
28 |
30 |
nsight? (
|
29 |
31 |
dev-libs/libpfm
|
30 |
32 |
dev-libs/wayland
|
31 |
33 |
dev-qt/qtwayland:6
|
32 |
34 |
|| (
|
33 |
35 |
dev-libs/openssl-compat:1.1.1
|
34 |
|
=dev-libs/openssl-1.1.1*
|
|
36 |
dev-libs/openssl:0/1.1
|
35 |
37 |
)
|
36 |
38 |
media-libs/tiff-compat:4
|
37 |
39 |
sys-libs/zlib
|
38 |
40 |
)
|
|
41 |
rdma? ( sys-cluster/rdma-core )
|
39 |
42 |
vis-profiler? (
|
40 |
43 |
>=virtual/jre-1.8:*
|
41 |
44 |
)"
|
|
45 |
BDEPEND="nsight? ( dev-util/patchelf )"
|
42 |
46 |
|
43 |
47 |
QA_PREBUILT="opt/cuda/*"
|
44 |
48 |
CHECKREQS_DISK_BUILD="15000M"
|
... | ... | |
48 |
52 |
}
|
49 |
53 |
|
50 |
54 |
src_prepare() {
|
51 |
|
# ATTENTION: change requires revbump
|
52 |
|
local cuda_supported_gcc="8.5 9.5 10 11"
|
|
55 |
# ATTENTION: change requires revbump, see link below for supported GCC # versions
|
|
56 |
# https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#system-requirements
|
|
57 |
local cuda_supported_gcc="8.5 9.5 10 11 12"
|
53 |
58 |
|
54 |
59 |
sed \
|
55 |
60 |
-e "s:CUDA_SUPPORTED_GCC:${cuda_supported_gcc}:g" \
|
... | ... | |
67 |
72 |
|
68 |
73 |
# Install standard sub packages
|
69 |
74 |
local builddirs=(
|
70 |
|
builds/cuda_{cccl,cudart,cuobjdump,cuxxfilt,memcheck,nvcc,nvdisasm,nvml_dev,nvprune,nvrtc,nvtx}
|
71 |
|
builds/lib{cublas,cufft,curand,cusolver,cusparse,npp,nvjpeg}
|
|
75 |
builds/cuda_{cccl,cudart,cuobjdump,cuxxfilt,demo_suite,nvcc,nvdisasm,nvml_dev,nvprune,nvrtc,nvtx,opencl}
|
|
76 |
builds/lib{cublas,cufft,cufile,curand,cusolver,cusparse,npp,nvjitlink,nvjpeg}
|
|
77 |
builds/nvidia_fs
|
72 |
78 |
$(usex profiler "builds/cuda_nvprof builds/cuda_cupti builds/cuda_profiler_api" "")
|
73 |
79 |
$(usex vis-profiler "builds/cuda_nvvp" "")
|
74 |
80 |
$(usex debugger "builds/cuda_gdb" "")
|
... | ... | |
124 |
130 |
eend $?
|
125 |
131 |
fi
|
126 |
132 |
|
|
133 |
use debugger && ldpathextradirs+=":${ecudadir}/extras/Debugger/lib64"
|
127 |
134 |
use profiler && ldpathextradirs+=":${ecudadir}/extras/CUPTI/lib64"
|
128 |
135 |
|
129 |
136 |
if use vis-profiler; then
|
... | ... | |
145 |
152 |
local exes=(
|
146 |
153 |
${ncu_dir}/ncu
|
147 |
154 |
${ncu_dir}/ncu-ui
|
148 |
|
${ncu_dir}/nv-nsight-cu
|
149 |
|
${ncu_dir}/nv-nsight-cu-cli
|
150 |
155 |
${ncu_dir}/host/linux-desktop-glibc_2_11_3-x64/libexec/QtWebEngineProcess
|
151 |
156 |
${ncu_dir}/host/linux-desktop-glibc_2_11_3-x64/CrashReporter
|
152 |
157 |
${ncu_dir}/host/linux-desktop-glibc_2_11_3-x64/OpenGLVersionChecker
|
|
158 |
${ncu_dir}/host/linux-desktop-glibc_2_11_3-x64/QdstrmImporter
|
153 |
159 |
${ncu_dir}/host/linux-desktop-glibc_2_11_3-x64/ncu-ui
|
154 |
160 |
${ncu_dir}/host/linux-desktop-glibc_2_11_3-x64/ncu-ui.bin
|
155 |
|
${ncu_dir}/target/linux-desktop-glibc_2_11_3-x64/TreeLauncherTargetLdPreloadHelper
|
156 |
161 |
${ncu_dir}/target/linux-desktop-glibc_2_11_3-x64/TreeLauncherSubreaper
|
|
162 |
${ncu_dir}/target/linux-desktop-glibc_2_11_3-x64/TreeLauncherTargetLdPreloadHelper
|
157 |
163 |
${ncu_dir}/target/linux-desktop-glibc_2_11_3-x64/ncu
|
158 |
164 |
)
|
159 |
165 |
|
160 |
|
dobin builds/integration/nsight-compute/{ncu,ncu-ui,nv-nsight-cu,nv-nsight-cu-cli}
|
|
166 |
dobin builds/integration/nsight-compute/{ncu,ncu-ui}
|
161 |
167 |
eend $?
|
162 |
168 |
|
|
169 |
# remove rdma libs (unless USE=rdma)
|
|
170 |
if ! use rdma; then
|
|
171 |
rm -r "${ED}"/${cudadir}/${ncu_dir}/host/target-linux-x64/CollectX || die
|
|
172 |
fi
|
|
173 |
|
163 |
174 |
local nsys_dir=$(grep -o 'nsight-systems-[0-9][0-9\.]*' -m1 manifests/cuda_x86_64.xml)
|
164 |
175 |
ebegin "Installing ${nsys_dir}"
|
165 |
176 |
mv builds/nsight_systems builds/${nsys_dir} || die
|
... | ... | |
182 |
193 |
${nsys_dir}/target-linux-x64/python/bin/python
|
183 |
194 |
)
|
184 |
195 |
|
|
196 |
# remove rdma libs (unless USE=rdma)
|
|
197 |
if ! use rdma; then
|
|
198 |
rm -r "${ED}"/${cudadir}/${nsys_dir}/target-linux-x64/CollectX || die
|
|
199 |
fi
|
|
200 |
|
185 |
201 |
dobin builds/integration/nsight-systems/{nsight-sys,nsys,nsys-exporter,nsys-ui}
|
186 |
202 |
eend $?
|
187 |
203 |
|
... | ... | |
190 |
206 |
fperms +x ${cudadir}/${f}
|
191 |
207 |
done
|
192 |
208 |
|
|
209 |
# fix broken RPATHs
|
|
210 |
patchelf --set-rpath '$ORIGIN' "${ED}"/${cudadir}/${ncu_dir}/host/linux-desktop-glibc_2_11_3-x64/libarrow.so || die
|
|
211 |
patchelf --set-rpath '$ORIGIN' "${ED}"/${cudadir}/${nsys_dir}/host-linux-x64/libarrow.so || die
|
|
212 |
|
193 |
213 |
# remove foreign archs (triggers SONAME warning, #749903)
|
194 |
214 |
rm -r "${ED}"/${cudadir}/${ncu_dir}/target/linux-desktop-glibc_2_19_0-ppc64le || die
|
195 |
215 |
rm -r "${ED}"/${cudadir}/${ncu_dir}/target/linux-desktop-t210-a64 || die
|
... | ... | |
201 |
221 |
rm "${ED}"/${cudadir}/${ncu_dir}/host/linux-desktop-glibc_2_11_3-x64/lib{crypto,ssl}.so* || die
|
202 |
222 |
rm "${ED}"/${cudadir}/${nsys_dir}/host-linux-x64/lib{crypto,ssl}.so* || die
|
203 |
223 |
|
204 |
|
# unbundle libz
|
205 |
|
rm "${ED}"/${cudadir}/${nsys_dir}/host-linux-x64/libz.so* || die
|
206 |
|
|
207 |
224 |
# unbundle libpfm
|
208 |
225 |
rm "${ED}"/${cudadir}/${nsys_dir}/host-linux-x64/libpfm.so* || die
|
209 |
226 |
|
... | ... | |
215 |
232 |
# TODO: unbundle sqlite
|
216 |
233 |
fi
|
217 |
234 |
|
|
235 |
if use examples; then
|
|
236 |
local exes=(
|
|
237 |
extras/demo_suite/bandwidthTest
|
|
238 |
extras/demo_suite/busGrind
|
|
239 |
extras/demo_suite/deviceQuery
|
|
240 |
extras/demo_suite/nbody
|
|
241 |
extras/demo_suite/oceanFFT
|
|
242 |
extras/demo_suite/randomFog
|
|
243 |
extras/demo_suite/vectorAdd
|
|
244 |
)
|
|
245 |
|
|
246 |
# set executable bit on demo_suite binaries
|
|
247 |
for f in "${exes[@]}"; do
|
|
248 |
fperms +x ${cudadir}/${f}
|
|
249 |
done
|
|
250 |
else
|
|
251 |
rm -r "${ED}"/${cudadir}/extras/demo_suite || die
|
|
252 |
fi
|
|
253 |
|
|
254 |
# remove rdma libs (unless USE=rdma)
|
|
255 |
if ! use rdma; then
|
|
256 |
rm "${ED}"/${cudadir}/targets/x86_64-linux/lib/libcufile_rdma* || die
|
|
257 |
fi
|
|
258 |
|
218 |
259 |
# Add include and lib symlinks
|
219 |
260 |
dosym targets/x86_64-linux/include ${cudadir}/include
|
220 |
261 |
dosym targets/x86_64-linux/lib ${cudadir}/lib64
|
221 |
262 |
|
|
263 |
# Remove bad symlinks
|
|
264 |
rm "${ED}"/${cudadir}/targets/x86_64-linux/include/include || die
|
|
265 |
rm "${ED}"/${cudadir}/targets/x86_64-linux/lib/lib64 || die
|
|
266 |
|
222 |
267 |
newenvd - 99cuda <<-EOF
|
223 |
268 |
PATH=${ecudadir}/bin${pathextradirs}
|
224 |
269 |
ROOTPATH=${ecudadir}/bin
|
... | ... | |
230 |
275 |
newins - 80${PN} <<-EOF
|
231 |
276 |
SEARCH_DIRS_MASK="${ecudadir}"
|
232 |
277 |
EOF
|
233 |
|
# TODO: Add pkgconfig files for installed libraries
|
234 |
278 |
}
|
235 |
279 |
|
236 |
280 |
pkg_postinst_check() {
|