Fix for Nvidia Passthrough (#166)
* Fix Nvidia Passthrough closing #127 * Mount libraries parent directory * Use the dynamic library path from the existing code
This commit is contained in:
parent
bc8284edb8
commit
525992727a
28
jlmkr.py
28
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."""
|
||||
|
@ -353,6 +353,17 @@ def passthrough_nvidia(
|
|||
return
|
||||
|
||||
try:
|
||||
# Get list of libraries
|
||||
nvidia_libraries = set(
|
||||
[
|
||||
x
|
||||
for x in subprocess.check_output(["nvidia-container-cli", "list", "--libraries"])
|
||||
.decode()
|
||||
.split("\n")
|
||||
if x
|
||||
]
|
||||
)
|
||||
# Get full list of files, but excluding library ones from above
|
||||
nvidia_files = set(
|
||||
(
|
||||
[
|
||||
|
@ -361,6 +372,7 @@ def passthrough_nvidia(
|
|||
.decode()
|
||||
.split("\n")
|
||||
if x
|
||||
and x not in nvidia_libraries
|
||||
]
|
||||
)
|
||||
)
|
||||
|
@ -393,16 +405,10 @@ def passthrough_nvidia(
|
|||
|
||||
# Check if the parent dir exists where we want to write our conf file
|
||||
if ld_so_conf_path.parent.exists():
|
||||
nvidia_libraries = set(
|
||||
Path(x)
|
||||
for x in subprocess.check_output(
|
||||
["nvidia-container-cli", "list", "--libraries"]
|
||||
)
|
||||
.decode()
|
||||
.split("\n")
|
||||
if x
|
||||
)
|
||||
library_folders = set(str(x.parent) for x in nvidia_libraries)
|
||||
library_folders = set(str(Path(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