Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add NVIDIA acceleration how-to documentation #586

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

shikanime
Copy link

@shikanime shikanime commented Nov 10, 2024

No description provided.

@shikanime shikanime force-pushed the pr586 branch 4 times, most recently from 7ec4a50 to dfb4d86 Compare November 10, 2024 20:27

```nix
let
wsl-lib = pkgs.runCommand "wsl-lib" { } ''
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is literally a copy of

(pkgs.runCommand "wsl-lib" { } ''
mkdir -p "$out/lib"
# # we cannot just symlink the lib directory because it breaks merging with other drivers that provide the same directory
ln -s /usr/lib/wsl/lib/libcudadebugger.so.1 "$out/lib"
ln -s /usr/lib/wsl/lib/libcuda.so "$out/lib"
ln -s /usr/lib/wsl/lib/libcuda.so.1 "$out/lib"
ln -s /usr/lib/wsl/lib/libcuda.so.1.1 "$out/lib"
ln -s /usr/lib/wsl/lib/libd3d12core.so "$out/lib"
ln -s /usr/lib/wsl/lib/libd3d12.so "$out/lib"
ln -s /usr/lib/wsl/lib/libdxcore.so "$out/lib"
ln -s /usr/lib/wsl/lib/libnvcuvid.so "$out/lib"
ln -s /usr/lib/wsl/lib/libnvcuvid.so.1 "$out/lib"
ln -s /usr/lib/wsl/lib/libnvdxdlkernels.so "$out/lib"
ln -s /usr/lib/wsl/lib/libnvidia-encode.so "$out/lib"
ln -s /usr/lib/wsl/lib/libnvidia-encode.so.1 "$out/lib"
ln -s /usr/lib/wsl/lib/libnvidia-ml.so.1 "$out/lib"
ln -s /usr/lib/wsl/lib/libnvidia-opticalflow.so "$out/lib"
ln -s /usr/lib/wsl/lib/libnvidia-opticalflow.so.1 "$out/lib"
ln -s /usr/lib/wsl/lib/libnvoptix.so.1 "$out/lib"
ln -s /usr/lib/wsl/lib/libnvwgf2umx.so "$out/lib"
ln -s /usr/lib/wsl/lib/nvidia-smi "$out/lib"
'')
, right? How can we re-use those information? No one is going to keep those in sync. Maybe we should move the package to a read-only internal option?

Copy link
Author

@shikanime shikanime Nov 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it's the same, we could make it more dynamic with a for loop or depending on the API design of this project, add it as an option.

Update: So far, build isolation doesn't seem to allow us to dynamically shell for each for the shared library in an asolute path, I don't know how the home-manager managed to make it work.

Copy link
Contributor

@Atry Atry Jan 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would the ldconfig option help non-Nix binaries find the WSL drivers?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is different, there are numerous cases where the executable we want to work with comes from outside the nix store, so nix-ld is needed. This example shows how to use the GPU with it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants