Syllo / nvtop

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

Missing <linux/kcmp.h> breaks build on CentOS 7 #152

Closed lgorenstein closed 1 year ago

lgorenstein commented 2 years ago

Hello, and thank you for the great tool!

Reporting a problem with building NVTOP on an HPC cluster here. CentOS 7.9, kernel 3.10.0-1160.62.1.el7.x86_64, CUDA 11.7. Cmake part goes fine, but the build dies near the end:

[ 92%] Building C object src/CMakeFiles/nvtop.dir/extract_gpuinfo_amdgpu.c.o
/home/lev/software/nvtop/2.0.2/nvtop/src/extract_gpuinfo_amdgpu.c:36:24: fatal error: linux/kcmp.h: No such file or directory
 #include <linux/kcmp.h>
                        ^
compilation terminated.
make[2]: *** [src/CMakeFiles/nvtop.dir/extract_gpuinfo_amdgpu.c.o] Error 1
make[1]: *** [src/CMakeFiles/nvtop.dir/all] Error 2

Builds fine on Rocky 8.4 and Ubuntu 18.04 with 4. kernels, but not on older systems with kernel 3.. Is there a way to avoid/bypass dependency on this header?

Syllo commented 2 years ago

According to the kcmp manual page (https://linux.die.net/man/2/kcmp), the syscall was introduced in the linux kernel 3.5.

In your case you might need to install the kernel headers for your kernel. The standard yum way: yum install kernel-devel

Syllo commented 2 years ago

If you don't have AMD GPUs you can also pass -DAMDGPU_SUPPORT=OFF to cmake

Syllo commented 1 year ago

Closing since the AMDGPU support can be disabled on old kernels (Linux 3.10 is from 2013). Support for AMDGPU would probably not work as expected on this version anyway.

kcgthb commented 1 year ago

I'm afraid disabling AMDGPU support doesn't solve this issue (anymore?).

In nvtop 3.0.1, kernel 3.10.0-1160.88.1.el7.x86_64:

# cmake -DNVIDIA_SUPPORT=ON -DAMDGPU_SUPPORT=OFF -DINTEL_SUPPORT=OFF  ..
[...]
# make
[...]
[ 53%] Building C object src/CMakeFiles/nvtop.dir/extract_gpuinfo.c.o
[ 60%] Building C object src/CMakeFiles/nvtop.dir/extract_processinfo_fdinfo.c.o
/dev/shm/nvtop-3.0.1/src/extract_processinfo_fdinfo.c:28:24: fatal error: linux/kcmp.h: No such file or directory
 #include <linux/kcmp.h>
                        ^
compilation terminated.
Lacedaemon commented 1 year ago

https://github.com/Syllo/nvtop/issues/195#issuecomment-1590262915 worked for me.

lgorenstein commented 1 year ago

As long as defined constants stay constant :)

Thank you for the tip @Lacedaemon, I'll try this trick here.

zhuyifei1999 commented 1 year ago

As long as defined constants stay constant :)

It won't. They are kernel UAPI, so as long as it's Linux it won't change.