Gentoo Archives: gentoo-commits

From: Jason Zaman <perfinion@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: eclass/
Date: Fri, 21 Sep 2018 16:07:01
Message-Id: 1537545941.bce7726afd984518ea4ad9eddddf78df03ff36b9.perfinion@gentoo
1 commit: bce7726afd984518ea4ad9eddddf78df03ff36b9
2 Author: Jason Zaman <perfinion <AT> gentoo <DOT> org>
3 AuthorDate: Tue Sep 18 05:55:03 2018 +0000
4 Commit: Jason Zaman <perfinion <AT> gentoo <DOT> org>
5 CommitDate: Fri Sep 21 16:05:41 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bce7726a
7
8 cuda.eclass: Add version and sandbox helper methods
9
10 cuda_toolkit_version returns the version of dev-util/nvidia-cuda-toolkit
11 cuda_cudnn_version returns the version of dev-libs/cudnn
12 cuda_add_sandbox adds the nvidia dev nodes to the sandbox
13
14 Signed-off-by: Jason Zaman <perfinion <AT> gentoo.org>
15
16 eclass/cuda.eclass | 42 ++++++++++++++++++++++++++++++++++++++++++
17 1 file changed, 42 insertions(+)
18
19 diff --git a/eclass/cuda.eclass b/eclass/cuda.eclass
20 index 3a6fc3a31d1..f1c09ca2e45 100644
21 --- a/eclass/cuda.eclass
22 +++ b/eclass/cuda.eclass
23 @@ -144,6 +144,48 @@ cuda_sanitize() {
24 export NVCCFLAGS
25 }
26
27 +# @FUNCTION: cuda_add_sandbox
28 +# @USAGE: [-w]
29 +# @DESCRIPTION:
30 +# Add nvidia dev nodes to the sandbox predict list.
31 +# with -w, add to the sandbox write list.
32 +cuda_add_sandbox() {
33 + debug-print-function ${FUNCNAME} "$@"
34 +
35 + local i
36 + for i in /dev/nvidia*; do
37 + if [[ $1 == '-w' ]]; then
38 + addwrite $i
39 + else
40 + addpredict $i
41 + fi
42 + done
43 +}
44 +
45 +# @FUNCTION: cuda_toolkit_version
46 +# @DESCRIPTION:
47 +# echo the installed version of dev-util/nvidia-cuda-toolkit
48 +cuda_toolkit_version() {
49 + debug-print-function ${FUNCNAME} "$@"
50 +
51 + local v
52 + v="$(best_version dev-util/nvidia-cuda-toolkit)"
53 + v="${v##*cuda-toolkit-}"
54 + ver_cut 1-2 "${v}"
55 +}
56 +
57 +# @FUNCTION: cuda_cudnn_version
58 +# @DESCRIPTION:
59 +# echo the installed version of dev-libs/cudnn
60 +cuda_cudnn_version() {
61 + debug-print-function ${FUNCNAME} "$@"
62 +
63 + local v
64 + v="$(best_version dev-libs/cudnn)"
65 + v="${v##*cudnn-}"
66 + ver_cut 1-2 "${v}"
67 +}
68 +
69 # @FUNCTION: cuda_src_prepare
70 # @DESCRIPTION:
71 # Sanitise and export NVCCFLAGS by default