image

package
v1.14.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// DefaultDriverCapabilities sets the value for driver capabilities if no value is set.
	DefaultDriverCapabilities = NewDriverCapabilities("utility,compute")
	// SupportedDriverCapabilities defines the set of all supported driver capabilities.
	SupportedDriverCapabilities = NewDriverCapabilities("compute,compat32,graphics,utility,video,display,ngx")
)

Functions

func IsPrivileged added in v1.13.0

func IsPrivileged(s *specs.Spec) bool

IsPrivileged returns true if the container is a privileged container.

Types

type CUDA

type CUDA map[string]string

CUDA represents a CUDA image that can be used for GPU computing. This wraps a map of environment variable to values that can be used to perform lookups such as requirements.

func New added in v1.14.0

func New(opt ...Option) (CUDA, error)

New creates a new CUDA image from the input options.

func NewCUDAImageFromEnv

func NewCUDAImageFromEnv(env []string) (CUDA, error)

NewCUDAImageFromEnv creates a CUDA image from the input environment. The environment is a list of strings of the form ENVAR=VALUE.

func NewCUDAImageFromSpec

func NewCUDAImageFromSpec(spec *specs.Spec) (CUDA, error)

NewCUDAImageFromSpec creates a CUDA image from the input OCI runtime spec. The process environment is read (if present) to construc the CUDA Image.

func (CUDA) DevicesFromEnvvars added in v1.11.0

func (i CUDA) DevicesFromEnvvars(envVars ...string) VisibleDevices

DevicesFromEnvvars returns the devices requested by the image through environment variables

func (CUDA) GetDriverCapabilities added in v1.12.0

func (i CUDA) GetDriverCapabilities() DriverCapabilities

GetDriverCapabilities returns the requested driver capabilities.

func (CUDA) GetRequirements

func (i CUDA) GetRequirements() ([]string, error)

GetRequirements returns the requirements from all NVIDIA_REQUIRE_ environment variables.

func (CUDA) HasDisableRequire

func (i CUDA) HasDisableRequire() bool

HasDisableRequire checks for the value of the NVIDIA_DISABLE_REQUIRE. If set to a valid (true) boolean value this can be used to disable the requirement checks

func (CUDA) IsLegacy

func (i CUDA) IsLegacy() bool

IsLegacy returns whether the associated CUDA image is a "legacy" image. An image is considered legacy if it has a CUDA_VERSION environment variable defined and no NVIDIA_REQUIRE_CUDA environment variable defined.

type DriverCapabilities added in v1.12.0

type DriverCapabilities map[DriverCapability]bool

DriverCapabilities represents the NVIDIA_DRIVER_CAPABILITIES set for the specified image.

func NewDriverCapabilities added in v1.14.0

func NewDriverCapabilities(capabilities ...string) DriverCapabilities

NewDriverCapabilities creates a set of driver capabilities from the specified capabilities

func (DriverCapabilities) Any added in v1.12.0

func (c DriverCapabilities) Any(capabilities ...DriverCapability) bool

Any checks whether any of the specified capabilites are set

func (DriverCapabilities) Has added in v1.12.0

func (c DriverCapabilities) Has(capability DriverCapability) bool

Has check whether the specified capability is selected.

func (DriverCapabilities) Intersection added in v1.14.0

Intersection returns a new set which includes the item in BOTH d and s2. For example: d = {a1, a2} s2 = {a2, a3} s1.Intersection(s2) = {a2}

func (DriverCapabilities) IsAll added in v1.14.0

func (c DriverCapabilities) IsAll() bool

IsAll indicates whether the set of capabilities is `all`

func (DriverCapabilities) IsSuperset added in v1.14.0

func (c DriverCapabilities) IsSuperset(s2 DriverCapabilities) bool

IsSuperset returns true if and only if d is a superset of s2.

func (DriverCapabilities) List added in v1.14.0

func (c DriverCapabilities) List() []string

List returns the list of driver capabilities. The list is sorted.

func (DriverCapabilities) String added in v1.14.0

func (c DriverCapabilities) String() string

String returns the string repesentation of the driver capabilities.

type DriverCapability added in v1.12.0

type DriverCapability string

DriverCapability represents the possible values of NVIDIA_DRIVER_CAPABILITIES

const (
	DriverCapabilityAll      DriverCapability = "all"
	DriverCapabilityNone     DriverCapability = "none"
	DriverCapabilityCompat32 DriverCapability = "compat32"
	DriverCapabilityCompute  DriverCapability = "compute"
	DriverCapabilityDisplay  DriverCapability = "display"
	DriverCapabilityGraphics DriverCapability = "graphics"
	DriverCapabilityNgx      DriverCapability = "ngx"
	DriverCapabilityUtility  DriverCapability = "utility"
	DriverCapabilityVideo    DriverCapability = "video"
)

Constants for the supported driver capabilities

type Option added in v1.14.0

type Option func(*builder)

Option is a functional option for creating a CUDA image.

func WithDisableRequire added in v1.14.0

func WithDisableRequire(disableRequire bool) Option

WithDisableRequire sets the disable require option.

func WithEnv added in v1.14.0

func WithEnv(env []string) Option

WithEnv sets the environment variables to use when creating the CUDA image.

type VisibleDevices added in v1.12.0

type VisibleDevices interface {
	List() []string
	Has(string) bool
}

VisibleDevices represents the devices selected in a container image through the NVIDIA_VISIBLE_DEVICES or other environment variables

func NewVisibleDevices added in v1.12.0

func NewVisibleDevices(envvars ...string) VisibleDevices

NewVisibleDevices creates a VisibleDevices based on the value of the specified envvar.

Jump to

Keyboard shortcuts

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