https://github.com/mxpv/nvml-go
golang wrapper for NVIDIA Management Library (NVML)
https://github.com/mxpv/nvml-go
cuda golang golang-wrapper gpu nvidia nvidia-smi nvml
Last synced: 4 months ago
JSON representation
golang wrapper for NVIDIA Management Library (NVML)
- Host: GitHub
- URL: https://github.com/mxpv/nvml-go
- Owner: mxpv
- License: mit
- Created: 2018-01-17T22:42:42.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-02-27T00:35:04.000Z (over 7 years ago)
- Last Synced: 2024-06-19T00:31:55.583Z (about 1 year ago)
- Topics: cuda, golang, golang-wrapper, gpu, nvidia, nvidia-smi, nvml
- Language: Go
- Homepage: https://developer.nvidia.com/nvidia-management-library-nvml
- Size: 47.9 KB
- Stars: 20
- Watchers: 3
- Forks: 9
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://godoc.org/github.com/mxpv/nvml-go/)
[](https://goreportcard.com/report/github.com/mxpv/nvml-go)
[](./LICENSE)# nvml-go
golang wrapper for NVIDIA Management Library (NVML)## Basic example ##
```go
func ExampleNew() {
nvml, err := New("")
if err != nil {
panic(err)
}defer nvml.Shutdown()
err = nvml.Init()
if err != nil {
panic(err)
}driverVersion, err := nvml.SystemGetDriverVersion()
if err != nil {
panic(err)
}log.Printf("Driver version:\t%s", driverVersion)
nvmlVersion, err := nvml.SystemGetNVMLVersion()
if err != nil {
panic(err)
}log.Printf("NVML version:\t%s", nvmlVersion)
deviceCount, err := nvml.DeviceGetCount()
if err != nil {
panic(err)
}for i := uint32(0); i < deviceCount; i++ {
handle, err := nvml.DeviceGetHandleByIndex(i)
if err != nil {
panic(err)
}name, err := nvml.DeviceGetName(handle)
log.Printf("Product name:\t%s", name)brand, err := nvml.DeviceGetBrand(handle)
if err != nil {
panic(err)
}log.Printf("Product Brand:\t%s", brand)
uuid, err := nvml.DeviceGetUUID(handle)
if err != nil {
panic(err)
}log.Printf("GPU UUID:\t\t%s", uuid)
fan, err := nvml.DeviceGetFanSpeed(handle)
if err != nil {
panic(err)
}log.Printf("Fan Speed:\t\t%d", fan)
}
}
```## TODO ##
- [Unit Queries](http://docs.nvidia.com/deploy/nvml-api/group__nvmlUnitQueries.html)
- [Unit Commands](http://docs.nvidia.com/deploy/nvml-api/group__nvmlDeviceCommands.html)
- Linux support