NVIDIA / go-nvml

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

Compilation problem #102

Open morsmordreb opened 6 months ago

morsmordreb commented 6 months ago

How can I know the relationship between the current tag of our project and the cuda version? There are many errors when compiling. For example, I am currently using CUDA-12.0, corresponding to the project 12.0-0, there will be such errors:

expected ‘nvmlDevice_t’ {aka ‘struct ’} but argument is of type ‘struct nvmlDevice_st ’ nvmlReturn_t DECLDIR nvmlVgpuTypeGetMaxInstances(nvmlDevice_t device, nvmlVgpuTypeId_t vgpuTypeId, unsigned int vgpuInstanceCount);

Here's what makfie wrote CGO_CFLAGS = -i/usr/local/cuda - 12.0 / include CGO_LDFLAGS="-L /usr/local/cuda-12.0/lib64-lnvidia-ml"

elezar commented 5 months ago

@morsmordreb you should be able to use newer bindings against older CUDA versions since we detect the versioned APIs automatically. (There may be some edge cases that are not covered, but we can address those if reported).

It is even possible to use older bindings against newer CUDA versions -- with the caveat that any functions added since then will not be available.

With this in mind, I don't think it's required to provide your own nvml.h to build applications that use this package.