Skip to content

Commit b012429

Browse files
committed
generalize mig id generator to any number of mig devices per card
1 parent 459ebd5 commit b012429

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pkg/plugin/nvidia/utils.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@ func GetDevices() ([]*pluginapi.Device, map[uint]string) {
9292
migs, err := d.GetMigDevices()
9393
check(err)
9494
for j, mig := range migs {
95-
// TODO: explain formula (based on device and mig numbers)
96-
id = i*uint(2) + i + uint(j)
95+
// TODO: explain formula (based on device and mig numbers) i = device index, j = mig index
96+
id = i * uint(len(migs)) + uint(j)
9797
deviceByIndex[id] = mig.UUID
9898
if GetGPUMemory() == uint(0) {
9999
SetGPUMemory(uint(*mig.Memory))

0 commit comments

Comments
 (0)