gpu

package
v0.4.16 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2018 License: GPL-3.0 Imports: 16 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)

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 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