mirror of
https://github.com/NVIDIA/nvidia-container-toolkit
synced 2024-11-24 21:14:00 +00:00
Set nvidia-ctk.path config option based on installed path
Signed-off-by: Evan Lezar <elezar@nvidia.com>
This commit is contained in:
parent
86dd046c7c
commit
1fbdc17c40
@ -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*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*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-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() {
|
testing::toolkit::delete() {
|
||||||
|
@ -255,16 +255,16 @@ func Install(cli *cli.Context, opts *options) error {
|
|||||||
return fmt.Errorf("error installing NVIDIA container runtime hook: %v", err)
|
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)
|
|
||||||
}
|
|
||||||
|
|
||||||
nvidiaCTKPath, err := installContainerToolkitCLI(opts.toolkitRoot)
|
nvidiaCTKPath, err := installContainerToolkitCLI(opts.toolkitRoot)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("error installing NVIDIA Container Toolkit CLI: %v", err)
|
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 generateCDISpec(opts, nvidiaCTKPath)
|
return generateCDISpec(opts, nvidiaCTKPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -318,7 +318,7 @@ func installLibrary(libName string, toolkitRoot string) error {
|
|||||||
|
|
||||||
// installToolkitConfig installs the config file for the NVIDIA container toolkit ensuring
|
// 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.
|
// 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)
|
log.Infof("Installing NVIDIA container toolkit config '%v'", toolkitConfigPath)
|
||||||
|
|
||||||
config, err := toml.LoadFile(nvidiaContainerToolkitConfigSource)
|
config, err := toml.LoadFile(nvidiaContainerToolkitConfigSource)
|
||||||
@ -366,6 +366,9 @@ func installToolkitConfig(toolkitConfigPath string, nvidiaContainerCliExecutable
|
|||||||
config.Set(key, value)
|
config.Set(key, value)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set nvidia-ctk options
|
||||||
|
config.Set("nvidia-ctk.path", nvidiaCTKPath)
|
||||||
|
|
||||||
_, err = config.WriteTo(targetConfig)
|
_, err = config.WriteTo(targetConfig)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("error writing config: %v", err)
|
return fmt.Errorf("error writing config: %v", err)
|
||||||
|
Loading…
Reference in New Issue
Block a user