5

I am trying to build something with CMake (it has to be an older version because of the project) and when I run it I get this error:

CMake Error at C:/Program Files (x86)/CMake/share/cmake-3.4/Modules/FindCUDA.cmake:617 (message):
  Specify CUDA_TOOLKIT_ROOT_DIR
Call Stack (most recent call first):
  libethash-cuda/CMakeLists.txt:3 (FIND_PACKAGE)

I have looked everywhere online but I only find solutions for Linux.

3
  • 2
    CUDA_TOOLKIT_ROOT_DIR Looks like a CMake variable. You would set that in cmake-gui. Or via the command line argument -D when launching cmake from a command prompt setup with the environment for your compiler.
    – drescherjm
    Jun 23, 2017 at 16:31
  • 1
    @drescherjm Or inside the CMakeLists.txt of the project. ;) Jun 23, 2017 at 18:02
  • I tend to not force any path inside a CMakeLists.txt although for me I build on many machines (use git or svn to hold the code) and even multiple compilers for the same source.
    – drescherjm
    Jun 23, 2017 at 18:05

2 Answers 2

10

So, my CMake (v3.7.0) found the toolkit automatically. It's located in:

C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v8.0

In general, I've found on Windows it has difficulty finding the SDK which is in:

C:\ProgramData\NVIDIA Corporation\CUDA Samples\v8.0

To set CUDA_TOOLKIT_ROOT_DIR in CMake on windows, open up cmake-gui, run "configure" once then go to "advanced:"

enter image description here

Scroll down until you see CUDA_TOOLKIT_ROOT_DIR:

And set it to your CUDA toolkit directory (which is probably C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v8.0 if you're using CUDA version 8.0)

enter image description here

0
git clone —recursive https://github.com/Danko-Lab/Rgtsvm.git
cd Rgtsvm
git submodule init
git submodule update

mkdir build
cd build

cmake .. -G”Visual Studio 15 2017 Win64" -DCUDA_TOOLKIT_ROOT_DIR="C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v10.2/lib/x64" -DUSE_CUDA=ON -DLIBR_EXECUTABLE=”C:/Program Files/Microsoft SQL Server/140/R_SERVER/bin/R.exe” -DR_LIB=ON -DGPU_COMPUTE_VER=52
cmake --build . --target install --config Release

does it for Win10, where

  • -G”Visual Studio 15 2017 Win64" what your VS version is
  • -DCUDA_TOOLKIT_ROOT_DIR="C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v10.2/lib/x64" where your CUDA version is installed
  • -DGPU_COMPUTE_VER=52 choose your GPU architecture

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.