Syllo / nvtop

GPU & Accelerator process monitoring for AMD, Apple, Huawei, Intel, NVIDIA and Qualcomm
Other
8.16k stars 292 forks source link

Can load nvml with dlopen ? #66

Closed qianzhang613 closed 4 years ago

qianzhang613 commented 4 years ago

we build docker images with only cpu compile machine, there is neither gpu or nvidia-docker. so nvml so can dynamic loaded ?

Syllo commented 4 years ago

Hi, You need at least the library installed to compile nvtop for the preprocessor and linker phases.

qianzhang613 commented 4 years ago

is it possible follow nccl implement ? the code is here: https://github.com/NVIDIA/nccl/blob/master/src/misc/nvmlwrap.cc#L48

As at production environment, there is builds-tools, it will be convenient if the build without nvidia driver dependency。

Syllo commented 4 years ago

With docker you can use multi-stage builds to get rid of the unwanted stuff after compiling nvtop. Then, if the library is available at runtime, the dynamic linker should be able to do its job.

I don't find that relying on dlopen to load a library is something a binary should do unless it does stuff like creating function wrappers that end up calling the real function, jit-like compilation, etc.

qianzhang613 commented 4 years ago

thanks @Syllo , i copy a libnvidia-ml.so.1 from gpu server and put it into /usr/lib64/, now nvtop can build well.