1 |
cuda_toolkit_version returns the version of dev-util/nvidia-cuda-toolkit |
2 |
cuda_cudnn_version returns the version of dev-libs/cudnn |
3 |
cuda_add_sandbox adds the nvidia dev nodes to the sandbox |
4 |
|
5 |
Signed-off-by: Jason Zaman <perfinion@g.o> |
6 |
--- |
7 |
eclass/cuda.eclass | 42 ++++++++++++++++++++++++++++++++++++++++++ |
8 |
1 file changed, 42 insertions(+) |
9 |
|
10 |
diff --git a/eclass/cuda.eclass b/eclass/cuda.eclass |
11 |
index 3a6fc3a31d1..f1c09ca2e45 100644 |
12 |
--- a/eclass/cuda.eclass |
13 |
+++ b/eclass/cuda.eclass |
14 |
@@ -144,6 +144,48 @@ cuda_sanitize() { |
15 |
export NVCCFLAGS |
16 |
} |
17 |
|
18 |
+# @FUNCTION: cuda_add_sandbox |
19 |
+# @USAGE: [-w] |
20 |
+# @DESCRIPTION: |
21 |
+# Add nvidia dev nodes to the sandbox predict list. |
22 |
+# with -w, add to the sandbox write list. |
23 |
+cuda_add_sandbox() { |
24 |
+ debug-print-function ${FUNCNAME} "$@" |
25 |
+ |
26 |
+ local i |
27 |
+ for i in /dev/nvidia*; do |
28 |
+ if [[ $1 == '-w' ]]; then |
29 |
+ addwrite $i |
30 |
+ else |
31 |
+ addpredict $i |
32 |
+ fi |
33 |
+ done |
34 |
+} |
35 |
+ |
36 |
+# @FUNCTION: cuda_toolkit_version |
37 |
+# @DESCRIPTION: |
38 |
+# echo the installed version of dev-util/nvidia-cuda-toolkit |
39 |
+cuda_toolkit_version() { |
40 |
+ debug-print-function ${FUNCNAME} "$@" |
41 |
+ |
42 |
+ local v |
43 |
+ v="$(best_version dev-util/nvidia-cuda-toolkit)" |
44 |
+ v="${v##*cuda-toolkit-}" |
45 |
+ ver_cut 1-2 "${v}" |
46 |
+} |
47 |
+ |
48 |
+# @FUNCTION: cuda_cudnn_version |
49 |
+# @DESCRIPTION: |
50 |
+# echo the installed version of dev-libs/cudnn |
51 |
+cuda_cudnn_version() { |
52 |
+ debug-print-function ${FUNCNAME} "$@" |
53 |
+ |
54 |
+ local v |
55 |
+ v="$(best_version dev-libs/cudnn)" |
56 |
+ v="${v##*cudnn-}" |
57 |
+ ver_cut 1-2 "${v}" |
58 |
+} |
59 |
+ |
60 |
# @FUNCTION: cuda_src_prepare |
61 |
# @DESCRIPTION: |
62 |
# Sanitise and export NVCCFLAGS by default |
63 |
-- |
64 |
2.16.4 |