Skip to content

Same agent Smaller bill. The tools and infrastructure to get more work from your AI. Fewer tokens. Less compute. Lower cost.

948 B
Raw Blame
//go:build !(linux && (amd64 || arm64) && cgo) && !(windows && (amd64 || arm64))

package nvidia

import (
	"fmt"
	"log/slog"
	"runtime"

	"github.com/openlit/openlit/opentelemetry-gpu-collector/internal/gpu"
)

// Device is a stub for platforms/builds where NVML is unavailable.
type Device struct {
	info gpu.DeviceInfo
}

func (d *Device) Info() gpu.DeviceInfo            { return d.info }
func (d *Device) Collect() (*gpu.Snapshot, error) { return nil, errUnsupported() }
func (d *Device) CollectProcesses() ([]gpu.ProcessUsage, error) {
	return nil, errUnsupported()
}
func (d *Device) Close() {}

func DiscoverDevices(_ *slog.Logger) ([]*Device, error) {
	return nil, errUnsupported()
}

func InitNVML() error { return errUnsupported() }

func ShutdownNVML() {}

func errUnsupported() error {
	return fmt.Errorf("NVIDIA NVML support requires linux/(amd64|arm64)+cgo or windows/(amd64|arm64) (current: %s/%s)", runtime.GOOS, runtime.GOARCH)
}