NVIDIA / go-nvlib

A collection of useful Go libraries for use with NVIDIA GPU management tools

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

GetTopologyCommonAncestor method error

lengrongfu opened this issue · comments

go-nvlib/pkg/nvml/device.go

Lines 183 to 190 in f3264c8

func (d nvmlDevice) GetTopologyCommonAncestor(o Device) (GpuTopologyLevel, Return) {
other, ok := o.(nvmlDevice)
if !ok {
return 0, ERROR_INVALID_ARGUMENT
}
l, r := nvml.Device(d).GetTopologyCommonAncestor(nvml.Device(other))
return GpuTopologyLevel(l), Return(r)

other, ok := o.(nvmlDevice)
	if !ok {
		return 0, ERROR_INVALID_ARGUMENT
	}

this ok is false, i don't now why, anybody can help me.

image

@lengrongfu it may have to do with where you're calling this function from. The o argument is an gpuallocator.nvlibDevice which is not an nvmlDevice. I think this highlights a bug in the way we use this code from go-gpuallocator and I will have a look at reproducing this locally and addressing it.

@lengrongfu I created #17 and NVIDIA/go-gpuallocator#22 to address this issue. I also added a simple example there where I verified the behaviour that you are seeing and that this is addressed by these changes.

@lengrongfu could you confirm that this issue is resolved with the linked issues merged?

@elezar Thanks for the fix, no problem anymore.