NVIDIA / go-nvml

Go Bindings for the NVIDIA Management Library (NVML)
Apache License 2.0
290 stars 62 forks source link

check GetMemoryInfo_v2 support #95

Open zxldev opened 9 months ago

zxldev commented 9 months ago

When get memory information, how can I determine whether to use GetMemoryInfo_v2 or GetMemoryInfo?

Can the lib.Lookup() method be made public? This way, I can use lib.Lookup("nvmlDeviceGetMemoryInfo_v2") to check if v2 is supported.

or, mark it in Init method as public var,

elezar commented 8 months ago

The choice between the two depends on whether you need the additional info that the v2 struct provides. Note that running GetLibrary().Lookup("nvmlDeviceGetMemoryInfo_v2") should do what you wanted.

Note that because the function signatures are not equivalent, we cannot alias GetMemoryInfo to the different versions based on availability.