info

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 29, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package info provides relatively static information about the NVIDIA accelerator (e.g., GPU product names).

Index

Constants

View Source
const (
	StateKeyDriver        = "driver"
	StateKeyDriverVersion = "version"

	StateKeyCUDA        = "cuda"
	StateKeyCUDAVersion = "version"

	StateKeyGPU            = "gpu"
	StateKeyGPUDeviceCount = "device_count"
	StateKeyGPUAttached    = "attached"

	StateKeyMemory               = "memory"
	StateKeyMemoryTotalBytes     = "total_bytes"
	StateKeyMemoryTotalHumanized = "total_humanized"

	StateKeyProduct             = "product"
	StateKeyProductName         = "name"
	StateKeyProductBrand        = "brand"
	StateKeyProductArchitecture = "architecture"
)
View Source
const Name = "accelerator-nvidia-info"

Variables

This section is empty.

Functions

func New

Types

type CUDA

type CUDA struct {
	Version string `json:"version"`
}

func ParseStateKeyCUDA

func ParseStateKeyCUDA(m map[string]string) (CUDA, error)

type Config

type Config struct {
	Query query_config.Config `json:"query"`
}

func ParseConfig

func ParseConfig(b any, db *sql.DB) (*Config, error)

func (Config) Validate

func (cfg Config) Validate() error

type Driver

type Driver struct {
	Version string `json:"version"`
}

func ParseStateKeyDriver

func ParseStateKeyDriver(m map[string]string) (Driver, error)

type GPU

type GPU struct {
	// DeviceCount is the number of GPU devices based on the /dev directory.
	DeviceCount int `json:"device_count"`

	// Attached is the number of GPU devices that are attached to the system,
	// based on the nvidia-smi or NVML.
	Attached int `json:"attached"`
}

func ParseStateKeyGPU

func ParseStateKeyGPU(m map[string]string) (GPU, error)

type Memory

type Memory struct {
	TotalBytes     uint64 `json:"total_bytes"`
	TotalHumanized string `json:"total_humanized"`
}

func ParseStateKeyMemory

func ParseStateKeyMemory(m map[string]string) (Memory, error)

type Output

type Output struct {
	Driver  Driver  `json:"driver"`
	CUDA    CUDA    `json:"cuda"`
	GPU     GPU     `json:"gpu"`
	Memory  Memory  `json:"memory"`
	Product Product `json:"products"`
}

func ParseStatesToOutput

func ParseStatesToOutput(states ...components.State) (*Output, error)

func ToOutput

func ToOutput(i *nvidia_query.Output) *Output

ToOutput converts nvidia_query.Output to Output. It returns an empty non-nil object, if the input or the required field is nil (e.g., i.SMI).

func (*Output) States

func (o *Output) States() ([]components.State, error)

type Product

type Product struct {
	Name         string `json:"name"`
	Brand        string `json:"brand"`
	Architecture string `json:"architecture"`
}

func ParseStateKeyProduct

func ParseStateKeyProduct(m map[string]string) (Product, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL