3 # Copyright (C) The Arvados Authors. All rights reserved.
5 # SPDX-License-Identifier: Apache-2.0
12 usage: $0 SUBCOMMAND [options ...]
19 # Enumerate GPU devices on the host and output a standard "driver" name for
20 # each one found. Currently only detects `nvidia`.
22 # -vmm sets a machine-readable output format.
23 # The -d option queries 3D controllers only.
24 # You must stick with standard awk - no GNU extensions.
25 lspci -vmm -d ::0302 | awk '
27 ($1 != "Vendor:") { next; }
28 (tolower($2) ~ /^nvidia/) { print "nvidia"; }
39 # Ensure src_ext starts with a dot
40 src_ext=".${src_ext#.}"
41 dst_dir=/run/modules-load.d
43 detect_gpus | while read driver; do
44 src="/etc/modules-load.d/$driver$src_ext"
45 if [ -e "$src" ]; then
46 ln -s "$src" "$dst_dir/$driver.conf"
52 echo "$0: unknown subcommand: ${1:-}" >&2