Skip to content

Commit 5750559

Browse files
committed
caffe modified version
0 parents  commit 5750559

File tree

364 files changed

+85836
-0
lines changed

Some content is hidden

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

364 files changed

+85836
-0
lines changed

.Doxyfile

Lines changed: 2335 additions & 0 deletions
Large diffs are not rendered by default.

.gitignore

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
## General
2+
3+
# Compiled Object files
4+
*.slo
5+
*.lo
6+
*.o
7+
*.cuo
8+
9+
# Compiled Dynamic libraries
10+
*.so
11+
*.dylib
12+
13+
# Compiled Static libraries
14+
*.lai
15+
*.la
16+
*.a
17+
18+
# Compiled protocol buffers
19+
*.pb.h
20+
*.pb.cc
21+
*_pb2.py
22+
23+
# Compiled python
24+
*.pyc
25+
26+
# Compiled MATLAB
27+
*.mex*
28+
29+
# build, distribute, and bins
30+
build
31+
.build_debug/*
32+
.build_release/*
33+
distribute/*
34+
*.testbin
35+
*.bin
36+
python/caffe/proto/
37+
38+
# Editor temporaries
39+
*.swp
40+
*~
41+
42+
# IPython notebook checkpoints
43+
.ipynb_checkpoints
44+
45+
## Caffe
46+
47+
# User's build configuration
48+
Makefile.config
49+
50+
# Data and models are either
51+
# 1. reference, and not casually committed
52+
# 2. custom, and live on their own unless they're deliberated contributed
53+
data/*
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-*
68+
69+
# Generated documentation
70+
docs/_site
71+
docs/gathered
72+
_site
73+
doxygen
74+
docs/dev
75+
76+
# Sublime Text settings
77+
*.sublime-workspace
78+
*.sublime-project
79+
80+
# Eclipse Project settings
81+
*.*project
82+
83+
# CMake generated files
84+
*.gen.cmake

.travis.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
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+
10+
language: cpp
11+
12+
# Cache Ubuntu apt packages.
13+
cache: apt
14+
15+
compiler: gcc
16+
17+
before_install:
18+
- export NUM_THREADS=4
19+
- export SCRIPTS=./scripts/travis
20+
21+
install:
22+
- sudo -E $SCRIPTS/travis_install.sh
23+
24+
before_script:
25+
- export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
26+
- if ! $WITH_CMAKE; then $SCRIPTS/travis_setup_makefile_config.sh; fi
27+
28+
script: $SCRIPTS/travis_build_and_test.sh
29+
30+
notifications:
31+
# Emails are sent to the committer's git-configured email address by default,
32+
# but only if they have access to the repository. To enable Travis on your
33+
# public fork of Caffe, just go to travis-ci.org and flip the switch on for
34+
# your Caffe fork. To configure your git email address, use:
35+
# git config --global user.email [email protected]
36+
email:
37+
on_success: always
38+
on_failure: always
39+
40+
# IRC notifications disabled by default.
41+
# Uncomment next 5 lines to send notifications to chat.freenode.net#caffe
42+
# irc:
43+
# channels:
44+
# - "chat.freenode.net#caffe"
45+
# template:
46+
# - "%{repository}/%{branch} (%{commit} - %{author}): %{message}"

CMakeLists.txt

Lines changed: 90 additions & 0 deletions
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

Lines changed: 61 additions & 0 deletions
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

Lines changed: 48 additions & 0 deletions
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

Lines changed: 48 additions & 0 deletions
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)