Skip to content

Commit c3ad5b4

Browse files
committed
keep sharedObjectRegex around
1 parent 669f1e5 commit c3ad5b4

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

xunix/gpu.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,10 @@ import (
1818
)
1919

2020
var (
21-
gpuMountRegex = regexp.MustCompile(`(?i)(nvidia|vulkan|cuda)`)
22-
gpuExtraRegex = regexp.MustCompile(`(?i)(libgl(e|sx|\.)|nvidia|vulkan|cuda)`)
23-
gpuEnvRegex = regexp.MustCompile(`(?i)nvidia`)
21+
gpuMountRegex = regexp.MustCompile(`(?i)(nvidia|vulkan|cuda)`)
22+
gpuExtraRegex = regexp.MustCompile(`(?i)(libgl(e|sx|\.)|nvidia|vulkan|cuda)`)
23+
gpuEnvRegex = regexp.MustCompile(`(?i)nvidia`)
24+
sharedObjectRegex = regexp.MustCompile(`\.so(\.[0-9\.]+)?$`)
2425
)
2526

2627
func GPUEnvs(ctx context.Context) []string {
@@ -125,6 +126,10 @@ func usrLibGPUs(ctx context.Context, log slog.Logger, usrLibDir string) ([]mount
125126
return nil
126127
}
127128

129+
if !sharedObjectRegex.MatchString(path) {
130+
return nil
131+
}
132+
128133
paths, err := recursiveSymlinks(afs, usrLibDir, path)
129134
if err != nil {
130135
log.Error(ctx, "find recursive symlinks", slog.F("path", path), slog.Error(err))

xunix/gpu_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ func TestGPUs(t *testing.T) {
111111
devices, binds, err := xunix.GPUs(ctx, log, usrLibMountpoint)
112112
require.NoError(t, err)
113113
require.Len(t, devices, 2, "unexpected 2 nvidia devices")
114-
require.Len(t, binds, 5, "expected 5 nvidia binds")
114+
require.Len(t, binds, 4, "expected 4 nvidia binds")
115115
require.Contains(t, binds, mount.MountPoint{
116116
Device: "/dev/sda1",
117117
Path: "/usr/local/nvidia",

0 commit comments

Comments
 (0)