mirror of
https://github.com/NVIDIA/nvidia-container-toolkit
synced 2025-03-10 06:10:08 +00:00
This change adds the enable-cuda-compat hook to the incomming OCI runtime spec if the allow-cuda-compat-libs-from-container feature flag is not enabled. An update-ldcache hook is also injected to ensure that the required folders are processed. Signed-off-by: Evan Lezar <elezar@nvidia.com>
25 lines
792 B
Go
25 lines
792 B
Go
package discover
|
|
|
|
import (
|
|
"strings"
|
|
|
|
"github.com/NVIDIA/nvidia-container-toolkit/internal/logger"
|
|
"github.com/NVIDIA/nvidia-container-toolkit/internal/lookup/root"
|
|
)
|
|
|
|
// NewCUDACompatHookDiscoverer creates a discoverer for a enable-cuda-compat hook.
|
|
// This hook is responsible for setting up CUDA compatibility in the container and depends on the host driver version.
|
|
func NewCUDACompatHookDiscoverer(logger logger.Interface, nvidiaCDIHookPath string, driver *root.Driver) Discover {
|
|
_, cudaVersionPattern := getCUDALibRootAndVersionPattern(logger, driver)
|
|
var args []string
|
|
if !strings.Contains(cudaVersionPattern, "*") {
|
|
args = append(args, "--host-driver-version="+cudaVersionPattern)
|
|
}
|
|
|
|
return CreateNvidiaCDIHook(
|
|
nvidiaCDIHookPath,
|
|
"enable-cuda-compat",
|
|
args...,
|
|
)
|
|
}
|