Skip to content

Commit

Permalink
cuda.eclass: Add version and sandbox helper methods
Browse files Browse the repository at this point in the history
cuda_toolkit_version returns the version of dev-util/nvidia-cuda-toolkit
cuda_cudnn_version returns the version of dev-libs/cudnn
cuda_add_sandbox adds the nvidia dev nodes to the sandbox

Signed-off-by: Jason Zaman <[email protected]>
  • Loading branch information
perfinion committed Sep 21, 2018
1 parent ff02dab commit bce7726
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions eclass/cuda.eclass
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,48 @@ cuda_sanitize() {
export NVCCFLAGS
}

# @FUNCTION: cuda_add_sandbox
# @USAGE: [-w]
# @DESCRIPTION:
# Add nvidia dev nodes to the sandbox predict list.
# with -w, add to the sandbox write list.
cuda_add_sandbox() {
debug-print-function ${FUNCNAME} "$@"

local i
for i in /dev/nvidia*; do
if [[ $1 == '-w' ]]; then
addwrite $i
else
addpredict $i
fi
done
}

# @FUNCTION: cuda_toolkit_version
# @DESCRIPTION:
# echo the installed version of dev-util/nvidia-cuda-toolkit
cuda_toolkit_version() {
debug-print-function ${FUNCNAME} "$@"

local v
v="$(best_version dev-util/nvidia-cuda-toolkit)"
v="${v##*cuda-toolkit-}"
ver_cut 1-2 "${v}"
}

# @FUNCTION: cuda_cudnn_version
# @DESCRIPTION:
# echo the installed version of dev-libs/cudnn
cuda_cudnn_version() {
debug-print-function ${FUNCNAME} "$@"

local v
v="$(best_version dev-libs/cudnn)"
v="${v##*cudnn-}"
ver_cut 1-2 "${v}"
}

# @FUNCTION: cuda_src_prepare
# @DESCRIPTION:
# Sanitise and export NVCCFLAGS by default
Expand Down

0 comments on commit bce7726

Please sign in to comment.