-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Upgrade compiler‘s minimum version #728
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
* for modern language properties
# Enable C++ 11 for GCC. | ||
# NOTE: It's only tested for gcc. | ||
include(CheckCXXCompilerFlag) | ||
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORT_CXX11) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
去掉这个部分,用explicit的编译器版本号来支持c++11
if(${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS 4.8) | ||
message(FATAL_ERROR "Unsupported GCC version. GCC >= 4.8 required.") | ||
endif() | ||
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mac AppleClang和Clang的版本号还不一样,需要区分一下。
@@ -111,6 +140,17 @@ endforeach() | |||
|
|||
# Release/Debug flags set by cmake. Such as -O3 -g -DNDEBUG etc. | |||
# So, don't set these flags here. | |||
LIST(APPEND CUDA_NVCC_FLAGS --use_fast_math) | |||
|
|||
if(CMAKE_BUILD_TYPE STREQUAL "Debug") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
使得nvcc flag 与 paddle build type一致
@@ -22,9 +22,6 @@ set(CUDA_CXX_WITH_GPU_SOURCES | |||
set_source_files_properties(${CUDA_CXX_WITH_GPU_SOURCES} | |||
PROPERTIES COMPILE_FLAGS "-D__NVCC__") | |||
|
|||
set_source_files_properties(${AVX_SOURCES} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个flags已经设置过了,去掉
set(CUDA_NVCC_FLAGS | ||
--compiler-options;${flag_name} | ||
${CUDA_NVCC_FLAGS}) | ||
LIST(APPEND CUDA_NVCC_FLAGS -Xcompiler ${flag_name}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-Xcompiler 和 --compiler-options是一个意思,Paddle统一用-Xcompiler
@@ -84,17 +78,14 @@ if(NOT WITH_GPU) | |||
list(APPEND CMAKE_CXX_SOURCE_FILE_EXTENSIONS cu) | |||
else() | |||
if(${CUDA_VERSION_MAJOR} GREATER 6) | |||
if(COMPILER_SUPPORT_CXX11) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
已经限制了最低版本,所以COMPILER_SUPPORT_CXX11不需要了
@@ -51,13 +51,7 @@ option(ON_TRAVIS "Running test on travis-ci or not." OFF) | |||
option(ON_COVERALLS "Generating code coverage data on coveralls or not." OFF) | |||
option(COVERALLS_UPLOAD "Uploading the generated coveralls json." ON) | |||
|
|||
if(NOT CMAKE_BUILD_TYPE) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
移到flags.cmake,使得首目录CmakeLists 更加concise
@@ -84,17 +78,14 @@ if(NOT WITH_GPU) | |||
list(APPEND CMAKE_CXX_SOURCE_FILE_EXTENSIONS cu) | |||
else() | |||
if(${CUDA_VERSION_MAJOR} GREATER 6) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nvcc应该是大于等于7.0版本
@@ -84,17 +78,14 @@ if(NOT WITH_GPU) | |||
list(APPEND CMAKE_CXX_SOURCE_FILE_EXTENSIONS cu) | |||
else() | |||
if(${CUDA_VERSION_MAJOR} GREATER 6) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nvcc应该是大于等于7.0版本
### Dependencies | ||
|
||
- **Compiler**: GCC >= 4.8 or Clang >= 3.3 (AppleClang >= 5.1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
另外注明一下编译GPU版本,nvcc >= 7.0 gcc 4.8。
nvcc对gcc的支持好像只到4.8还是4.9。5.0以上的我记得是还不支持的。
### Dependencies | ||
|
||
- **Compiler**: GCC >= 4.8 or Clang >= 3.3 (AppleClang >= 5.1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gangliao In PR #723, I am making Dockerfile installs clang, which is used by woboq code browser to convert Paddle C++ code into browsable HTML files. Because I was doing incremental changes to Dockerfile, it installs both GCC and Clang.
Should I make it installs just Clang (>3.3)? I checked that the Clang package of Ubuntu 14:04 installs Clang 3.4 by default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, Clang is supported in PaddlePaddle. Clang 3.4 is also supported by the latest CUDA Toolkits.
@@ -15,13 +15,15 @@ cd paddle | |||
|
|||
## <span id="requirements">Requirements</span> | |||
|
|||
To compile the source code, your computer must be equipped with GCC >=4.6 or Clang compiler. | |||
To compile the source code, your computer must be equipped with the following dependencies. | |||
|
|||
### Dependencies |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given above section named "Requirements", it seems that we don't need this sub-section title "Dependencies"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, Also Fix #415
Co-authored-by: Aniket Shivam <ashivam@nvidia.com>
Upgrade compiler‘s minimum version to support modern language properties.
Fix #694