Skip to content

Commit c1e3b78

Browse files
authored
Merge pull request #586 from drnikolaev/caffe-0.17
0.17.4 CUDNN 8, CUDA 11, UBUNTU 20.04 etc.
2 parents 4867dc2 + 4c7481c commit c1e3b78

Some content is hidden

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

42 files changed

+370
-312
lines changed

.travis.yml

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
dist: trusty
1+
dist: bionic
22
sudo: required
33

44
language: cpp
@@ -14,14 +14,14 @@ env:
1414
# WITH_PYTHON3: false
1515
# WITH_CUDA: const true since v0.17
1616
# WITH_CUDNN: false
17-
- BUILD_NAME="default-make"
18-
# - BUILD_NAME="python3-make" WITH_PYTHON3=true
19-
- BUILD_NAME="cudnn-make" WITH_CUDNN=true
17+
# - BUILD_NAME="default-make"
18+
- BUILD_NAME="python3-make" WITH_PYTHON3=true
19+
- BUILD_NAME="python3-cudnn-make" WITH_PYTHON3=true WITH_CUDNN=true
2020

21-
- BUILD_NAME="default-cmake" WITH_CMAKE=true
21+
# - BUILD_NAME="default-cmake" WITH_CMAKE=true
2222
- BUILD_NAME="python3-cmake" WITH_CMAKE=true WITH_PYTHON3=true
23-
- BUILD_NAME="cudnn-cmake" WITH_CMAKE=true WITH_CUDNN=true
24-
- BUILD_NAME="cudnn-python3-cmake" WITH_CMAKE=true WITH_CUDNN=true WITH_PYTHON3=true
23+
# - BUILD_NAME="cudnn-cmake" WITH_CMAKE=true WITH_CUDNN=true
24+
- BUILD_NAME="python3-cudnn-cmake" WITH_CMAKE=true WITH_CUDNN=true WITH_PYTHON3=true
2525

2626
cache:
2727
apt: true

3rdparty/half_float/half.hpp

+12-11
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ namespace half_float
349349
struct binary_t {};
350350

351351
/// Tag for binary construction.
352-
HALF_CONSTEXPR_CONST binary_t binary = binary_t();
352+
static HALF_CONSTEXPR_CONST binary_t binary = binary_t();
353353

354354
/// Temporary half-precision expression.
355355
/// This class represents a half-precision expression which just stores a single-precision value internally.
@@ -1172,7 +1172,8 @@ namespace half_float
11721172
/// Constructor.
11731173
/// \param bits binary representation to set half to
11741174
CAFFE_UTIL_HD
1175-
HALF_CONSTEXPR half(detail::binary_t, detail::uint16 bits) : data_(bits) {}
1175+
HALF_CONSTEXPR half(detail::binary_t, unsigned int bits) HALF_NOEXCEPT
1176+
: data_(static_cast<detail::uint16>(bits)) {}
11761177

11771178
/// Internal binary representation
11781179
detail::uint16 data_;
@@ -3067,32 +3068,32 @@ namespace std
30673068
static HALF_CONSTEXPR_CONST int max_exponent10 = 4;
30683069

30693070
/// Smallest positive normal value.
3070-
static HALF_CONSTEXPR half_float::half min() HALF_NOTHROW { return half_float::half(half_float::detail::binary, 0x0400); }
3071+
static HALF_CONSTEXPR half_float::half min() HALF_NOTHROW { return half_float::half{half_float::detail::binary, 0x0400}; }
30713072

30723073
/// Smallest finite value.
3073-
static HALF_CONSTEXPR half_float::half lowest() HALF_NOTHROW { return half_float::half(half_float::detail::binary, 0xFBFF); }
3074+
static HALF_CONSTEXPR half_float::half lowest() HALF_NOTHROW { return half_float::half{half_float::detail::binary, 0xFBFF}; }
30743075

