LLNL / variorum

Vendor-neutral library for exposing power and performance features across diverse architectures
https://variorum.readthedocs.io
MIT License
67 stars 26 forks source link

Fix finding and linking NVML #550

Open masterleinad opened 3 months ago

masterleinad commented 3 months ago

Description

Without this fix NVML can't be found via standard CMake variables. With this, I can do

cmake -DVARIORUM_WITH_NVIDIA_GPU=ON -DNVML_ROOT=/usr/local/cuda-11.7/targets/x86_64-linux/ ../src

do find NVML. Requiring finding the include file and library also makes the error message at the end obsolete. Of course, it's up for discussion what the best error message is and I'm happy to change accordingly.

Finding CUDAToolkit allows me to configure without specifying any extra CMake arguments since the path is deduced from the nvcc location.

Also Variorum was linking against NVML_HEADER instead of NVML_LIBRARY resulting in link failures even when the library was found.

Type of change

How Has This Been Tested?

Configuring and building in a docker container based on top of nvidia/cuda:11.7.1-devel-ubuntu22.04 via

cmake _DVARIORUM_WITH_NVIDIA_GPU=ON -DNVML_ROOT=/usr/local/cuda-11.7/targets/x86_64-linux/ ../src

Test before merge:

Checklist: