mps

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ContainerRoot = Root("/mps")
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Daemon

type Daemon struct {
	// contains filtered or unexported fields
}

Daemon represents an MPS daemon. It is associated with a specific kubernets resource and is responsible for starting and stopping the deamon as well as ensuring that the memory and thread limits are set for the devices that the resource makes available.

func NewDaemon

func NewDaemon(rm rm.ResourceManager, root Root) *Daemon

NewDaemon creates an MPS daemon instance.

func NewDaemons

func NewDaemons(opts ...Option) ([]*Daemon, error)

Daemons creates the required set of MPS daemons for the specified options.

func (*Daemon) AssertHealthy

func (d *Daemon) AssertHealthy() error

AssertHealthy checks that the MPS control daemon is healthy.

func (*Daemon) Devices

func (d *Daemon) Devices() rm.Devices

Devices returns the list of devices under the control of this MPS daemon.

func (*Daemon) EchoPipeToControl

func (d *Daemon) EchoPipeToControl(command string) (string, error)

EchoPipeToControl sends the specified command to the MPS control daemon.

func (*Daemon) Envvars

func (d *Daemon) Envvars() envvars

Envvars returns the environment variables required for the daemon. These should be passed to clients consuming the device shared using MPS. TODO: Set CUDA_VISIBLE_DEVICES to include only the devices for this resource type.

func (*Daemon) LogDir

func (d *Daemon) LogDir() string

func (*Daemon) PipeDir

func (d *Daemon) PipeDir() string

func (*Daemon) ShmDir

func (d *Daemon) ShmDir() string

func (*Daemon) Start

func (d *Daemon) Start() error

Start starts the MPS deamon as a background process.

func (*Daemon) Stop

func (d *Daemon) Stop() error

Stop ensures that the MPS daemon is quit.

type Manager

type Manager interface {
	Daemons() ([]*Daemon, error)
}

func New

func New(opts ...Option) (Manager, error)

New creates a manager for MPS daemons. If MPS is not configured, a manager is returned that manages no daemons.

type Option

type Option func(*manager)

Option defines a functional option for configuring an MPS manager.

func WithConfig

func WithConfig(config *spec.Config) Option

WithConfig sets the config associated with the MPS manager.

func WithNvmlLib

func WithNvmlLib(nvmllib nvml.Interface) Option

WithNvmlLib sets the NVML library associated with the MPS manager.

type Root

type Root string

Root represents an MPS root. This is where per-resource pipe and log directories are created. For containerised applications the host root is typically mounted to /mps in the container.

func (Root) LogDir

func (r Root) LogDir(resourceName spec.ResourceName) string

LogDir returns the per-resource pipe dir for the specified root.

func (Root) Path

func (r Root) Path(parts ...string) string

Path returns a path relative to the MPS root.

func (Root) PipeDir

func (r Root) PipeDir(resourceName spec.ResourceName) string

PipeDir returns the per-resource pipe dir for the specified root.

func (Root) ShmDir

func (r Root) ShmDir(resourceName spec.ResourceName) string

ShmDir returns the shm dir associated with the root. Note that the shm dir is the same for all resources.

Jump to

Keyboard shortcuts

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