11 releases (7 breaking)

0.8.0 Feb 10, 2024
0.7.0 Jan 21, 2023
0.6.0 May 27, 2022
0.5.0 Dec 7, 2020
0.3.0 Jul 20, 2017

#277 in Hardware support

Download history 6650/week @ 2024-07-04 6564/week @ 2024-07-11 7261/week @ 2024-07-18 7438/week @ 2024-07-25 10086/week @ 2024-08-01 17912/week @ 2024-08-08 14044/week @ 2024-08-15 22525/week @ 2024-08-22 18327/week @ 2024-08-29 30911/week @ 2024-09-05 42334/week @ 2024-09-12 39523/week @ 2024-09-19 27546/week @ 2024-09-26 23779/week @ 2024-10-03 23846/week @ 2024-10-10 21755/week @ 2024-10-17

104,219 downloads per month
Used in 35 crates (4 directly)

MIT/Apache

355KB
9K SLoC

nvml-wrapper-sys

Crates.io version Crates.io downloads Docs.rs docs

Rust bindings for the NVIDIA Management Library (NVML), a C-based programmatic interface for monitoring and managing various states within NVIDIA GPUs.

It is intended to be a platform for building 3rd-party applications, and is also the underlying library for NVIDIA's nvidia-smi tool.

See nvml-wrapper for a safe wrapper over top of these bindings.

Type of Bindings

These bindings were created using bindgen's feature to generate wrappers over top of the functionality that the libloading crate provides. This means that they're designed for loading the NVML library at runtime; they are not suitable for linking to NVML (statically or dynamically) at buildtime.

This choice was made because NVML is the type of library that you'd realistically always want to load at runtime, for the following reasons:

  • NVIDIA doesn't distribute static versions of NVML, so it isn't possible to statically link it anyway
  • Linking to NVML at buildtime means the resulting binary can only be run on systems that have NVIDIA GPUs and well-formed NVIDIA driver installs

Loading NVML at runtime means it's possible to drop NVIDIA-related features at runtime on systems that don't have relevant hardware.

I would be willing to consider maintaining both types of bindings in this crate if there's a convincing reason to do so; please file an issue.

NVML Support

These bindings were generated for NVML version 11. Each new version of NVML is guaranteed to be backwards-compatible according to NVIDIA, so these bindings should be useful regardless of NVML version bumps.

Legacy Functions

Sometimes there will be function-level API version bumps in new NVML releases. For example:

nvmlDeviceGetComputeRunningProcesses
nvmlDeviceGetComputeRunningProcesses_v2
nvmlDeviceGetComputeRunningProcesses_v3

The older versions of the functions will generally continue to work with the newer NVML releases; however, the newer function versions will not work with older NVML installs.

By default these bindings only include the newest versions of the functions. Enable the legacy-functions feature if you require the ability to call older functions.

License

Licensed under either of Apache License, Version 2.0 or MIT license at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~0–4.5MB