device

package
v0.0.0-...-d954f99 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// AttributeMediaExtensions holds the string representation for the media extension MIG profile attribute.
	AttributeMediaExtensions = "me"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Device

type Device interface {
	nvml.Device
	GetArchitectureAsString() (string, error)
	GetBrandAsString() (string, error)
	GetCudaComputeCapabilityAsString() (string, error)
	GetMigDevices() ([]MigDevice, error)
	GetMigProfiles() ([]MigProfile, error)
	IsMigCapable() (bool, error)
	IsMigEnabled() (bool, error)
	VisitMigDevices(func(j int, m MigDevice) error) error
	VisitMigProfiles(func(p MigProfile) error) error
}

Device defines the set of extended functions associated with a device.Device

type Interface

type Interface interface {
	AssertValidMigProfileFormat(profile string) error
	GetDevices() ([]Device, error)
	GetMigDevices() ([]MigDevice, error)
	GetMigProfiles() ([]MigProfile, error)
	NewDevice(d nvml.Device) (Device, error)
	NewDeviceByUUID(uuid string) (Device, error)
	NewMigDevice(d nvml.Device) (MigDevice, error)
	NewMigDeviceByUUID(uuid string) (MigDevice, error)
	NewMigProfile(giProfileID, ciProfileID, ciEngProfileID int, migMemorySizeMB, deviceMemorySizeBytes uint64) (MigProfile, error)
	ParseMigProfile(profile string) (MigProfile, error)
	VisitDevices(func(i int, d Device) error) error
	VisitMigDevices(func(i int, d Device, j int, m MigDevice) error) error
	VisitMigProfiles(func(p MigProfile) error) error
}

Interface provides the API to the 'device' package

func New

func New(opts ...Option) Interface

New creates a new instance of the 'device' interface

type MigDevice

type MigDevice interface {
	nvml.Device
	GetProfile() (MigProfile, error)
}

MigDevice defines the set of extended functions associated with a MIG device

type MigProfile

type MigProfile interface {
	String() string
	GetInfo() MigProfileInfo
	Equals(other MigProfile) bool
	Matches(profile string) bool
}

MigProfile represents a specific MIG profile. Examples include "1g.5gb", "2g.10gb", "1c.2g.10gb", or "1c.1g.5gb+me", etc.

type MigProfileInfo

type MigProfileInfo struct {
	C              int
	G              int
	GB             int
	Attributes     []string
	GIProfileID    int
	CIProfileID    int
	CIEngProfileID int
}

MigProfileInfo holds all info associated with a specific MIG profile

func (MigProfileInfo) Equals

func (p MigProfileInfo) Equals(other MigProfile) bool

Equals checks if two Profiles are identical or not

func (MigProfileInfo) GetInfo

func (p MigProfileInfo) GetInfo() MigProfileInfo

GetInfo returns detailed info about a Profile

func (MigProfileInfo) Matches

func (p MigProfileInfo) Matches(profile string) bool

Matches checks if a MigProfile matches the string passed in

func (MigProfileInfo) String

func (p MigProfileInfo) String() string

String returns the string representation of a Profile

type Option

type Option func(*devicelib)

Option defines a function for passing options to the New() call

func WithNvml

func WithNvml(nvml nvml.Interface) Option

WithNvml provides an Option to set the NVML library used by the 'device' interface

func WithSkippedDevices

func WithSkippedDevices(names ...string) Option

WithSkippedDevices provides an Option to set devices to be skipped by model name

func WithVerifySymbols

func WithVerifySymbols(verify bool) Option

WithVerifySymbols provides an option to toggle whether to verify select symbols exist in dynamic libraries before calling them

Jump to

Keyboard shortcuts

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