Skip to content

Commit 5f25d95

Browse files
committed
Use enable-cuda-compat hook when ldcache does not exist
This change ensures that the cuda compat drop-in file is created in a container even if the ld.cache does not exist. This allows for the creation of the ldcache in the subsequent invocation of the update-ldcache hook in container images where the cache does not pre-exist. Examples of such images are distroless images. Signed-off-by: Evan Lezar <[email protected]>
1 parent bad48b6 commit 5f25d95

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

cmd/nvidia-cdi-hook/cudacompat/cudacompat.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,6 @@ func (m command) getContainerForwardCompatDir(containerRoot containerRoot, hostD
128128
m.logger.Debugf("No CUDA forward compatibility libraries directory in container")
129129
return "", nil
130130
}
131-
if !containerRoot.hasPath("/etc/ld.so.cache") {
132-
m.logger.Debugf("The container does not have an LDCache")
133-
return "", nil
134-
}
135131

136132
libs, err := containerRoot.globFiles(filepath.Join(cudaCompatPath, "libcuda.so.*.*"))
137133
if err != nil {

cmd/nvidia-cdi-hook/cudacompat/cudacompat_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ func TestCompatLibs(t *testing.T) {
4444
contents: map[string]string{
4545
"/usr/local/cuda/compat/libcuda.so.333.88.99": "",
4646
},
47-
hostDriverVersion: "222.55.66",
47+
hostDriverVersion: "222.55.66",
48+
expectedContainerForwardCompatDir: "/usr/local/cuda/compat",
4849
},
4950
{
5051
description: "compat lib is newer; ldcache",

0 commit comments

Comments
 (0)