gpu

package
v0.4.31 Latest Latest
Warning

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

Go to latest
Published: May 15, 2020 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetVendorByName

func GetVendorByName(vendor string) (sonm.GPUVendorType, error)

func NewRemoteTuner added in v0.4.25

func NewRemoteTuner(ctx context.Context, name string) (sonm.RemoteGPUTunerServer, error)

Types

type DRICard

type DRICard struct {
	Num       int
	Name      string
	Path      string
	Devices   []string
	DeviceID  uint64
	VendorID  uint64
	Major     uint64
	Minor     uint64
	PCIBusID  string
	Memory    uint64
	HwmonPath string
}

func CollectDRICardDevices

func CollectDRICardDevices() ([]DRICard, error)

CollectDRICardDevices traverses overs /dev/dri and collect card Devices which can be bound into the container

func NewDRICard

func NewDRICard(num int, name, path string) (DRICard, error)

func (*DRICard) Metrics added in v0.4.15

func (card *DRICard) Metrics() (*DRICardMetrics, error)

type DRICardMetrics added in v0.4.15

type DRICardMetrics struct {
	Temperature float64
	Fan         float64
	Power       float64
}

type GPUID

type GPUID string

type MetricsHandler added in v0.4.17

type MetricsHandler interface {
	GetMetrics() (map[string]float64, error)
	Close() error
}

MetricsHandlers returns hardware-dependent implementation of GPU metrics interface.

func NewMetricsHandler added in v0.4.17

func NewMetricsHandler(gpuType sonm.GPUVendorType) (MetricsHandler, error)

type NilTuner

type NilTuner struct{}

NilTuner is just a null pattern

func (NilTuner) Close

func (NilTuner) Close() error

func (NilTuner) Devices

func (NilTuner) Devices() []*sonm.GPUDevice

func (NilTuner) Tune

func (NilTuner) Tune(hostconfig *container.HostConfig, ids []GPUID) error

type Option

type Option func(*tunerOptions)

func WithOptions

func WithOptions(raw map[string]string) Option

func WithSocketDir

func WithSocketDir(dir string) Option

type Tuner

type Tuner interface {
	// Tune is attaching GPUs with given IDs into a container
	Tune(hostconfig *container.HostConfig, ids []GPUID) error
	// Devices returns device list that this tuner can control
	Devices() []*sonm.GPUDevice
	// Close closes the tuner and removes related files and sockets from the host system
	Close() error
}

Tuner is responsible for preparing GPU-friendly environment and baking proper options in container.HostConfig

func New

func New(ctx context.Context, gpuType sonm.GPUVendorType, opts ...Option) (Tuner, error)

New creates Tuner based on provided config. Currently supported type: "radeon" or "nvidia". if type is undefined, nilTuner will be returned.

Jump to

Keyboard shortcuts

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