30753076
/// Largest finite value.
3076-
static HALF_CONSTEXPR half_float::half max() HALF_NOTHROW { return half_float::half(half_float::detail::binary, 0x7BFF); }
3077+
static HALF_CONSTEXPR half_float::half max() HALF_NOTHROW { return half_float::half{half_float::detail::binary, 0x7BFF}; }
30773078

30783079
/// Difference between one and next representable value.
3079-
static HALF_CONSTEXPR half_float::half epsilon() HALF_NOTHROW { return half_float::half(half_float::detail::binary, 0x1400); }
3080+
static HALF_CONSTEXPR half_float::half epsilon() HALF_NOTHROW { return half_float::half{half_float::detail::binary, 0x1400}; }
30803081

30813082
/// Maximum rounding error.
30823083
static HALF_CONSTEXPR half_float::half round_error() HALF_NOTHROW
3083-
{ return half_float::half(half_float::detail::binary, (round_style==std::round_to_nearest) ? 0x3800 : 0x3C00); }
3084+
{ return half_float::half{half_float::detail::binary, (round_style==std::round_to_nearest) ? 0x3800 : 0x3C00}; }
30843085

30853086
/// Positive infinity.
3086-
static HALF_CONSTEXPR half_float::half infinity() HALF_NOTHROW { return half_float::half(half_float::detail::binary, 0x7C00); }
3087+
static HALF_CONSTEXPR half_float::half infinity() HALF_NOTHROW { return half_float::half{half_float::detail::binary, 0x7C00}; }
30873088

30883089
/// Quiet NaN.
3089-
static HALF_CONSTEXPR half_float::half quiet_NaN() HALF_NOTHROW { return half_float::half(half_float::detail::binary, 0x7FFF); }
3090+
static HALF_CONSTEXPR half_float::half quiet_NaN() HALF_NOTHROW { return half_float::half{half_float::detail::binary, 0x7FFF}; }
30903091

30913092
/// Signalling NaN.
3092-
static HALF_CONSTEXPR half_float::half signaling_NaN() HALF_NOTHROW { return half_float::half(half_float::detail::binary, 0x7DFF); }
3093+
static HALF_CONSTEXPR half_float::half signaling_NaN() HALF_NOTHROW { return half_float::half{half_float::detail::binary, 0x7DFF}; }
30933094

30943095
/// Smallest positive subnormal value.
3095-
static HALF_CONSTEXPR half_float::half denorm_min() HALF_NOTHROW { return half_float::half(half_float::detail::binary, 0x0001); }
3096+
static HALF_CONSTEXPR half_float::half denorm_min() HALF_NOTHROW { return half_float::half{half_float::detail::binary, 0x0001}; }
30963097
};
30973098

30983099

CMakeLists.txt

+3-3
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ endif()
5252

5353
caffe_option(BUILD_SHARED_LIBS "Build shared libraries" ON)
5454
caffe_option(BUILD_python "Build Python wrapper" ON)
55-
set(python_version "2" CACHE STRING "Specify which Python version to use")
55+
set(python_version "3" CACHE STRING "Specify which Python version to use")
5656
caffe_option(BUILD_matlab "Build Matlab wrapper" OFF IF UNIX OR APPLE)
5757
caffe_option(BUILD_docs "Build documentation" ON IF UNIX OR APPLE)
5858
caffe_option(BUILD_python_layer "Build the Caffe Python layer" ON)
@@ -73,7 +73,7 @@ include(cmake/Dependencies.cmake)
7373

7474
# ---[ Flags
7575
if(UNIX OR APPLE)
76-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -Wall -std=c++11")
76+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -Wall -std=c++14")
7777
endif()
7878

