Nvcc: what is necessary to cross-compile?

I’m looking to cross-compile a cuda-using project from (host) x86 to (target) aarch64. In my host I have:

  1. host cudatoolkit toolchain (nvcc);
  2. aarch64-unknown-linux-gnu (gcc cross-compiler from x86 to aarch64) and the native libraries for aarch64;
  3. target (aarch64) cudatoolkit libraries.

How can I get host nvcc to cross-compile? In particular, the nvcc tool does not appear to have any options pertaining to cross-compilation (such as --target) nor an obvious way to specify a cross-compiler gcc to use. Is there something obvious I am missing?

3 Likes

This is a great question - why are there no responses?

For Arm64 SBSA platforms, you should use CUDA Toolkit 11.3 Downloads | NVIDIA Developer.

This specifically includes a ready to use cross-compilation environment. (pick Linux → arm64-sbsa → Cross).

Note however that this environment is not usable for targeting Jetson hardware. The drivers for Tegra SoCs were not upgraded yet to provide CUDA versions beyond 10.2, so that it isn’t currently an option.