CUDA fixes

Fix NCCL build
move CUDA dep into Dependencies file
This commit is contained in:
Simon Layton
2016-12-09 09:02:26 -05:00
parent f79bffc78d
commit cdb2fb6737
3 changed files with 6 additions and 19 deletions

View File

@ -113,9 +113,6 @@ target_link_libraries(Caffe2_CPU Caffe2_PROTO)
# CUDA library
# TODO(slayton): Move this somewhere sane
find_package(CUDA)
LIST(APPEND CUDA_NVCC_FLAGS -Xcompiler -std=c++11)
LIST(APPEND CUDA_NVCC_FLAGS -gencode arch=compute_52,code=sm_52)
CUDA_ADD_LIBRARY(Caffe2_GPU ${Caffe2_GPU_SRCS})
target_link_libraries(Caffe2_GPU Caffe2_CPU Caffe2_PROTO glog gflags atlas cblas)

View File

@ -55,15 +55,9 @@ endif()
# ---[ CUDA
include(cmake/Cuda.cmake)
if(NOT HAVE_CUDA)
if(CPU_ONLY)
message(STATUS "-- CUDA is disabled. Building without it...")
else()
message(WARNING "-- CUDA is not detected by cmake. Building without it...")
endif()
# TODO: remove this not cross platform define in future. Use caffe_config.h instead.
add_definitions(-DCPU_ONLY)
if(HAVE_CUDA)
LIST(APPEND CUDA_NVCC_FLAGS -Xcompiler -std=c++11)
LIST(APPEND CUDA_NVCC_FLAGS -gencode arch=compute_52,code=sm_52)
endif()
# ---[ NCCL

View File

@ -6,12 +6,8 @@ if (NOT __NCCL_INCLUDED)
if (NCCL_FOUND)
set(NCCL_EXTERNAL FALSE)
else()
# fetch and build glog from github
# build directory
set(nccl_PREFIX ${CMAKE_SOURCE_DIR}/third_party/nccl)
# install directory
set(nccl_INSTALL ${CMAKE_BINARY_DIR}/external/nccl-install)
# we build glog statically, but want to link it into the caffe shared library
# this requires position-independent code
@ -31,9 +27,9 @@ if (NOT __NCCL_INCLUDED)
)
set(NCCL_FOUND TRUE)
set(NCCL_INCLUDE_DIRS ${nccl_INSTALL}/include)
set(NCCL_LIBRARIES ${nccl_INSTALL}/lib/libnccl.a)
set(NCCL_LIBRARY_DIRS ${nccl_INSTALL}/lib)
set(NCCL_INCLUDE_DIRS ${nccl_PREFIX}/build/include)
set(NCCL_LIBRARIES ${nccl_PREFIX}/build/lib/libnccl.so)
set(NCCL_LIBRARY_DIRS ${nccl_PREFIX}/build/lib)
set(NCCL_EXTERNAL TRUE)
list(APPEND external_project_dependencies nccl_external)