7979
caffe_set_caffe_link()
@@ -114,7 +114,7 @@ add_custom_target(lint COMMAND ${CMAKE_COMMAND} -P ${PROJECT_SOURCE_DIR}/cmake/l
114114
# ---[ pytest target
115115
if(BUILD_python)
116116
add_custom_target(pytest COMMAND python${python_version} -m unittest discover -s caffe/test WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/python )
117-
add_dependencies(pytest pycaffe)
117+
# add_dependencies(pytest pycaffe)
118118
endif()
119119

120120
# ---[ Configuration summary

Makefile

+7-5
Original file line numberDiff line numberDiff line change
@@ -27,25 +27,27 @@ endif
2727
THIRDPARTY_DIR := ./3rdparty
2828

2929
# All of the directories containing code.
30-
SRC_DIRS := $(shell find * -type d -exec bash -c "find {} -maxdepth 1 \
30+
SRC_DIRS := $(shell find src python tools examples -type d -exec bash -c "find {} -maxdepth 1 \
3131
\( -name '*.cpp' -o -name '*.proto' \) | grep -q ." \; -print 2>/dev/null)
3232

33+
3334
# The target shared library name
3435
LIBRARY_NAME := $(PROJECT)$(LIBRARY_NAME_SUFFIX)
3536
LIB_BUILD_DIR := $(BUILD_DIR)/lib
3637
STATIC_NAME := $(LIB_BUILD_DIR)/lib$(LIBRARY_NAME).a
3738
DYNAMIC_VERSION_MAJOR := 0
3839
DYNAMIC_VERSION_MINOR := 17
39-
DYNAMIC_VERSION_REVISION := 3
40+
DYNAMIC_VERSION_REVISION := 4
4041
DYNAMIC_NAME_SHORT := lib$(LIBRARY_NAME).so
4142
DYNAMIC_SONAME_SHORT := $(DYNAMIC_NAME_SHORT).$(DYNAMIC_VERSION_MAJOR).$(DYNAMIC_VERSION_MINOR)
4243
DYNAMIC_VERSIONED_NAME_SHORT := $(DYNAMIC_SONAME_SHORT).$(DYNAMIC_VERSION_REVISION)
4344
DYNAMIC_NAME := $(LIB_BUILD_DIR)/$(DYNAMIC_VERSIONED_NAME_SHORT)
4445
COMMON_FLAGS += -DCAFFE_VERSION=$(DYNAMIC_VERSION_MAJOR).$(DYNAMIC_VERSION_MINOR).$(DYNAMIC_VERSION_REVISION)
45-
# NVCaffe requires C++ 11
46-
COMMON_FLAGS += -std=c++11
46+
# NVCaffe requires C++ 14
47+
COMMON_FLAGS += -std=c++14
4748
COMMON_FLAGS += -DCUDA_NO_HALF
4849

50+
4951
##############################
5052
# Get all source files
5153
##############################
@@ -179,7 +181,7 @@ CUDA_LIB_DIR :=
179181
# add <cuda>/lib64 only if it exists
180182
ifneq ("$(wildcard $(CUDA_DIR)/lib64)","")
181183
CUDA_LIB_DIR += $(CUDA_DIR)/lib64
182-
CUDA_LIB_DIR += /usr/lib/nvidia-410 /usr/lib/nvidia-418 /usr/lib/nvidia-396 /usr/lib/nvidia-390 /usr/lib/nvidia-387 /usr/lib/nvidia-384 /usr/lib/nvidia-381 /usr/lib/nvidia-375 /usr/lib/nvidia-367 /usr/lib/nvidia-361 /usr/lib/nvidia-352
184+
CUDA_LIB_DIR += /usr/lib/nvidia-440 /usr/lib/nvidia-410 /usr/lib/nvidia-418 /usr/lib/nvidia-396 /usr/lib/nvidia-390 /usr/lib/nvidia-387 /usr/lib/nvidia-384 /usr/lib/nvidia-381 /usr/lib/nvidia-375 /usr/lib/nvidia-367 /usr/lib/nvidia-361 /usr/lib/nvidia-352
183185
endif
184186
CUDA_LIB_DIR += $(CUDA_DIR)/lib
185187

Makefile.config.example

+6-6
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ BLAS_LIB := /opt/OpenBLAS/lib/
5959

6060
# NOTE: this is required only if you will compile the python interface.
6161
# We need to be able to find Python.h and numpy/arrayobject.h.
62-
PYTHON_INCLUDE := /usr/include/python2.7 \
63-
/usr/lib/python2.7/dist-packages/numpy/core/include
62+
#PYTHON_INCLUDE := /usr/include/python2.7 \
63+
# /usr/lib/python2.7/dist-packages/numpy/core/include
6464
# Anaconda Python distribution is quite popular. Include path:
6565
# Verify anaconda location, sometimes it's in root.
6666
# ANACONDA_HOME := $(HOME)/anaconda
@@ -69,9 +69,9 @@ PYTHON_INCLUDE := /usr/include/python2.7 \
6969
# $(ANACONDA_HOME)/lib/python2.7/site-packages/numpy/core/include \
7070

7171
# Uncomment to use Python 3 (default is Python 2)
72-
# PYTHON_LIBRARIES := boost_python3 python3.5m
73-
# PYTHON_INCLUDE := /usr/include/python3.5m \
74-
# /usr/lib/python3.5/dist-packages/numpy/core/include
72+
PYTHON_LIBRARIES := boost_python38 python3.8
73+
PYTHON_INCLUDE := /usr/include/python3.8 \
74+
/usr/lib/python3.8/dist-packages/numpy/core/include
7575

7676
# We need to be able to find libpythonX.X.so or .dylib.
7777
PYTHON_LIB := /usr/lib
@@ -82,7 +82,7 @@ PYTHON_LIB := /usr/lib
8282
# PYTHON_LIB += $(shell brew --prefix numpy)/lib
8383

8484
# Uncomment to support layers written in Python (will link against Python libs)
85-
# WITH_PYTHON_LAYER := 1
85+
WITH_PYTHON_LAYER := 1
8686

8787
# Whatever else you find you need goes here.
8888
INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include /usr/include/hdf5/serial

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,6 @@ to your PR.
5353

5454
Libturbojpeg library is used since 0.16.5. It has a packaging bug. Please execute the following (required for Makefile, optional for CMake):
5555
```
56-
sudo apt-get install libturbojpeg
56+
sudo apt-get install libturbojpeg libturbojpeg0-dev
5757
sudo ln -s /usr/lib/x86_64-linux-gnu/libturbojpeg.so.0.1.0 /usr/lib/x86_64-linux-gnu/libturbojpeg.so
5858
```

cmake/Cuda.cmake

+1-1
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ if(USE_CUDNN)
254254
endif()
255255

256256
if(UNIX OR APPLE)
257-
list(APPEND CUDA_NVCC_FLAGS -std=c++11;-Xcompiler;-fPIC)
257+
list(APPEND CUDA_NVCC_FLAGS -std=c++14;-Xcompiler;-fPIC)
258258
endif()
259259

260260
if(APPLE)

cmake/Dependencies.cmake

+2-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,8 @@ if(BUILD_python)
108108
boost_python${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR}
109109
PATHS ${LIBDIR})
110110
if ("${Boost_PYTHON_FOUND}" STREQUAL "Boost_PYTHON_FOUND-NOTFOUND")
111-
message(SEND_ERROR "Could NOT find Boost Python Library")
111+
find_package(Boost 1.65 COMPONENTS "python${python_version}")
112+
set(Boost_PYTHON_FOUND ${Boost_PYTHON${python_version}_FOUND})
112113
else()
113114
message(STATUS "Found Boost Python Library ${Boost_PYTHON_FOUND}")
114115
list(APPEND Caffe_LINKER_LIBS ${Boost_PYTHON_FOUND})

cmake/Misc.cmake

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
2929
endif()
3030

3131
# ---[ RPATH settings
32-
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE CACHE BOOLEAN "Use link paths for shared library rpath")
32+
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH ON CACHE BOOLEAN "Use link paths for shared library rpath")
3333
set(CMAKE_MACOSX_RPATH TRUE)
3434

3535
list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES ${CMAKE_INSTALL_PREFIX}/lib __is_systtem_dir)

examples/web_demo/requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ flask
33
tornado
44
numpy
55
pandas
6-
pillow=>6.2.0
6+
pillow>=6.2.0
77
pyyaml

0 commit comments

Comments
 (0)