-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcuda_supported_runtimes.sh
executable file
·72 lines (62 loc) · 1.76 KB
/
cuda_supported_runtimes.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#! /bin/bash
BASEDIR=$(dirname $(realpath $0))
AVAILABLE=$([ -d $BASEDIR/drivers ] && ls -d $BASEDIR/drivers/*/ | xargs -n1 basename | sort -V)
LATEST=$(echo "$AVAILABLE" | tail -n1)
VERBOSE=""
DRIVERS=""
function usage() {
cat <<@EOF
Usage: $(basename $0) [-d VERSION] [-h] [-l] [-v]
Options:
-d VERSION Try to use the CUDA driver VERSION bundled with this program,
instead of the version installed on the system.
Use "latest" to use the most recent driver available.
Note that a driver newer than the one installed on the system
can only be used with a datacentre-class GPU.
-h Print a short usage and exits.
-l Lists the available driver versions bundled with this program.
-v Make the underlying test more verbose.
This is useful for debugging any CUDA device, driver or runtime
problems, but makes the output unsuitable for automatic parsing.
@EOF
}
while getopts "d:hlv" ARG; do
case $ARG in
"d")
DRIVERS="$OPTARG"
if [ "$DRIVERS" == "latest" ]; then
DRIVERS=$LATEST
fi
if ! [ -d "$BASEDIR/drivers/$DRIVERS" ]; then
echo "$(basename $0): Invalid drivers version '$DRIVERS'"
echo
echo "Valid drivers versions are:"
echo "$AVAILABLE"
exit 1
fi
;;
"h")
usage
exit 0
;;
"l")
echo "$AVAILABLE"
exit 0
;;
"v")
VERBOSE="-v"
;;
*)
echo "$(basename $0): Invalid option '$ARG'"
echo
usage
exit 1
;;
esac
done
if [ "$DRIVERS" ]; then
export LD_LIBRARY_PATH=$BASEDIR/drivers/$DRIVERS:$LD_LIBRARY_PATH
fi
for TEST in $(ls ${BASEDIR}/bin/test-*); do
$TEST $VERBOSE
done