Compiling ROOT with CUDA support

Hi Guys.

_ROOT Version:6.18.04

I have been trying to install ROOT with CUDA support. I have also looked at some similar issues in the forum where I tried upgrading cmake to a newer version.
Here is the error I get:

[xola@wolf root-6.18.04-build]$ sudo cmake ../root-6.18.04/ -Dmathore=ON -Dcuda=ON -DCMAKE_INSTALL_PREFIX=/opt/root/root-6.18.04-install/ -DCMAKE_CUDA_HOST_COMPILER=/usr/local/cuda-10.0/bin/nvcc
[sudo] password for xola: 
-- ROOT default compression algorithm: zlib
-- Found GCC. Major version 4, minor version 8
-- Found a 64bit system
-- Found GNU compiler collection
-- ROOT Platform: linux
-- ROOT Architecture: linuxx8664gcc
-- Build Type: RelWithDebInfo
-- Compiler Flags:  -std=c++11 -pipe  -Wshadow -Wall -W -Woverloaded-virtual -fsigned-char -pthread 
-- Looking for ZLib
-- Looking for Freetype
-- Looking for PCRE
-- Building LZMA version 5.2.4 included in ROOT itself
-- Looking for X11
-- Could NOT find GIF (missing: GIF_LIBRARY GIF_INCLUDE_DIR) 
-- Building AfterImage library included in ROOT itself
-- Looking for GSL
-- Looking for python
-- Looking for OpenGL
-- The CUDA compiler identification is unknown
CMake Error at cmake/modules/SearchInstalledSoftware.cmake:1335 (enable_language):
  No CMAKE_CUDA_COMPILER could be found.

  Tell CMake where to find the compiler by setting either the environment
  variable "CUDACXX" or the CMake cache entry CMAKE_CUDA_COMPILER to the full
  path to the compiler, or to the compiler name if it is in the PATH.
Call Stack (most recent call first):
  CMakeLists.txt:159 (include)

-- Configuring incomplete, errors occurred!
See also "/opt/root/root-6.18.04-build/CMakeFiles/CMakeOutput.log".
See also "/opt/root/root-6.18.04-build/CMakeFiles/CMakeError.log".

Maybe @moneta has an idea of what could be the issue

Let me just put this here incase I get asked about it:

When i do mvcc --version I get:

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2018 NVIDIA Corporation
Built on Sat_Aug_25_21:08:01_CDT_2018
Cuda compilation tools, release 10.0, V10.0.130


Are you sure the compiler, nvcc is in your path ?
Have you tried doing what make suggested ? Defining for example CUDACXX ?
I would need to se you cmake output log and error to understand it better what is happening


Hi @moneta

I went into the CMakeList.txt and did


where my environment variables are:

export PATH=$PATH:/usr/local/cuda-10.0/bin/nvcc
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-10.0/lib64

I have also attached the
CMakeError.txt (39.9 KB)
CMakeOutput.txt (156.1 KB)


Looking at the error log seems that the CUDA compiler is not found. Something wring with the PATH definition when running CMake,
you see this line in CMakeError.txt

Compiling the CUDA compiler identification source file "" failed.
Build flags: 
Id flags:  -v;--keep;--keep-dir;tmp

and it should be something like:

Compiling the CUDA compiler identification source file "" succeeded.
Compiler: /usr/local/cuda/bin/nvcc 
Build flags: 
Id flags:  -v;--keep;--keep-dir;tmp

Have you tried to run a simple program with nvcc ? Is the Cuda installation correct and working ?


I would try do add a link from /usr/local/cuda to /usr/local/cuda-10.0/ like I have in my installation:

>>> ls -ltr /usr/local/cuda
lrwxrwxrwx 1 root root 21 Feb 12  2020 /usr/local/cuda -> /usr/local/cuda-10.1/

Add -DCMAKE_PREFIX_PATH=/usr/local/cuda-10.0 to your CMake configuration line when configuring ROOT initially.

1 Like

Let me try this and I will get back to you.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.