Igal Flegmann
Igal Flegmann

Reputation: 642

CMake 3.4.3 Can't find CUDA on windows

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.

Upvotes: 5

Views: 18513

Answers (2)

todorp
todorp

Reputation: 1

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

Upvotes: 0

merelyMark
merelyMark

Reputation: 369

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

Upvotes: 12

Related Questions