3

I am trying to execute some CUDA code which happens to have some NVML library functions like nvmlSystemGetDriverVersion. But, when I try to compile the code it says nvml.h not found. How should I install NVML on my system since nvml.h does not seem to be present on it?

Ashwin Nanjappa
  • 76,204
  • 83
  • 211
  • 292
Vaibhav Sundriyal
  • 567
  • 5
  • 11
  • 18

1 Answers1

4

A google search of "nvidia nvml" returns this as the first link. This page contains links for the API documentation.

On that page, if you click on the Tesla Deployment Kit link, you can then find the download links appropriate for your OS (windows or linux) and CUDA version (cuda 5.0 or cuda 4.2)

The Tesla Deployment kit contains the header file you mention (nvml.h) as well as some libraries you will probably need to link against, in order to use the NVML functions.

There are sample build projects including makefiles in the Tesla Deployment Kit which should answer any questions about how to compile and link using assets from the kit.

EDIT: there is an example project in .../tdk_3.xxxx/nvml/example There is a sample makefile in that example project directory. If you inspect that makefile, you'll see that to link in the nvml library your compile command will need to include something like:

-L/path/to/nvml/lib64/ -lnvidia-ml
Robert Crovella
  • 143,785
  • 11
  • 213
  • 257
  • I copied the files from tdk_3.304.5/nvml/include/nvml.h to the proper include path and also the lib files from tdk_3.304.5/nvml/lib and lib64 to the /usr/local/lib and /usr/local/lib64. But while compiling the code, I get an error like /tmp/tmpxft_000030aa_00000000-14_gpupow.o: In function `main': tmpxft_000030aa_00000000-3_gpupow.cudafe1.cpp:(.text+0xc): undefined reference to `nvmlInit' and so on. Can you tell what is the issue? – Vaibhav Sundriyal May 02 '13 at 17:15
  • Yes, you're not linking in the nvml library in your compile command. Look at the makefiles in the sample projects in the TDK to see how the libraries are called out and linked in. – Robert Crovella May 02 '13 at 17:20