Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compilation fails when CUDA is not in the usual path #49

Open
cbouilla opened this issue Jul 16, 2024 · 1 comment
Open

Compilation fails when CUDA is not in the usual path #49

cbouilla opened this issue Jul 16, 2024 · 1 comment

Comments

@cbouilla
Copy link

I tried to compile openearth following the steps of the README, but this fails with the following error:

[ 77%] Building CXX object lib/Conversion/LoopsToGPU/CMakeFiles/obj.GPUToKernelAndRuntimeCalls.dir/ConvertKernelFuncToCubin.cpp.o
.../open-earth-compiler/lib/Conversion/LoopsToGPU/ConvertKernelFuncToCubin.cpp:16:10: fatal error: cuda.h: No such file or directory
   16 | #include "cuda.h"
      |          ^~~~~~~~

This happens in a computing center that uses "modules" (implemented with spack).

Before running CMake, I "activated" CUDA by running module load cuda.

CMake correctly found the CUDA compiler:

-- Looking for a CUDA compiler - /grid5000/spack/v1/opt/spack/linux-debian11-x86_64_v2/gcc-10.4.0/cuda-12.0.0-g2atnxvq3akekpc6otev56c2rqzmnr7y/bin/nvcc
-- The CUDA compiler identification is NVIDIA 12.0.76

But It did not correctly set the path of the include files when invoking the compiler. I could compile openearth by taking these steps:

  1. Tell CMake to generate Unix Makefiles instead of a Ninja build file
  2. Run make (it fails with the above error)
  3. Compile the offending file by running the right command manually and adding a -I option to gcc with the right paths of the include files (in my case: /grid5000/spack/v1/opt/spack/linux-debian11-x86_64_v2/gcc-10.4.0/cuda-12.0.0-g2atnxvq3akekpc6otev56c2rqzmnr7y/include)
  4. Run make again to finish compiling
@gysit
Copy link
Collaborator

gysit commented Jul 16, 2024

Thanks for reporting the issue and the possible workaround.

The intent was that the following line adds the CUDA headers to the target:

${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES}

It may very well be that this does not work anymore on modern systems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants