Skip to content

Commit 104e46e

Browse files
committed
Fix lookup of libcuda.so.RM_VERSION from ldcache
Signed-off-by: Evan Lezar <[email protected]>
1 parent 8a6c194 commit 104e46e

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

internal/lookup/cuda/cuda.go

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
package cuda
1818

1919
import (
20+
"path/filepath"
21+
2022
"github.com/NVIDIA/nvidia-container-toolkit/internal/lookup"
2123
)
2224

@@ -35,5 +37,19 @@ func New(libraries lookup.Locator) lookup.Locator {
3537
// Locate returns the path to the libcuda.so.RMVERSION file.
3638
// libcuda.so is prefixed to the specified pattern.
3739
func (l *cudaLocator) Locate(pattern string) ([]string, error) {
38-
return l.Locator.Locate("libcuda.so" + pattern)
40+
candidates, err := l.Locator.Locate("libcuda.so.1")
41+
if err != nil {
42+
return nil, err
43+
}
44+
45+
var matched []string
46+
for _, candidate := range candidates {
47+
matches, err := filepath.Match("libcuda.so"+pattern, filepath.Base(candidate))
48+
if err != nil || !matches {
49+
continue
50+
}
51+
matched = append(matched, candidate)
52+
}
53+
54+
return matched, nil
3955
}

0 commit comments

Comments
 (0)