Skip to content

Commit c13215a

Browse files
committed
skip old architecture version GPU settings time slice
1 parent 58ae162 commit c13215a

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

cmd/nvidia-dra-plugin/nvlib.go

+24
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,21 @@ func walkMigDevices(d nvml.Device, f func(i int, d nvml.Device) error) error {
469469
}
470470

471471
func (l deviceLib) setTimeSlice(uuids []string, timeSlice int) error {
472+
allocatableDevices, err := l.enumerateAllPossibleDevices()
473+
if err != nil {
474+
return fmt.Errorf("failed to enumerateAllPossibleDevices: %w", err)
475+
}
472476
for _, uuid := range uuids {
477+
device := allocatableDevices[uuid]
478+
if device == nil {
479+
klog.InfoS("failed to get device", "uuid", uuid)
480+
continue
481+
}
482+
483+
if !detactSupportTimeSliceByArch(device.architecture) {
484+
klog.InfoS("the current card does not support setting time slices and will be ignored.", "arch", device.architecture, "uuid", uuid)
485+
continue
486+
}
473487
cmd := exec.Command(
474488
"nvidia-smi",
475489
"compute-policy",
@@ -484,6 +498,16 @@ func (l deviceLib) setTimeSlice(uuids []string, timeSlice int) error {
484498
return nil
485499
}
486500

501+
// detactSupportTimeSliceByArch Determine whether the architecture series
502+
// supports setting time slices based on the gpu architecture.
503+
func detactSupportTimeSliceByArch(arch string) bool {
504+
// todo: More information is needed to determine the support of various architectures
505+
if arch == "Pascal" {
506+
return false
507+
}
508+
return true
509+
}
510+
487511
func (l deviceLib) setComputeMode(uuids []string, mode string) error {
488512
for _, uuid := range uuids {
489513
cmd := exec.Command(

0 commit comments

Comments
 (0)