Commit 17ac2f3e authored by Tristan Webb's avatar Tristan Webb

Link in LLVM to cuda tests / source build

Clang cuda example from:
https://gist.github.com/anonymous/855e277884eb6b388cd2f00d956c2fd4
parent 56f83929
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
include(ExternalProject) include(ExternalProject)
if(NGRAPH_CPU_ENABLE AND (NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin") AND if((NGRAPH_CPU_ENABLE OR USE_CUDA) AND (NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin") AND
(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Windows")) (NOT ${CMAKE_SYSTEM_NAME} MATCHES "Windows"))
message(STATUS "Fetching LLVM from llvm.org") message(STATUS "Fetching LLVM from llvm.org")
set(LLVM_RELEASE_URL http://releases.llvm.org/5.0.0/clang+llvm-5.0.0-linux-x86_64-ubuntu16.04.tar.xz) set(LLVM_RELEASE_URL http://releases.llvm.org/5.0.0/clang+llvm-5.0.0-linux-x86_64-ubuntu16.04.tar.xz)
......
...@@ -99,8 +99,8 @@ if(USE_CUDA) ...@@ -99,8 +99,8 @@ if(USE_CUDA)
"Not compiling with CUDA. Suppress this warning with -DUSE_CUDA=OFF") "Not compiling with CUDA. Suppress this warning with -DUSE_CUDA=OFF")
set(USE_CUDA OFF) set(USE_CUDA OFF)
else() else()
include_directories(SYSTEM ${CUDNN_INCLUDE_DIR}) include_directories(SYSTEM ${CUDNN_INCLUDE_DIR} ${LLVM_INCLUDE_DIR})
link_directories(${CUDNN_LIB_DIR}) link_directories(${CUDNN_LIB_DIR} ${LLVM_LIB_DIR})
endif() endif()
else() else()
message(WARNING "Not compiling with CUDA. Suppress this warning with -DUSE_CUDA=OFF") message(WARNING "Not compiling with CUDA. Suppress this warning with -DUSE_CUDA=OFF")
...@@ -191,7 +191,7 @@ message(STATUS "LIBRARY_OUTPUT_DIRECTORY set to: ${COMMON_LIBRARY_OUTPUT_DIRECTO ...@@ -191,7 +191,7 @@ message(STATUS "LIBRARY_OUTPUT_DIRECTORY set to: ${COMMON_LIBRARY_OUTPUT_DIRECTO
target_include_directories(ngraph PUBLIC "${NGRAPH_INCLUDE_PATH}") target_include_directories(ngraph PUBLIC "${NGRAPH_INCLUDE_PATH}")
if(NGRAPH_CPU_ENABLE AND LLVM_LINK_LIBS) if((NGRAPH_CPU_ENABLE OR USE_CUDA) AND LLVM_LINK_LIBS)
target_link_libraries(ngraph PRIVATE ${LLVM_LINK_LIBS}) target_link_libraries(ngraph PRIVATE ${LLVM_LINK_LIBS})
endif() endif()
...@@ -256,7 +256,7 @@ endif() ...@@ -256,7 +256,7 @@ endif()
add_dependencies(ngraph eigen) add_dependencies(ngraph eigen)
if(NGRAPH_CPU_ENABLE AND LLVM_INCLUDE_DIR) if((NGRAPH_CPU_ENABLE OR USE_CUDA) AND LLVM_INCLUDE_DIR)
add_dependencies(ngraph ext_llvm) add_dependencies(ngraph ext_llvm)
endif() endif()
......
...@@ -66,9 +66,10 @@ endif() ...@@ -66,9 +66,10 @@ endif()
if(USE_CUDA) if(USE_CUDA)
find_package(CUDA QUIET) find_package(CUDA QUIET)
include_directories(SYSTEM ${CUDA_INCLUDE_DIRS} ${CUDNN_INCLUDE_DIR}) include_directories(SYSTEM ${CUDA_INCLUDE_DIRS} ${CUDNN_INCLUDE_DIR} ${LLVM_INCLUDE_DIR})
link_directories(${LLVM_LIB_DIR})
set(SRC main.cpp cudnn.cpp) set(SRC main.cpp cudnn.cpp)
# set(BACKEND_NAMES ${BACKEND_NAMES} "GPU") set(BACKEND_NAMES)
endif() endif()
foreach(BACKEND_NAME ${BACKEND_NAMES}) foreach(BACKEND_NAME ${BACKEND_NAMES})
...@@ -93,6 +94,7 @@ if(LLVM_INCLUDE_DIR) ...@@ -93,6 +94,7 @@ if(LLVM_INCLUDE_DIR)
endif() endif()
if(CUDNN_INCLUDE_DIR) if(CUDNN_INCLUDE_DIR)
target_link_libraries(unit-test ${LLVM_LINK_LIBS})
target_link_libraries(unit-test cudnn) target_link_libraries(unit-test cudnn)
endif() endif()
......
...@@ -12,6 +12,10 @@ ...@@ -12,6 +12,10 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
#include <sstream>
#include <string>
#include <vector>
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <cuda.h> #include <cuda.h>
......
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