Open tgruben opened 10 months ago
Hello! I do apologize for the delay in replying here 😅 but I hope your time with Rust has been fun so far!
I'm not entirely sure why you're getting the DriverNotLoaded
error in this scenario. I get the following error when running the basic_usage
example in this repository via cargo run --example basic_usage
in WSL2:
Error: LibloadingError(DlOpen { desc: "libnvidia-ml.so: cannot open shared object file: No such file or directory" })
and, if we strace nvidia-smi
, we see:
openat(AT_FDCWD, "/usr/lib/wsl/drivers/nv_dispi.inf_amd64_31dab972145ae5a9/libnvidia-ml.so.1", O_RDONLY|O_CLOEXEC) = 4
By default nvml-wrapper
looks for libnvidia-ml.so
on Linux systems; but in WSL the library is named libnvidia-ml.so.1
. The name mismatch is causing nvml-wrapper
to be unable to find the library, and we can fix that by initializing NVML
like so:
let nvml = Nvml::builder()
.lib_path("libnvidia-ml.so.1".as_ref())
.init()?;
Then I got a bit farther, but I hit another error:
Error: NotSupported
I was able to work around that by removing:
let cuda_cores = device.num_cores()?;
from the basic_usage
example, and then I was able to get the following output in WSL:
Your NVIDIA GeForce RTX 3080 (architecture: Ampere, CUDA cores: ) is currently sitting at 59 °C with a graphics clock of 1800 MHz and a memory clock of 9501 MHz. Memory usage is 1.82 GB out of an available 10.74 GB. Right now the device is connected via a PCIe gen 4 x16 interface with a transfer rate of 16 GT/s per lane; the max your hardware supports is PCIe gen 4 x16 at a transfer rate of 16 GT/s per lane.
This device is not on a multi-GPU board.
System CUDA version: 12.3
Let me know if that helps!
Hi! In the official Go bindings for NVML, they use libnvidia-ml.so.1
: https://github.com/NVIDIA/go-nvml/blob/0e815c71ca6e8184387d8b502b2ef2d2722165b9/pkg/nvml/lib.go#L30. I think it's the same in pynvml
bindings.
Maybe change the default in Nvml::init()
as well?
Put up a PR: https://github.com/Cldfire/nvml-wrapper/pull/63
I am just getting started in rust development so I may just need some guidance. I have developed a simple program which just dumps the details of the driver that it loads, on my ubuntu 22.04 lts notebook i run my app and the output is (and as expected)
and nvidia-smi reports
no when i go and comile and run my app on my windows 11 wsl2 ubuntu 22.04 lts instance I get
however when i run nvidia-smi i am presented with a driver. I was guessing since smi worked that the driver was accessible.
My question is there any additional path or environment variables that I need to setup in order to get this to work or is it simply an issue with wsl2?
just for fun i'm including the code becuase its very basic