Skip to content

Commit

Permalink
skip old architecture version GPU settings time slice
Browse files Browse the repository at this point in the history
  • Loading branch information
wawa0210 committed Jan 24, 2024
1 parent 58ae162 commit c13215a
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions cmd/nvidia-dra-plugin/nvlib.go
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,21 @@ func walkMigDevices(d nvml.Device, f func(i int, d nvml.Device) error) error {
}

func (l deviceLib) setTimeSlice(uuids []string, timeSlice int) error {
allocatableDevices, err := l.enumerateAllPossibleDevices()
if err != nil {
return fmt.Errorf("failed to enumerateAllPossibleDevices: %w", err)
}
for _, uuid := range uuids {
device := allocatableDevices[uuid]
if device == nil {
klog.InfoS("failed to get device", "uuid", uuid)
continue
}

if !detactSupportTimeSliceByArch(device.architecture) {
klog.InfoS("the current card does not support setting time slices and will be ignored.", "arch", device.architecture, "uuid", uuid)
continue
}
cmd := exec.Command(
"nvidia-smi",
"compute-policy",
Expand All @@ -484,6 +498,16 @@ func (l deviceLib) setTimeSlice(uuids []string, timeSlice int) error {
return nil
}

// detactSupportTimeSliceByArch Determine whether the architecture series
// supports setting time slices based on the gpu architecture.
func detactSupportTimeSliceByArch(arch string) bool {
// todo: More information is needed to determine the support of various architectures
if arch == "Pascal" {
return false
}
return true
}

func (l deviceLib) setComputeMode(uuids []string, mode string) error {
for _, uuid := range uuids {
cmd := exec.Command(
Expand Down

0 comments on commit c13215a

Please sign in to comment.