Compare commits
4 Commits
90f42d2e28
...
aeb58992d5
Author | SHA1 | Date |
---|---|---|
Darren Gibbard | aeb58992d5 | |
Darren Gibbard | b18ff2ebc9 | |
Darren Gibbard | 2c0d69770b | |
Darren Gibbard | 47a96901a5 |
16
jlmkr.py
16
jlmkr.py
|
@ -4,7 +4,7 @@
|
|||
with full access to all files via bind mounts, \
|
||||
thanks to systemd-nspawn!"""
|
||||
|
||||
__version__ = "1.4.0"
|
||||
__version__ = "1.4.1"
|
||||
|
||||
__disclaimer__ = """USE THIS SCRIPT AT YOUR OWN RISK!
|
||||
IT COMES WITHOUT WARRANTY AND IS NOT SUPPORTED BY IXSYSTEMS."""
|
||||
|
@ -44,7 +44,7 @@ docker_compatible=0
|
|||
seccomp=1
|
||||
|
||||
# Below you may add additional systemd-nspawn flags behind systemd_nspawn_user_args=
|
||||
# To mount host storage in the jail, you may add: --bind='/mnt/pool/dataset:/home'
|
||||
# To mount host storage in the jail, you may add: --bind='/mnt/pool/dataset:/home'
|
||||
# To readonly mount host storage, you may add: --bind-ro=/etc/certificates
|
||||
# To use macvlan networking add: --network-macvlan=eno1 --resolv-conf=bind-host
|
||||
# To use bridge networking add: --network-bridge=br1 --resolv-conf=bind-host
|
||||
|
@ -353,16 +353,16 @@ def passthrough_nvidia(
|
|||
return
|
||||
|
||||
try:
|
||||
# List nvidia items, without the libraries, since we look those up later in library_folders
|
||||
command = "/bin/bash -c 'nvidia-container-cli list | grep -vFf <(nvidia-container-cli list --libraries)'"
|
||||
nvidia_files = set(
|
||||
(
|
||||
[
|
||||
x
|
||||
for x in subprocess.check_output(["nvidia-container-cli", "list"])
|
||||
for x in subprocess.check_output(command, shell=True)
|
||||
.decode()
|
||||
.split("\n")
|
||||
if x
|
||||
# Strip individual modules for current kernel, since we add the whole directory later
|
||||
and "/usr/lib/x86_64-linux-gnu/nvidia/current" not in x
|
||||
]
|
||||
)
|
||||
)
|
||||
|
@ -380,9 +380,6 @@ def passthrough_nvidia(
|
|||
# while mounting the symlink will be resolved and nvidia-smi will appear as a regular file
|
||||
nvidia_files.add("/usr/bin/nvidia-smi")
|
||||
|
||||
# Use current module dir
|
||||
nvidia_files.add("/usr/lib/x86_64-linux-gnu/nvidia/current")
|
||||
|
||||
nvidia_mounts = []
|
||||
|
||||
for file_path in nvidia_files:
|
||||
|
@ -408,6 +405,9 @@ def passthrough_nvidia(
|
|||
if x
|
||||
)
|
||||
library_folders = set(str(x.parent) for x in nvidia_libraries)
|
||||
# Add the library folders as mounts
|
||||
for lf in library_folders:
|
||||
nvidia_mounts.append(f"--bind-ro={lf}")
|
||||
|
||||
# Only write if the conf file doesn't yet exist or has different contents
|
||||
existing_conf_libraries = set()
|
||||
|
|
Loading…
Reference in New Issue