1 unstable release
new 0.1.0 | Jan 25, 2025 |
---|
#512 in Cryptography
96 downloads per month
21KB
192 lines
GNI
GPU Node ID (GNI) is a rust based library for creating an identifier for the set of GPUs running on the host. The ID is generated by hashing (blake3) all GPU UUIDs sorted lexicographically. GNI provides a consistent implementation for calculating and retrieving the ID, with bindings to a set of languages (Python, Go, C, CPP) to ensure a consistent and startardized approach to using this ID.
Multi-Language Support
GNI offers the same core functionality for each supported language, provides bindings, and you can build from source for:
Note: If you’d like support for another language, please open an issue or submit a pull request!
Rust Library
GNI is available on crates.io, you should be able to call it from your Rust code:
let result = gni_lib::get_gpu_node_id(None);
println!("GPU Node ID: {:?}", result);
# stdout: GPU Node ID: Ok(<id>)
# Don't forget to add as a dependency on Cargo.toml
...
[dependencies]
gni = "0.1.0"
...
Rust Build and Running GNI from source
Prerequisites
- Rust & Cargo: Make sure you have a recent version of Rust (and the built-in Cargo tool) installed. You can check by running:
$ rustc --version
$ cargo --version
If you need to install Rust, visit rustup.rs.
Build
$ cargo build
See build artifacts in the target/debug directory.
Run
$ cargo run
...
Usage: gni [OPTIONS]
Options:
-c, --cache-filepath <CACHE_FILEPATH> Filepath to cache ID [default: /tmp/gni]
-s, --stdout Print ID to stdout
-h, --help Print help
-V, --version Print version
Contributing
Read our contributing guide to learn about our development process, how to propose bugfixes and feature requests, and how to build your changes.
Code of Conduct
Facebook has adopted a Code of Conduct that we expect project participants to adhere to. Please read the full text so that you can understand what actions will and will not be tolerated.
License
GNI is licensed under the Apache 2.0 license.
Dependencies
~4–10MB
~122K SLoC