Skip to content

Commit

Permalink
Merge branch 'backport-install-nvidia-ctk' into 'release-1.12'
Browse files Browse the repository at this point in the history
Backport changes for 1.12.1 release

See merge request nvidia/container-toolkit/container-toolkit!332
  • Loading branch information
Evan Lezar committed Mar 10, 2023
2 parents 57a4072 + 5c86ca1 commit 0bedf07
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
* Discover all `gsb*.bin` GSP firmware files when generating CDI specification.
* Remove `fedora35` packaging targets
* [libnvidia-container] Include all `gsp*.bin` firmware files if present
* [toolkit-container] Install `nvidia-ctk` from toolkit container
* [toolkit-container] Use installed `nvidia-ctk` path in NVIDIA Container Toolkit config
* [toolkit-container] Bump CUDA base images to 12.1.0

## v1.12.0

Expand Down
1 change: 1 addition & 0 deletions test/container/toolkit_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ testing::toolkit::install() {
grep -q -E "^\s*ldconfig = \"@${nvidia_run_dir}/driver/sbin/ldconfig(.real)?\"" "${shared_dir}/usr/local/nvidia/toolkit/.config/nvidia-container-runtime/config.toml"
grep -q -E "^\s*root = \"${nvidia_run_dir}/driver\"" "${shared_dir}/usr/local/nvidia/toolkit/.config/nvidia-container-runtime/config.toml"
grep -q -E "^\s*path = \"/usr/local/nvidia/toolkit/nvidia-container-cli\"" "${shared_dir}/usr/local/nvidia/toolkit/.config/nvidia-container-runtime/config.toml"
grep -q -E "^\s*path = \"/usr/local/nvidia/toolkit/nvidia-ctk\"" "${shared_dir}/usr/local/nvidia/toolkit/.config/nvidia-container-runtime/config.toml"
}

testing::toolkit::delete() {
Expand Down
25 changes: 23 additions & 2 deletions tools/container/toolkit/toolkit.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,12 @@ func Install(cli *cli.Context, opts *options) error {
return fmt.Errorf("error installing NVIDIA container runtime hook: %v", err)
}

err = installToolkitConfig(toolkitConfigPath, nvidiaContainerCliExecutable, opts)
nvidiaCTKPath, err := installContainerToolkitCLI(opts.toolkitRoot)
if err != nil {
return fmt.Errorf("error installing NVIDIA Container Toolkit CLI: %v", err)
}

err = installToolkitConfig(toolkitConfigPath, nvidiaContainerCliExecutable, nvidiaCTKPath, opts)
if err != nil {
return fmt.Errorf("error installing NVIDIA container toolkit config: %v", err)
}
Expand Down Expand Up @@ -262,7 +267,7 @@ func installLibrary(libName string, toolkitRoot string) error {

// installToolkitConfig installs the config file for the NVIDIA container toolkit ensuring
// that the settings are updated to match the desired install and nvidia driver directories.
func installToolkitConfig(toolkitConfigPath string, nvidiaContainerCliExecutablePath string, opts *options) error {
func installToolkitConfig(toolkitConfigPath string, nvidiaContainerCliExecutablePath string, nvidiaCTKPath string, opts *options) error {
log.Infof("Installing NVIDIA container toolkit config '%v'", toolkitConfigPath)

config, err := toml.LoadFile(nvidiaContainerToolkitConfigSource)
Expand Down Expand Up @@ -311,6 +316,9 @@ func installToolkitConfig(toolkitConfigPath string, nvidiaContainerCliExecutable
config.Set(key, value)
}

// Set nvidia-ctk options
config.Set("nvidia-ctk.path", nvidiaCTKPath)

_, err = config.WriteTo(targetConfig)
if err != nil {
return fmt.Errorf("error writing config: %v", err)
Expand All @@ -322,6 +330,19 @@ func installToolkitConfig(toolkitConfigPath string, nvidiaContainerCliExecutable
return nil
}

// installContainerToolkitCLI installs the nvidia-ctk CLI executable and wrapper.
func installContainerToolkitCLI(toolkitDir string) (string, error) {
e := executable{
source: "/usr/bin/nvidia-ctk",
target: executableTarget{
dotfileName: "nvidia-ctk.real",
wrapperName: "nvidia-ctk",
},
}

return e.install(toolkitDir)
}

// installContainerCLI sets up the NVIDIA container CLI executable, copying the executable
// and implementing the required wrapper
func installContainerCLI(toolkitRoot string) (string, error) {
Expand Down
2 changes: 1 addition & 1 deletion versions.mk
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ NVIDIA_CONTAINER_RUNTIME_VERSION := 3.12.0
# Specify the expected libnvidia-container0 version for arm64-based ubuntu builds.
LIBNVIDIA_CONTAINER0_VERSION := 0.10.0+jetpack

CUDA_VERSION := 12.0.1
CUDA_VERSION := 12.1.0
GOLANG_VERSION := 1.18.8

GIT_COMMIT ?= $(shell git describe --match="" --dirty --long --always --abbrev=40 2> /dev/null || echo "")
Expand Down

0 comments on commit 0bedf07

Please sign in to comment.