Skip to content

Commit

Permalink
skip old architecture version GPU settings time slice
Browse files Browse the repository at this point in the history
Signed-off-by: wawa0210 <[email protected]>
  • Loading branch information
wawa0210 committed Jan 25, 2024
1 parent 58ae162 commit b23c1b1
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 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 Down Expand Up @@ -498,3 +512,21 @@ func (l deviceLib) setComputeMode(uuids []string, mode string) 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
switch arch {
case "Pascal":
return false
case "Ada":
case "Ampere":
case "Turing":
case "Hopper":
return true
default:
return false
}
return false
}

0 comments on commit b23c1b1

Please sign in to comment.