Skip to content

Commit

Permalink
Updated cmake to work with dependencies on deep machines
Browse files Browse the repository at this point in the history
  • Loading branch information
brodyh committed Oct 6, 2014
1 parent 8da7bed commit 9de04a1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
18 changes: 14 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ project( Caffe )
### Build Options ##########################################################################

option(CPU_ONLY "Build Caffe without GPU support" OFF)
option(BUILD_PYTHON "Build Python wrapper" OFF)
option(USE_CUDNN "Build Caffe with cuDNN support" ON)
option(BUILD_PYTHON "Build Python wrapper" ON)
option(BUILD_MATLAB "Build Matlab wrapper" OFF)
option(BUILD_EXAMPLES "Build examples" ON)
option(BUILD_SHARED_LIBS "Build SHARED libs if ON and STATIC otherwise" OFF)
Expand All @@ -22,6 +23,13 @@ if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set (CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install" CACHE PATH "Default install path" FORCE )
endif()

#### custom search paths ####
# so it doesn't find older versions of cuda
set(CMAKE_PREFIX_PATH /usr/local/cuda-6.5/bin ${CMAKE_PREFIX_PATH})
# for some reason it had trouble finding this library
set(Atlas_LAPACK_LIBRARY /usr/lib64/atlas/liblapack.so)


### Configuration ###########################################################################
# Compiler Flags
set(CMAKE_CXX_COMPILER_FLAGS ${CMAKE_CXX_COMPILER_FLAGS} -Wall)
Expand Down Expand Up @@ -49,6 +57,10 @@ set( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SCRIPT_DIR})
if(NOT CPU_ONLY)
find_package(CUDA 5.5 REQUIRED)
include_directories(${CUDA_INCLUDE_DIRS})
if (USE_CUDNN)
add_definitions(-DUSE_CUDNN)
set(CUDA_CUDNN_LIBRARIES ${CUDA_TOOLKIT_ROOT_DIR}/lib64/libcudnn.so)
endif()
endif()

### Subdirectories ##########################################################################
Expand Down Expand Up @@ -77,7 +89,7 @@ endif()
set(LINT_TARGET lint)
set(LINT_SCRIPT ${CMAKE_SCRIPT_DIR}/lint.cmake)
add_custom_target(
${LINT_TARGET}
${LINT_TARGET}
COMMAND ${CMAKE_COMMAND} -P ${LINT_SCRIPT}
)

Expand All @@ -86,5 +98,3 @@ add_custom_target(
# Install Includes
file(GLOB folders ${${PROJECT_NAME}_INCLUDE_DIRS}/*)
install(DIRECTORY ${folders} DESTINATION include)


3 changes: 2 additions & 1 deletion src/caffe/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ if(NOT CPU_ONLY)
-gencode arch=compute_30,code=sm_30
-gencode arch=compute_35,code=sm_35
)

# https://github.com/ComputationalRadiationPhysics/picongpu/blob/master/src/picongpu/CMakeLists.txt
# work-arounds
if(Boost_VERSION EQUAL 105500)
Expand All @@ -104,6 +104,7 @@ endif(Boost_VERSION EQUAL 105500)
add_dependencies(caffe_cu proto)
target_link_libraries(caffe caffe_cu
${CUDA_CUBLAS_LIBRARIES}
${CUDA_CUDNN_LIBRARIES}
${CUDA_curand_LIBRARY}
)
endif()
Expand Down

0 comments on commit 9de04a1

Please sign in to comment.