nvcdi

package
v1.13.0-rc.2 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2023 License: Apache-2.0 Imports: 18 Imported by: 2

Documentation

Index

Constants

View Source
const (
	// ModeAuto configures the CDI spec generator to automatically detect the system configuration
	ModeAuto = "auto"
	// ModeNvml configures the CDI spec generator to use the NVML library.
	ModeNvml = "nvml"
	// ModeWsl configures the CDI spec generator to generate a WSL spec.
	ModeWsl = "wsl"
	// ModeManagement configures the CDI spec generator to generate a management spec.
	ModeManagement = "management"
	// ModeGds configures the CDI spec generator to generate a GDS spec.
	ModeGds = "gds"
	// ModeMofed configures the CDI spec generator to generate a MOFED spec.
	ModeMofed = "mofed"
)
View Source
const (
	// DeviceNameStrategyIndex generates devices names such as 0 or 1:0
	DeviceNameStrategyIndex = "index"
	// DeviceNameStrategyTypeIndex generates devices names such as gpu0 or mig1:0
	DeviceNameStrategyTypeIndex = "type-index"
	// DeviceNameStrategyUUID uses the device UUID as the name
	DeviceNameStrategyUUID = "uuid"
)

Supported device naming strategies

Variables

This section is empty.

Functions

func GetEditsForComputeInstance

func GetEditsForComputeInstance(logger *logrus.Logger, driverRoot string, gpu int, gi int, ci int) (*cdi.ContainerEdits, error)

GetEditsForComputeInstance returns the CDI edits for a particular compute instance defined by the (gpu, gi, ci) tuple

func NewDriverBinariesDiscoverer

func NewDriverBinariesDiscoverer(logger *logrus.Logger, driverRoot string) discover.Discover

NewDriverBinariesDiscoverer creates a discoverer for GSP firmware associated with the GPU driver.

func NewDriverDiscoverer

func NewDriverDiscoverer(logger *logrus.Logger, driverRoot string, nvidiaCTKPath string, nvmllib nvml.Interface) (discover.Discover, error)

NewDriverDiscoverer creates a discoverer for the libraries and binaries associated with a driver installation. The supplied NVML Library is used to query the expected driver version.

func NewDriverFirmwareDiscoverer

func NewDriverFirmwareDiscoverer(logger *logrus.Logger, driverRoot string, version string) discover.Discover

NewDriverFirmwareDiscoverer creates a discoverer for GSP firmware associated with the specified driver version.

func NewDriverLibraryDiscoverer

func NewDriverLibraryDiscoverer(logger *logrus.Logger, driverRoot string, nvidiaCTKPath string, version string) (discover.Discover, error)

NewDriverLibraryDiscoverer creates a discoverer for the libraries associated with the specified driver version.

Types

type DeviceNamer

type DeviceNamer interface {
	GetDeviceName(int, device.Device) (string, error)
	GetMigDeviceName(int, device.Device, int, device.MigDevice) (string, error)
}

DeviceNamer is an interface for getting device names

func NewDeviceNamer

func NewDeviceNamer(strategy string) (DeviceNamer, error)

NewDeviceNamer creates a Device Namer based on the supplied strategy. This namer can be used to construct the names for MIG and GPU devices when generating the CDI spec.

type Interface

type Interface interface {
	GetSpec() (spec.Interface, error)
	GetCommonEdits() (*cdi.ContainerEdits, error)
	GetAllDeviceSpecs() ([]specs.Device, error)
	GetGPUDeviceEdits(device.Device) (*cdi.ContainerEdits, error)
	GetGPUDeviceSpecs(int, device.Device) (*specs.Device, error)
	GetMIGDeviceEdits(device.Device, device.MigDevice) (*cdi.ContainerEdits, error)
	GetMIGDeviceSpecs(int, device.Device, int, device.MigDevice) (*specs.Device, error)
}

Interface defines the API for the nvcdi package

func New

func New(opts ...Option) Interface

New creates a new nvcdi library

type Option

type Option func(*nvcdilib)

Option is a function that configures the nvcdilib

func WithClass

func WithClass(class string) Option

WithClass sets the class for the library

func WithDeviceLib

func WithDeviceLib(devicelib device.Interface) Option

WithDeviceLib sets the device library for the library

func WithDeviceNamer

func WithDeviceNamer(namer DeviceNamer) Option

WithDeviceNamer sets the device namer for the library

func WithDriverRoot

func WithDriverRoot(root string) Option

WithDriverRoot sets the driver root for the library

func WithLogger

func WithLogger(logger *logrus.Logger) Option

WithLogger sets the logger for the library

func WithMode

func WithMode(mode string) Option

WithMode sets the discovery mode for the library

func WithNVIDIACTKPath

func WithNVIDIACTKPath(path string) Option

WithNVIDIACTKPath sets the path to the NVIDIA Container Toolkit CLI path for the library

func WithNvmlLib

func WithNvmlLib(nvmllib nvml.Interface) Option

WithNvmlLib sets the nvml library for the library

func WithVendor

func WithVendor(vendor string) Option

WithVendor sets the vendor for the library

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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