From 12aca454abbdbdc11ec4f86ca16aebbad06cb50e Mon Sep 17 00:00:00 2001 From: Evan Lezar Date: Wed, 1 Mar 2023 14:51:11 +0200 Subject: [PATCH 1/4] Also install nvidia-ctk in toolkit-container Signed-off-by: Evan Lezar --- tools/container/toolkit/toolkit.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tools/container/toolkit/toolkit.go b/tools/container/toolkit/toolkit.go index 97b7336e..abaeded6 100644 --- a/tools/container/toolkit/toolkit.go +++ b/tools/container/toolkit/toolkit.go @@ -209,6 +209,11 @@ func Install(cli *cli.Context, opts *options) error { return fmt.Errorf("error installing NVIDIA container toolkit config: %v", err) } + _, err = installContainerToolkitCLI(opts.toolkitRoot) + if err != nil { + return fmt.Errorf("error installing NVIDIA Container Toolkit CLI: %v", err) + } + return nil } @@ -322,6 +327,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) { From 2d9e4cb720597e666bc82294515bfe737d4e5dae Mon Sep 17 00:00:00 2001 From: Evan Lezar <7723350-elezar@users.noreply.gitlab.com> Date: Thu, 9 Mar 2023 16:44:13 +0000 Subject: [PATCH 2/4] Merge branch 'set-nvidia-ctk-path' into 'main' Set nvidia-ctk.path config option based on installed path See merge request nvidia/container-toolkit/container-toolkit!334 --- test/container/toolkit_test.sh | 1 + tools/container/toolkit/toolkit.go | 17 ++++++++++------- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/test/container/toolkit_test.sh b/test/container/toolkit_test.sh index 84df4cac..617d4798 100644 --- a/test/container/toolkit_test.sh +++ b/test/container/toolkit_test.sh @@ -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() { diff --git a/tools/container/toolkit/toolkit.go b/tools/container/toolkit/toolkit.go index abaeded6..a4e89b38 100644 --- a/tools/container/toolkit/toolkit.go +++ b/tools/container/toolkit/toolkit.go @@ -204,16 +204,16 @@ func Install(cli *cli.Context, opts *options) error { return fmt.Errorf("error installing NVIDIA container runtime hook: %v", err) } - err = installToolkitConfig(toolkitConfigPath, nvidiaContainerCliExecutable, opts) - if err != nil { - return fmt.Errorf("error installing NVIDIA container toolkit config: %v", err) - } - - _, err = installContainerToolkitCLI(opts.toolkitRoot) + 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) + } + return nil } @@ -267,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) @@ -316,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) From 0741252a7c0b889049e5e8a1808c6c8c88a5d7a8 Mon Sep 17 00:00:00 2001 From: Evan Lezar <7723350-elezar@users.noreply.gitlab.com> Date: Fri, 10 Mar 2023 10:23:30 +0000 Subject: [PATCH 3/4] Merge branch 'bump-cuda-version' into 'main' Bump CUDA base image version to 12.1.0 See merge request nvidia/container-toolkit/container-toolkit!335 --- versions.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions.mk b/versions.mk index aca2ffca..262c713b 100644 --- a/versions.mk +++ b/versions.mk @@ -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 "") From 5c86ca17ef074bc4c3514b2f6da986eab42234ae Mon Sep 17 00:00:00 2001 From: Evan Lezar Date: Fri, 10 Mar 2023 12:47:14 +0200 Subject: [PATCH 4/4] Update CHANGELOG.md Signed-off-by: Evan Lezar --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 15f07001..ae401b2e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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