Skip to content

Commit 737ea5e

Browse files
committed
Merge pull request #1112 from BVLC/next
Next: release candidate
2 parents 7353e3d + 89fd7da commit 737ea5e

File tree

297 files changed

+17723
-3255
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

297 files changed

+17723
-3255
lines changed

.Doxyfile

+2,335
Large diffs are not rendered by default.

.gitignore

+22-2
Original file line numberDiff line numberDiff line change
@@ -47,18 +47,38 @@ python/caffe/proto/
4747
# User's build configuration
4848
Makefile.config
4949

50-
# Data and examples are either
50+
# Data and models are either
5151
# 1. reference, and not casually committed
5252
# 2. custom, and live on their own unless they're deliberated contributed
5353
data/*
54-
examples/*
54+
models/*
55+
*.caffemodel
56+
*.solverstate
57+
*.binaryproto
58+
*leveldb
59+
*lmdb
60+
61+
# LevelDB files
62+
*.sst
63+
*.ldb
64+
LOCK
65+
LOG*
66+
CURRENT
67+
MANIFEST-*
5568

5669
# Generated documentation
5770
docs/_site
5871
docs/gathered
5972
_site
73+
doxygen
74+
docs/dev
6075

6176
# Sublime Text settings
6277
*.sublime-workspace
6378
*.sublime-project
6479

80+
# Eclipse Project settings
81+
*.*project
82+
83+
# CMake generated files
84+
*.gen.cmake

.travis.yml

+15-40
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,31 @@
1+
# Use a build matrix to do two builds in parallel:
2+
# one using CMake, and one using make.
3+
env:
4+
matrix:
5+
- WITH_CUDA=false WITH_CMAKE=false
6+
- WITH_CUDA=false WITH_CMAKE=true
7+
- WITH_CUDA=true WITH_CMAKE=false
8+
- WITH_CUDA=true WITH_CMAKE=true
9+
110
language: cpp
211

312
# Cache Ubuntu apt packages.
413
cache: apt
514

6-
compiler:
7-
- gcc
8-
# Disable clang build: doesn't seem to work on Linux.
9-
# (@jeffdonahue: Travis buildbot's failure behavior is similar to what I see
10-
# building on Linux.)
11-
# - clang
15+
compiler: gcc
1216

1317
before_install:
14-
- echo $LANG
15-
- echo $LC_ALL
16-
- sudo apt-get -y update
17-
- sudo apt-get -y install wget git curl python-dev python-numpy libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libboost-all-dev libhdf5-serial-dev protobuf-compiler libatlas-dev libatlas-base-dev bc
18+
- export NUM_THREADS=4
19+
- export SCRIPTS=./scripts/travis
1820

1921
install:
20-
- wget https://google-glog.googlecode.com/files/glog-0.3.3.tar.gz -O /tmp/glog-0.3.3.tar.gz && tar -C /tmp -xzvf /tmp/glog-0.3.3.tar.gz && rm /tmp/glog-0.3.3.tar.gz
21-
- cd /tmp/glog-0.3.3 && ./configure && make && sudo make install && cd -
22-
- wget https://github.com/schuhschuh/gflags/archive/master.zip -O /tmp/gflags-master.zip && pushd /tmp/ && unzip gflags-master.zip && cd gflags-master && mkdir build && cd build && export CXXFLAGS="-fPIC" && cmake .. && make VERBOSE=1 && sudo make install && popd
23-
- curl http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1204/x86_64/cuda-repo-ubuntu1204_6.0-37_amd64.deb -o /tmp/cuda_install.deb && sudo dpkg -i /tmp/cuda_install.deb && rm /tmp/cuda_install.deb
24-
- sudo apt-get -y update
25-
# Install the minimal CUDA subpackages required to test Caffe build.
26-
# For a full CUDA installation, add 'cuda' to the list of packages.
27-
- sudo apt-get -y install cuda-core-6-0 cuda-extra-libs-6-0
28-
# Create CUDA symlink at /usr/local/cuda
29-
# (This would normally be created by the CUDA installer, but we create it
30-
# manually since we did a partial installation.)
31-
- sudo ln -s /usr/local/cuda-6.0 /usr/local/cuda
32-
- curl https://gitorious.org/mdb/mdb/archive/7f038d0f15bec57b4c07aa3f31cd5564c88a1897.tar.gz -o /tmp/mdb.tar.gz && tar -C /tmp -xzvf /tmp/mdb.tar.gz && rm /tmp/mdb.tar.gz
33-
- cd /tmp/mdb-mdb/libraries/liblmdb/ && make && sudo make install && cd -
22+
- sudo -E $SCRIPTS/travis_install.sh
3423

3524
before_script:
36-
- mv Makefile.config.example Makefile.config
3725
- export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
38-
- export NUM_THREADS=4
26+
- if ! $WITH_CMAKE; then $SCRIPTS/travis_setup_makefile_config.sh; fi
3927

40-
script:
41-
# CPU-GPU: build only.
42-
- export CPU_ONLY=0
43-
- make --keep-going --jobs=$NUM_THREADS all
44-
- make clean
45-
# CPU-only: comprehensive.
46-
- export CPU_ONLY=1
47-
- make --keep-going --jobs=$NUM_THREADS all test warn lint
48-
- make runtest
49-
- make --jobs=$NUM_THREADS all
50-
- make --jobs=$NUM_THREADS test
51-
- make --jobs=$NUM_THREADS warn
52-
- make --jobs=$NUM_THREADS lint
53-
- make --jobs=$NUM_THREADS pycaffe
28+
script: $SCRIPTS/travis_build_and_test.sh
5429

5530
notifications:
5631
# Emails are sent to the committer's git-configured email address by default,

CMakeLists.txt

+90
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
cmake_minimum_required(VERSION 2.8.8)
2+
project( Caffe )
3+
4+
### Build Options ##########################################################################
5+
6+
option(CPU_ONLY "Build Caffe without GPU support" OFF)
7+
option(BUILD_PYTHON "Build Python wrapper" OFF)
8+
option(BUILD_MATLAB "Build Matlab wrapper" OFF)
9+
option(BUILD_EXAMPLES "Build examples" ON)
10+
option(BUILD_SHARED_LIBS "Build SHARED libs if ON and STATIC otherwise" OFF)
11+
12+
if(NOT BLAS)
13+
set(BLAS atlas)
14+
endif()
15+
16+
if(NOT CUDA_TEST_DEVICE)
17+
set(CUDA_TEST_DEVICE -1)
18+
endif()
19+
20+
# Install Prefix
21+
if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
22+
set (CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install" CACHE PATH "Default install path" FORCE )
23+
endif()
24+
25+
### Configuration ###########################################################################
26+
# Compiler Flags
27+
set(CMAKE_CXX_COMPILER_FLAGS ${CMAKE_CXX_COMPILER_FLAGS} -Wall)
28+
set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} -fPIC) # set global flags
29+
set(CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG}) # set debug flags
30+
set(CMAKE_CXX_FLAGS_RELEASE ${CMAKE_CXX_FLAGS_RELEASE}) # set release flags
31+
32+
# Global Definitions
33+
if(CPU_ONLY)
34+
add_definitions(-DCPU_ONLY)
35+
endif()
36+
37+
# Include Directories
38+
set(${PROJECT_NAME}_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/include)
39+
include_directories(${${PROJECT_NAME}_INCLUDE_DIRS})
40+
include_directories(${CMAKE_SOURCE_DIR}/src)
41+
42+
# CMake Scripts dir
43+
set(CMAKE_SCRIPT_DIR ${CMAKE_SOURCE_DIR}/CMakeScripts)
44+
45+
# CMake module path for custom module finding
46+
set( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SCRIPT_DIR})
47+
48+
# CUDA is required globally
49+
if(NOT CPU_ONLY)
50+
find_package(CUDA 5.5 REQUIRED)
51+
include_directories(${CUDA_INCLUDE_DIRS})
52+
endif()
53+
54+
### Subdirectories ##########################################################################
55+
56+
add_subdirectory(src/gtest)
57+
add_subdirectory(src/caffe)
58+
add_subdirectory(tools)
59+
60+
if(BUILD_EXAMPLES)
61+
message(STATUS "Examples enabled")
62+
add_subdirectory(examples)
63+
endif()
64+
65+
if(BUILD_PYTHON)
66+
message(STATUS "Python enabled")
67+
add_subdirectory(python)
68+
endif()
69+
70+
if(BUILD_MATLAB)
71+
message(STATUS "Matlab enabled")
72+
add_subdirectory(matlab)
73+
endif()
74+
75+
### Lint Target Setup ##########################################################################
76+
77+
set(LINT_TARGET lint)
78+
set(LINT_SCRIPT ${CMAKE_SCRIPT_DIR}/lint.cmake)
79+
add_custom_target(
80+
${LINT_TARGET}
81+
COMMAND ${CMAKE_COMMAND} -P ${LINT_SCRIPT}
82+
)
83+
84+
### Install #################################################################################
85+
86+
# Install Includes
87+
file(GLOB folders ${${PROJECT_NAME}_INCLUDE_DIRS}/*)
88+
install(DIRECTORY ${folders} DESTINATION include)
89+
90+

CMakeScripts/FindAtlas.cmake

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Find the Atlas (and Lapack) libraries
2+
#
3+
# The following variables are optionally searched for defaults
4+
# Atlas_ROOT_DIR: Base directory where all Atlas components are found
5+
#
6+
# The following are set after configuration is done:
7+
# Atlas_FOUND
8+
# Atlas_INCLUDE_DIRS
9+
# Atlas_LIBRARIES
10+
# Atlas_LIBRARYRARY_DIRS
11+
12+
set(Atlas_INCLUDE_SEARCH_PATHS
13+
/usr/include/atlas
14+
/usr/include/atlas-base
15+
$ENV{Atlas_ROOT_DIR}
16+
$ENV{Atlas_ROOT_DIR}/include
17+
)
18+
19+
set(Atlas_LIB_SEARCH_PATHS
20+
/usr/lib/atlas
21+
/usr/lib/atlas-base
22+
$ENV{Atlas_ROOT_DIR}
23+
$ENV{Atlas_ROOT_DIR}/lib
24+
)
25+
26+
find_path(Atlas_CBLAS_INCLUDE_DIR NAMES cblas.h PATHS ${Atlas_INCLUDE_SEARCH_PATHS})
27+
find_path(Atlas_CLAPACK_INCLUDE_DIR NAMES clapack.h PATHS ${Atlas_INCLUDE_SEARCH_PATHS})
28+
find_library(Atlas_CBLAS_LIBRARY NAMES ptcblas_r ptcblas cblas_r cblas PATHS ${Atlas_LIB_SEARCH_PATHS})
29+
find_library(Atlas_BLAS_LIBRARY NAMES atlas_r atlas PATHS ${Atlas_LIB_SEARCH_PATHS})
30+
find_library(Atlas_LAPACK_LIBRARY NAMES alapack_r alapack lapack_atlas PATHS ${Atlas_LIB_SEARCH_PATHS})
31+
32+
set(LOOKED_FOR
33+
34+
Atlas_CBLAS_INCLUDE_DIR
35+
Atlas_CLAPACK_INCLUDE_DIR
36+
37+
Atlas_CBLAS_LIBRARY
38+
Atlas_BLAS_LIBRARY
39+
Atlas_LAPACK_LIBRARY
40+
)
41+
42+
include(FindPackageHandleStandardArgs)
43+
find_package_handle_standard_args(Atlas DEFAULT_MSG ${LOOKED_FOR})
44+
45+
if(ATLAS_FOUND)
46+
47+
mark_as_advanced(${LOOKED_FOR})
48+
49+
set(Atlas_INCLUDE_DIR
50+
${Atlas_CBLAS_INCLUDE_DIR}
51+
${Atlas_CLAPACK_INCLUDE_DIR}
52+
)
53+
54+
set(Atlas_LIBRARIES
55+
${Atlas_LAPACK_LIBRARY}
56+
${Atlas_CBLAS_LIBRARY}
57+
${Atlas_BLAS_LIBRARY}
58+
)
59+
60+
endif(ATLAS_FOUND)
61+

CMakeScripts/FindGFlags.cmake

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# - Try to find GFLAGS
2+
#
3+
# The following variables are optionally searched for defaults
4+
# GFLAGS_ROOT_DIR: Base directory where all GFLAGS components are found
5+
#
6+
# The following are set after configuration is done:
7+
# GFLAGS_FOUND
8+
# GFLAGS_INCLUDE_DIRS
9+
# GFLAGS_LIBRARIES
10+
# GFLAGS_LIBRARYRARY_DIRS
11+
12+
include(FindPackageHandleStandardArgs)
13+
14+
set(GFLAGS_ROOT_DIR "" CACHE PATH "Folder contains Gflags")
15+
16+
# We are testing only a couple of files in the include directories
17+
if(WIN32)
18+
find_path(GFLAGS_INCLUDE_DIR gflags/gflags.h
19+
PATHS ${GFLAGS_ROOT_DIR}/src/windows)
20+
else()
21+
find_path(GFLAGS_INCLUDE_DIR gflags/gflags.h
22+
PATHS ${GFLAGS_ROOT_DIR})
23+
endif()
24+
25+
if(MSVC)
26+
find_library(GFLAGS_LIBRARY_RELEASE
27+
NAMES libgflags
28+
PATHS ${GFLAGS_ROOT_DIR}
29+
PATH_SUFFIXES Release)
30+
31+
find_library(GFLAGS_LIBRARY_DEBUG
32+
NAMES libgflags-debug
33+
PATHS ${GFLAGS_ROOT_DIR}
34+
PATH_SUFFIXES Debug)
35+
36+
set(GFLAGS_LIBRARY optimized ${GFLAGS_LIBRARY_RELEASE} debug ${GFLAGS_LIBRARY_DEBUG})
37+
else()
38+
find_library(GFLAGS_LIBRARY gflags)
39+
endif()
40+
41+
find_package_handle_standard_args(GFLAGS DEFAULT_MSG
42+
GFLAGS_INCLUDE_DIR GFLAGS_LIBRARY)
43+
44+
45+
if(GFLAGS_FOUND)
46+
set(GFLAGS_INCLUDE_DIRS ${GFLAGS_INCLUDE_DIR})
47+
set(GFLAGS_LIBRARIES ${GFLAGS_LIBRARY})
48+
endif()

CMakeScripts/FindGlog.cmake

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# - Try to find Glog
2+
#
3+
# The following variables are optionally searched for defaults
4+
# GLOG_ROOT_DIR: Base directory where all GLOG components are found
5+
#
6+
# The following are set after configuration is done:
7+
# GLOG_FOUND
8+
# GLOG_INCLUDE_DIRS
9+
# GLOG_LIBRARIES
10+
# GLOG_LIBRARYRARY_DIRS
11+
12+
include(FindPackageHandleStandardArgs)
13+
14+
set(GLOG_ROOT_DIR "" CACHE PATH "Folder contains Google glog")
15+
16+
if(WIN32)
17+
find_path(GLOG_INCLUDE_DIR glog/logging.h
18+
PATHS ${GLOG_ROOT_DIR}/src/windows)
19+
else()
20+
find_path(GLOG_INCLUDE_DIR glog/logging.h
21+
PATHS ${GLOG_ROOT_DIR})
22+
endif()
23+
24+
if(MSVC)
25+
find_library(GLOG_LIBRARY_RELEASE libglog_static
26+
PATHS ${GLOG_ROOT_DIR}
27+
PATH_SUFFIXES Release)
28+
29+
find_library(GLOG_LIBRARY_DEBUG libglog_static
30+
PATHS ${GLOG_ROOT_DIR}
31+
PATH_SUFFIXES Debug)
32+
33+
set(GLOG_LIBRARY optimized ${GLOG_LIBRARY_RELEASE} debug ${GLOG_LIBRARY_DEBUG})
34+
else()
35+
find_library(GLOG_LIBRARY glog
36+
PATHS ${GLOG_ROOT_DIR}
37+
PATH_SUFFIXES
38+
lib
39+
lib64)
40+
endif()
41+
42+
find_package_handle_standard_args(GLOG DEFAULT_MSG
43+
GLOG_INCLUDE_DIR GLOG_LIBRARY)
44+
45+
if(GLOG_FOUND)
46+
set(GLOG_INCLUDE_DIRS ${GLOG_INCLUDE_DIR})
47+
set(GLOG_LIBRARIES ${GLOG_LIBRARY})
48+
endif()

0 commit comments

Comments
 (0)