Error on nv-p2p.h - NVIDIA Driver package 390.48

Hi everyone,

I am following this official guide https://docs.nvidia.com/cuda/pdf/GPUDirect_RDMA.pdf, released in March 2018, to pin the GPU memory (chapter 3.2.1 and 3.2.2) and retrieve the physical address of the shared memory.
I am using an NVIDIA QUADRO K4000 with CUDA 9.1, NVIDIA Driver package 390.48 (latest available on your website) and Ubuntu 16.04.

Everything works as expected until I include nv-p2p.h from the driver folder, which seems necessary to call nvidia_p2p_get_pages. Just including this header I get an “expected an identifier” error on “line 222, external location: /usr/src/nvidia-390-390.48/nvidia/nv-p2p.h”. I am attaching the file.

Any suggestion (a part for testing another version of the driver)?
Thanks
nv-p2p.h (11.1 KB)

This error is most likely caused because you try to compile the source as C++ code. Try to compile as plain C code and it should work. “private” is a keyword in C++, but it is a legal identifier in C.