@@ -299,9 +299,8 @@ func (d *NvidiaDevice) fingerprint(ctx context.Context, devices chan *device.Fin
299299 devices <- device .NewFingerprintError (err )
300300 return
301301 }
302- deviceGroups := make ([]* device.DeviceGroup , 0 )
303302 diffDevices := d .diffFiles (files )
304- deviceGroups = d .getDeviceGroup (diffDevices )
303+ deviceGroups : = d .getDeviceGroup (diffDevices )
305304 devices <- device .NewFingerprint (deviceGroups ... )
306305
307306 }
@@ -376,8 +375,16 @@ func (d *NvidiaDevice) getDeviceGroup(devices []*device.Device) []*device.Device
376375 groupByTuple := make (map [string ][]* device.Device , len (dSlice )/ 2 )
377376 inactive := make (map [string ][]* device.Device , 2 )
378377
379- for _ , v := range devices {
380- index := rand .Intn (len (dSlice ))
378+ for n , v := range devices {
379+ // this bit sets the device model based on the strings in dSlice
380+ dSliceRange := len (dSlice ) - 1
381+ var index int
382+ if n <= dSliceRange {
383+ index = n
384+ } else {
385+ index = rand .Intn (dSliceRange )
386+ }
387+
381388 tuple := strings .Join ([]string {vendor , deviceType , dSlice [index ]}, "/" )
382389 if ! v .Healthy {
383390 if _ , ok := inactive [tuple ]; ! ok {
@@ -402,7 +409,7 @@ func (d *NvidiaDevice) getDeviceGroup(devices []*device.Device) []*device.Device
402409 d .logger .Error ("unexpected tuple split" , "part0" , parts [0 ], "part1" , parts [1 ], "part2" , parts [2 ])
403410 continue
404411 }
405- mem := int64 (rand .Intn (20 ))
412+ mem := int64 (rand .Intn (50 ))
406413 vendor := "nvidia"
407414 shared := v [0 ].Shared .String ()
408415 devGroups = append (devGroups , & device.DeviceGroup {
0 commit comments