Missing cudart_platform.h in files installed on host

I have a cross-compilation environment setup on my x64 Linux PC that compiles to aarch64 (Xavier).

My project is a CMAKE project that uses the built-in CUDA language support.
My toolchain file provides, among other things, CMAKE_CUDA_COMPILER=/usr/local/cuda/bin/nvcc and the architecture aarch64. using `project(myproj LANGUAGES C CXX CUDA) results in CMake implicitly including the correct libraries and include files.

This results in CMake adding -I/usr/local/cuda/targets/aarch64-linux/include to the aarc64-linux-gnu-gcc compiler command line, which would normally be the right thing to do - my understanding is that all of the CUDA include files should be there, after installing the JetPack.

I recently wanted to add cuda_egl_interop.h to my project, and it complains that cudart_platform.h, included by cuda_egl_interop.h is missing. Sure enough, when I compare the headers under /usr/local/cuda/targets/aarch64-linux/include to a rootfs I lifted from the actual Xavier, some differences emerge using diff:

Only in rootfs/usr/local/cuda-10.0/targets/aarch64-linux/include/: cudart_platform.h
Only in rootfs/usr/local/cuda-10.0/targets/aarch64-linux/include/: nvgraph.h
Only in rootfs/usr/local/cuda-10.0/targets/aarch64-linux/include/: nvml.h
Only in rootfs/usr/local/cuda-10.0/targets/aarch64-linux/include/: nvrtc.h
Only in rootfs/usr/local/cuda-10.0/targets/aarch64-linux/include/: nvToolsExtCuda.h
Only in rootfs/usr/local/cuda-10.0/targets/aarch64-linux/include/: nvToolsExtCudaRt.h
Only in rootfs/usr/local/cuda-10.0/targets/aarch64-linux/include/: nvToolsExt.h
Only in rootfs/usr/local/cuda-10.0/targets/aarch64-linux/include/: nvToolsExtMeta.h
Only in rootfs/usr/local/cuda-10.0/targets/aarch64-linux/include/: nvToolsExtSync.h
Only in rootfs/usr/local/cuda-10.0/targets/aarch64-linux/include/: nvtx3

Is this an error in the sdkmanager, whereby these include files for aarch64 cross-compilation aren’t getting installed but should have been? If so what would be the safest way of going about fixing it?

Alternatively, is there a way for me to tell CMake to get the lib and include files from an alternate location (i.e. the rootfs copy I lifted), USING THE BUILT-IN LANGUAGE FUNCTION (as opposed to FindCUDA.cmake). Admittedly, this may be more of a question for the CMake team, I may take it up with them as documentation is rather spotty.

Hi,
Are you able to share a simple sample code so that we can reproduce the error? SDKManager can install CUDA on both host x86 liunx and target Jetson platforms, and we have verified some cases. Probably this is not a case we have verified. We need to reproduce it and do further check.

I am currently using Jetpack 4.2.0, but I previously installed 4.2.2 and 4.2.3 - not sure how this might affect things. Unfortunately, I am stuck on 4.2.0 until Leopard Imaging can provide camera drivers and a kernel image for a more recent release.

The minimal code would be:

#include <cuda_egl_interop.h>

That’s it. The rest depends on your build environment. When I cross-compile, CMake finds the CUDA headers for the aarch64 at /usr/local/cuda-10.0/targets/aarch64-linux/include. Problem is, the cudart_platform.h header is missing from the aarch64 folders.

The file is there for the x86_64 install:

$ ll /usr/local/cuda-10.0/targets/x86_64-linux/include/*platform*
-rw-r--r-- 1 root root 2717 Mar 12  2019 /usr/local/cuda-10.0/targets/x86_64-linux/include/cudart_platform.h

…but not there for the aarch64 install:

$ ll /usr/local/cuda-10.0/targets/aarch64-linux/include/*platform*
ls: cannot access '/usr/local/cuda-10.0/targets/aarch64-linux/include/*platform*': No such file or directory

… on the Jetson Xavier, it is there:

$ ll /usr/local/cuda-10.0/targets/aarch64-linux/include/*platform*
-rw-r--r-- 1 root root 2717 Oct 15  2018 /usr/local/cuda-10.0/targets/aarch64-linux/include/cudart_platform.h

(BTW, the same applies to my 10.1 install, which I don’t think I uses sdkmanager to install – maybe it’s just missing from the general CUDA installer?)

Should I just go ahead and copy it over from the Jetson?

Hi,

It looks fine. Please copy it from target Xavier to host PC and try again.

Hi BareMetalCoder,

We haven’t heard back from you in a couple weeks, so marking this topic closed.
Please open a new forum issue when you are ready and we’ll pick it up there.

Yeah, unfortunately, I can’t say much about it. I just copied the file over. Not much else can be done on my side.
I suppose it’s ok to close it. If anyone else runs into the issue, they can refer back here.