Commit d3d27108 authored by gcwenger's avatar gcwenger Committed by Scott Cyphers

Cuda < 9 compilation fix suggested by Chris Sullivan (#1853)

* Cuda < 9 compilation fix suggested by Chris Sullivan.

* Reworked conditional cuda compilation to support more compiler variants.

* Tweak to allow CUDA compilation with CUDA 8 & gcc 5.4

* Explicitly check for clang if not gcc.

* Removed extraneous comment
parent 7e394ac6
......@@ -72,8 +72,38 @@ if (NGRAPH_GPU_ENABLE)
-gencode=arch=compute_70,code=compute_70)
endif()
set_source_files_properties( ${CUDA_SRC} PROPERTIES CUDA_SOURCE_PROPERTY_FORMAT OBJ)
cuda_compile(CUDA_OBJ ${CUDA_SRC} STATIC)
set (DO_CUDA_COMPILE FALSE)
if (CUDA9_FOUND)
if (("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU"))
# CUDA 9 supports up to gcc 6.x
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.0)
set (DO_CUDA_COMPILE TRUE)
endif()
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
# CUDA 9 supports up to clang 3.9
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.0)
set (DO_CUDA_COMPILE TRUE)
endif()
endif()
else()
# CUDA 8 (minimum version of CUDA we support)
if (("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU"))
# Current release of CUDA 8 supports up to gcc 5.4
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.5)
set (DO_CUDA_COMPILE TRUE)
endif()
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
# CUDA 8 supports up to clang 3.8
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.9)
set (DO_CUDA_COMPILE TRUE)
endif()
endif()
endif()
if (DO_CUDA_COMPILE)
set_source_files_properties( ${CUDA_SRC} PROPERTIES CUDA_SOURCE_PROPERTY_FORMAT OBJ)
cuda_compile(CUDA_OBJ ${CUDA_SRC} STATIC)
endif()
add_library(gpu_backend SHARED ${SRC} ${CUDA_OBJ})
set_target_properties(gpu_backend PROPERTIES VERSION ${NGRAPH_VERSION} SOVERSION ${NGRAPH_API_VERSION})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment