gpu

package
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2018 License: Apache-2.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
}

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)

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() []*pb.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() []*pb.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 pb.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