installer

package
v0.0.0-...-43f56ce Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2025 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Overview

Package installer provides functionality to install GPU drivers.

Index

Constants

View Source
const (
	DefaultVersion               = "default"
	LatestVersion                = "latest"
	MajorGPUDriverArtifactPrefix = "gpu_"
	MajorGPUDriverArtifactSuffix = "_version"
)

Variables

View Source
var (

	// ErrDriverLoad indicates that installed GPU drivers could not be loaded into
	// the kernel.
	ErrDriverLoad = stderrors.New("failed to load GPU drivers")
)

Functions

func ConfigureCachedInstallation

func ConfigureCachedInstallation(gpuInstallDirHost, kernelDriversPath string, needSigned, test, kernelOpen, noVerify bool, moduleParameters modules.ModuleParameters) error

ConfigureCachedInstallation updates ldconfig and installs the cached GPU driver kernel modules.

func ConfigureDriverInstallationDirs

func ConfigureDriverInstallationDirs(gpuInstallDirHost, kernelRelease, arch string) (func(), error)

ConfigureDriverInstallationDirs configures GPU driver installation directories by creating mounts.

func DownloadDriverInstallerV2

func DownloadDriverInstallerV2(ctx context.Context, downloader cos.ExtensionsDownloader, driverVersion string) (string, error)

DownloadDriverInstallerV2 downloads GPU driver installer given driver version from COS build artifacts.

func DownloadGPUDriverVersionArtifacts

func DownloadGPUDriverVersionArtifacts(ctx context.Context, downloader cos.ArtifactsDownloader) (map[string]string, error)

DownloadGPUDriverVersionArtifacts fetch all the gpu_xx_version files and the key is the file name and the value is the content. E.g. gpu_default_version -> 535.129.03, gpu_R470_version -> 470.223.02, gpu_R535_version -> 535.129.03,

func DownloadGPUDriverVersionsProto

func DownloadGPUDriverVersionsProto(ctx context.Context, downloader cos.ArtifactsDownloader, gpuInstallDir string) ([]byte, error)

DownloadGPUDriverVersionsProto will download gpuDriverProtoBin from GCS bucket to /var/lib/nvidia if it does not exist.

func DownloadGenericDriverInstaller

func DownloadGenericDriverInstaller(ctx context.Context, downloader *cos.GCSDownloader, driverVersion string) (string, error)

DownloadGenericDriverInstaller downloads the generic GPU driver installer given driver version.

func DownloadImexDriver

func DownloadImexDriver(ctx context.Context, downloader *cos.GCSDownloader, driverVersion string) (string, error)

DownloadImexDriver downloads the IMEX driver using the GCSDownloader.

func DownloadToInstallDir

func DownloadToInstallDir(url, infoStr string) (string, error)

DownloadToInstallDir downloads data from the provided URL to the GPU installation directory. It returns the basename of the locally written file.

func GetGPUDriverVersion

func GetGPUDriverVersion(ctx context.Context, downloader cos.ArtifactsDownloader, alias string) (string, error)

GeGGPUDriverVersion gets the supplied GPU driver version. Supports "default", "latest", "R470", "R525" aliases

func GetLoadedNVIDIAKernelModuleVersion

func GetLoadedNVIDIAKernelModuleVersion(versionFilePath string) string

func InstallGDRCopy

func InstallGDRCopy(noVerify bool, moduleParams modules.ModuleParameters) error

InstallGDRCopy loads the GDRCopy kernel module and creates its device node. This should be run after the main NVIDIA kernel modules are loaded. It follows https://github.com/NVIDIA/gdrcopy/blob/master/insmod.sh.

func InstallImexDriver

func InstallImexDriver(imexArtifactPath string, driverVersion string, installDirHost string, installDirContainer string) error

InstallImexDriver installs IMEX driver binaries from a given tarball into the specified installDirContainer. It performs the following steps: 1. Extracts the IMEX driver tarball (imexArtifactPath) to a temporary working directory. 2. Installs the IMEX binaries ("nvidia-imex", "nvidia-imex-ctl") into <installDirContainer>/bin with default permissions(0755). 3. Copies the original config.cfg from the <temp-working-dir>/etc/nvidia-imex/config.cfg and installs it into <installDirContainer>/imex-config/config.cfg 4. Patches the copied config.cfg so that the default IMEX_NODE_CONFIG_FILE points to the default nodes_config.cfg to the `<installDirHost>/imex-config/config.cfg` with 0644 permission. 5. Create an empty nodes_config.cfg file at <installDirContainer>/imex-config/nodes_config.cfg This function is testable and allows overriding the install directory path.

func InstallImexDriverDefault

func InstallImexDriverDefault(imexArtifactPath string, driverVersion string, installDirHost string) error

InstallImexDriverDefault installs IMEX driver binaries to the default container location (const: gpuInstallDirContainer) This is a wrapper around InstallImexDriver for production usage, using the default constant gpuInstallDirContainer as the target install path.

func PrebuiltModulesAvailable

func PrebuiltModulesAvailable(ctx context.Context, downloader *cos.GCSDownloader, driverVersion string, kernelOpen bool) (bool, error)

func RunDriverInstaller

func RunDriverInstaller(toolchainDir, installerFilename, driverVersion, arch, kernelDriversPath string, needSigned, test, legacyLink, noVerify bool, moduleParameters modules.ModuleParameters) error

RunDriverInstaller runs GPU driver installer. Only works if the provided installer includes precompiled drivers.

func RunDriverInstallerPrebuiltModules

func RunDriverInstallerPrebuiltModules(ctx context.Context, downloader *cos.GCSDownloader, installerFilename, driverVersion, arch, kernelDriversPath string, noVerify bool, moduleParameters modules.ModuleParameters) error

func VerifyDriverInstallation

func VerifyDriverInstallation(noVerify, debug, skipNvidiaSmi bool) error

VerifyDriverInstallation runs some commands to verify the driver installation.

Types

type Cacher

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

Cacher is to cache GPU driver installation info.

func NewCacher

func NewCacher(gpuInstallDir, buildNumber, driverVersion string) *Cacher

NewCacher returns an instance of Cacher.

func (*Cacher) Cache

func (c *Cacher) Cache(kernelOpen bool) error

Cache writes to fs about the information that a given GPU driver has been installed.

func (*Cacher) IsCached

func (c *Cacher) IsCached() (bool, bool, error)

IsCached returns a bool pair indicating whether a given GPU driver has been installed and if the installation contains open source kernel modules

Jump to

Keyboard shortcuts

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