Skip to content

Commit

Permalink
cmake: guess location of nvcc if it can't be found (apache#17293)
Browse files Browse the repository at this point in the history
* [Build] Add a reasonable default for CMAKE_CUDA_COMPILER in *nix

* CR

* CR

* Update as per CR comments

* include(CheckLanguage)

Co-authored-by: Leonard Lausen <leonard@lausen.nl>
  • Loading branch information
2 people authored and anirudh2290 committed May 29, 2020
1 parent 7f04914 commit e93b340
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,12 @@ message(STATUS "CMake version '${CMAKE_VERSION}' using generator '${CMAKE_GENERA
project(mxnet C CXX)
if(USE_CUDA)
cmake_minimum_required(VERSION 3.13.2) # CUDA 10 (Turing) detection available starting 3.13.2
include(CheckLanguage)
check_language(CUDA)
if (NOT CMAKE_CUDA_COMPILER_LOADED AND UNIX AND EXISTS "/usr/local/cuda/bin/nvcc")
set(CMAKE_CUDA_COMPILER "/usr/local/cuda/bin/nvcc")
message(WARNING "CMAKE_CUDA_COMPILER guessed: ${CMAKE_CUDA_COMPILER}")
endif()
enable_language(CUDA)
set(CMAKE_CUDA_STANDARD 11)
include(CheckCXXCompilerFlag)
Expand Down Expand Up @@ -592,7 +598,6 @@ if(USE_CUDA)

string(REPLACE ";" " " CUDA_ARCH_FLAGS_SPACES "${CUDA_ARCH_FLAGS}")


find_package(CUDAToolkit REQUIRED cublas cufft cusolver curand
OPTIONAL_COMPONENTS nvToolsExt nvrtc)

Expand Down

0 comments on commit e93b340

Please sign in to comment.