Skip to content

Commit 212162b

Browse files
committed
fix conflicts
2 parents 70e206e + 2368ca8 commit 212162b

File tree

9 files changed

+508
-78
lines changed

9 files changed

+508
-78
lines changed

CMakeLists.txt

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,7 @@ option(ON_TRAVIS "Running test on travis-ci or not." OFF)
5151
option(ON_COVERALLS "Generating code coverage data on coveralls or not." OFF)
5252
option(COVERALLS_UPLOAD "Uploading the generated coveralls json." ON)
5353

54-
if(NOT CMAKE_BUILD_TYPE)
55-
set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
56-
"Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel"
57-
FORCE)
58-
endif()
5954

60-
include(enableCXX11)
6155
include(cpplint)
6256
include(ccache)
6357
if(WITH_RDMA)
@@ -83,18 +77,13 @@ if(NOT WITH_GPU)
8377

8478
list(APPEND CMAKE_CXX_SOURCE_FILE_EXTENSIONS cu)
8579
else()
86-
if(${CUDA_VERSION_MAJOR} GREATER 6)
87-
if(COMPILER_SUPPORT_CXX11)
88-
LIST(APPEND CUDA_NVCC_FLAGS -std=c++11)
89-
endif()
80+
if(${CUDA_VERSION_MAJOR} VERSION_LESS 7)
81+
message(FATAL_ERROR "Paddle need CUDA >= 7.0 to compile")
9082
endif()
9183

92-
# TODO(yuyang18): Change it to remove std=c++11 in cuda compile.
93-
set(CUDA_PROPAGATE_HOST_FLAGS OFF)
9484
if(NOT CUDNN_FOUND)
9585
message(FATAL_ERROR "Paddle need cudnn to compile")
9686
endif()
97-
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} "-g -O3 --use_fast_math")
9887

9988
if(WITH_AVX)
10089
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} "-Xcompiler ${AVX_FLAG}")

cmake/enableCXX11.cmake

Lines changed: 0 additions & 13 deletions
This file was deleted.

cmake/flags.cmake

Lines changed: 46 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,37 @@
22
include(CheckCXXCompilerFlag)
33
include(CheckCCompilerFlag)
44
include(CheckCXXSymbolExists)
5+
6+
if(NOT CMAKE_BUILD_TYPE)
7+
set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
8+
"Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel"
9+
FORCE)
10+
endif()
11+
12+
function(CheckCompilerCXX11Flag)
13+
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
14+
if(${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS 4.8)
15+
message(FATAL_ERROR "Unsupported GCC version. GCC >= 4.8 required.")
16+
endif()
17+
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
18+
# cmake >= 3.0 compiler id "AppleClang" on Mac OS X, otherwise "Clang"
19+
# Apple Clang is a different compiler than upstream Clang which havs different version numbers.
20+
# https://gist.github.com/yamaya/2924292
21+
if(APPLE) # cmake < 3.0 compiler id "Clang" on Mac OS X
22+
if(${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS 5.1)
23+
message(FATAL_ERROR "Unsupported AppleClang version. AppleClang >= 5.1 required.")
24+
endif()
25+
else()
26+
if (${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS 3.3)
27+
message(FATAL_ERROR "Unsupported Clang version. Clang >= 3.3 required.")
28+
endif()
29+
endif()
30+
endif()
31+
endfunction()
32+
33+
CheckCompilerCXX11Flag()
34+
LIST(APPEND CMAKE_CXX_FLAGS -std=c++11)
35+
536
# safe_set_flag
637
#
738
# Set a compile flag only if compiler is support
@@ -41,9 +72,7 @@ macro(safe_set_nvflag flag_name)
4172
CHECK_C_COMPILER_FLAG(${flag_name} C_COMPILER_SUPPORT_FLAG_${safe_name})
4273
set(safe_name C_COMPILER_SUPPORT_FLAG_${safe_name})
4374
if(${safe_name})
44-
set(CUDA_NVCC_FLAGS
45-
--compiler-options;${flag_name}
46-
${CUDA_NVCC_FLAGS})
75+
LIST(APPEND CUDA_NVCC_FLAGS -Xcompiler ${flag_name})
4776
endif()
4877
endmacro()
4978

@@ -109,8 +138,22 @@ foreach(flag ${GPU_COMMON_FLAGS})
109138
endforeach()
110139

111140

141+
set(CUDA_PROPAGATE_HOST_FLAGS OFF)
142+
112143
# Release/Debug flags set by cmake. Such as -O3 -g -DNDEBUG etc.
113144
# So, don't set these flags here.
145+
LIST(APPEND CUDA_NVCC_FLAGS -std=c++11)
146+
LIST(APPEND CUDA_NVCC_FLAGS --use_fast_math)
147+
148+
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
149+
LIST(APPEND CUDA_NVCC_FLAGS ${CMAKE_CXX_FLAGS_DEBUG})
150+
elseif(CMAKE_BUILD_TYPE STREQUAL "Release")
151+
LIST(APPEND CUDA_NVCC_FLAGS ${CMAKE_CXX_FLAGS_RELEASE})
152+
elseif(CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
153+
LIST(APPEND CUDA_NVCC_FLAGS ${CMAKE_CXX_FLAGS_RELWITHDEBINFO})
154+
elseif(CMAKE_BUILD_TYPE STREQUAL "MinSizeRel")
155+
LIST(APPEND CUDA_NVCC_FLAGS ${CMAKE_CXX_FLAGS_MINSIZEREL})
156+
endif()
114157

115158
function(specify_cuda_arch cuda_version cuda_arch)
116159
if(${cuda_version} VERSION_GREATER "8.0")

doc/getstarted/build_and_install/build_from_source.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,16 @@ git submodule update --init --recursive
1616

1717
## <span id="requirements">Requirements</span>
1818

19-
To compile the source code, your computer must be equipped with GCC >=4.6 or Clang compiler.
20-
### Dependencies
19+
To compile the source code, your computer must be equipped with the following dependencies.
2120

21+
- **Compiler**: GCC >= 4.8 or Clang >= 3.3 (AppleClang >= 5.1)
2222
- **CMake**: version >= 2.8
2323
- **BLAS**: MKL, OpenBlas or ATLAS
24-
- **protobuf**: version >= 2.4, **Note: 3.x is not supported**
25-
- **python**: only python 2.7 is supported currently
24+
- **Protocol Buffers**: version >= 2.4, **Note: 3.x is not supported**
25+
- **Python**: only python 2.7 is supported currently
26+
27+
**Note:** For CUDA 7.0 and CUDA 7.5, GCC 5.0 and up are not supported!
28+
For CUDA 8.0, GCC versions later than 5.3 are not supported!
2629

2730
### Options
2831

@@ -50,8 +53,8 @@ PaddlePaddle supports some build options. To enable it, first you need to instal
5053
</html>
5154

5255
**Note:**
53-
- The GPU version works best with Cuda Toolkit 7.5 and cuDNN v5.
54-
- Other versions like Cuda Toolkit 6.5, 7.0, 8.0 and cuDNN v2, v3, v4 are also supported.
56+
- The GPU version works best with Cuda Toolkit 8.0 and cuDNN v5.
57+
- Other versions like Cuda Toolkit 7.0, 7.5 and cuDNN v3, v4 are also supported.
5558
- **To utilize cuDNN v5, Cuda Toolkit 7.5 is prerequisite and vice versa.**
5659

5760
As a simple example, consider the following:

0 commit comments

Comments
 (0)