未验证 提交 1f74b94d 编写于 作者: Z Zhou Wei 提交者: GitHub

fix compile warning on windows MSVC, fix paddle_build.bat more safe (#25933)

* Fixed compile warning about incorrect compile options,fix paddle_build.bat

* fix paddle_build.bat to more safe
上级 c14ec878
...@@ -202,6 +202,11 @@ if (NOT WIN32) # windows msvc2015 support c++11 natively. ...@@ -202,6 +202,11 @@ if (NOT WIN32) # windows msvc2015 support c++11 natively.
set(CMAKE_CUDA_STANDARD 11) set(CMAKE_CUDA_STANDARD 11)
endif(NOT WIN32) endif(NOT WIN32)
# (Note) For windows, if delete /W[1-4], /W1 will be added defaultly and conflic with -w
# So replace /W[1-4] with /W0
if (WIN32)
string(REGEX REPLACE "/W[1-4]" " /W0 " CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS}")
endif(WIN32)
# in cuda9, suppress cuda warning on eigen # in cuda9, suppress cuda warning on eigen
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -w") set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -w")
# Set :expt-relaxed-constexpr to suppress Eigen warnings # Set :expt-relaxed-constexpr to suppress Eigen warnings
......
...@@ -232,7 +232,9 @@ if(WIN32) ...@@ -232,7 +232,9 @@ if(WIN32)
CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO
CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO) CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO)
string(REGEX REPLACE "(^| )/W[0-9]( |$)" " " ${flag_var} "${${flag_var}}") string(REGEX REPLACE "/W[1-4]" " /W0 " ${flag_var} "${${flag_var}}")
set(flag_var "${flag_var} /w") endforeach(flag_var)
foreach(flag_var CMAKE_CXX_FLAGS CMAKE_C_FLAGS)
set(${flag_var} "${${flag_var}} /w")
endforeach(flag_var) endforeach(flag_var)
endif() endif()
# Attention: cmake will append these flags to compile command automatically. # Attention: cmake will append these flags to compile command automatically.
# So if you want to add global option, change this file rather than flags.cmake # So if you want to add global option, change this file rather than flags.cmake
# default: "-g" # NOT WIN32
set(CMAKE_C_FLAGS_DEBUG "-g") # DEBUG: default: "-g"
# default: "-O3 -DNDEBUG" # RELEASE: default: "-O3 -DNDEBUG"
set(CMAKE_C_FLAGS_RELEASE "-O3 -DNDEBUG") # RELWITHDEBINFO: default: "-O2 -g -DNDEBUG"
# default: "-O2 -g -DNDEBUG" # MINSIZEREL: default: "-O2 -g -DNDEBUG"
set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -g -DNDEBUG")
# default: "-Os -DNDEBUG" if(NOT WIN32)
set(CMAKE_C_FLAGS_MINSIZEREL "-Os -DNDEBUG") set(CMAKE_C_FLAGS_DEBUG "-g")
set(CMAKE_C_FLAGS_RELEASE "-O3 -DNDEBUG")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -g -DNDEBUG")
set(CMAKE_C_FLAGS_MINSIZEREL "-Os -DNDEBUG")
set(CMAKE_CXX_FLAGS_DEBUG "-g")
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g -DNDEBUG")
set(CMAKE_CXX_FLAGS_MINSIZEREL "-Os -DNDEBUG")
endif()
if(WITH_GPU)
set(CMAKE_CUDA_FLAGS_DEBUG "-g")
set(CMAKE_CUDA_FLAGS_RELEASE "-O3 -DNDEBUG")
set(CMAKE_CUDA_FLAGS_RELWITHDEBINFO "-O2 -g -DNDEBUG")
set(CMAKE_CUDA_FLAGS_MINSIZEREL "-O1 -DNDEBUG")
endif()
# default: "-g"
set(CMAKE_CXX_FLAGS_DEBUG "-g")
# default: "-O3 -DNDEBUG"
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG")
# default: "-O2 -g -DNDEBUG"
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g -DNDEBUG")
# default: "-Os -DNDEBUG"
set(CMAKE_CXX_FLAGS_MINSIZEREL "-Os -DNDEBUG")
# default: "-g"
set(CMAKE_CUDA_FLAGS_DEBUG "-g")
# default: "-O3 -DNDEBUG"
set(CMAKE_CUDA_FLAGS_RELEASE "-O3 -DNDEBUG")
# default: "-O2 -g -DNDEBUG"
set(CMAKE_CUDA_FLAGS_RELWITHDEBINFO "-O2 -g -DNDEBUG")
# default: "-O1 -DNDEBUG"
set(CMAKE_CUDA_FLAGS_MINSIZEREL "-O1 -DNDEBUG")
@ECHO OFF @ECHO OFF
SETLOCAL SETLOCAL
rem Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
rem
rem Licensed under the Apache License, Version 2.0 (the "License");
rem you may not use this file except in compliance with the License.
rem You may obtain a copy of the License at
rem
rem http://www.apache.org/licenses/LICENSE-2.0
rem
rem Unless required by applicable law or agreed to in writing, software
rem distributed under the License is distributed on an "AS IS" BASIS,
rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
rem See the License for the specific language governing permissions and
rem limitations under the License.
rem =================================================
rem Paddle CI Task On Windows Platform
rem =================================================
set work_dir=%cd% set work_dir=%cd%
if not defined BRANCH set BRANCH=develop if not defined BRANCH set BRANCH=develop
if not defined PYTHON_ROOT set PYTHON_ROOT=c:\Python27 if not defined PYTHON_ROOT set PYTHON_ROOT=c:\Python27
...@@ -40,6 +59,11 @@ call :build || goto build_error ...@@ -40,6 +59,11 @@ call :build || goto build_error
call :test_whl_pacakage || goto test_whl_pacakage_error call :test_whl_pacakage || goto test_whl_pacakage_error
goto:success goto:success
rem "Other configurations are added here"
rem :CASE_wincheck_others
rem call ...
rem --------------------------------------------------------------------------------------------- rem ---------------------------------------------------------------------------------------------
:cmake :cmake
echo ======================================== echo ========================================
...@@ -114,14 +138,15 @@ echo ======================================== ...@@ -114,14 +138,15 @@ echo ========================================
echo Step 4. Running unit tests ... echo Step 4. Running unit tests ...
echo ======================================== echo ========================================
%PYTHON_EXECUTABLE% -m pip install --upgrade pip %PYTHON_EXECUTABLE% -m pip install --upgrade pip
dir %work_dir%\build\third_party\install\openblas\lib
dir %work_dir%\build\third_party\install\openblas\bin dir %THIRD_PARTY_PATH:/=\%\install\openblas\lib
dir %work_dir%\build\third_party\install\zlib\bin dir %THIRD_PARTY_PATH:/=\%\install\openblas\bin
dir %work_dir%\build\third_party\install\mklml\lib dir %THIRD_PARTY_PATH:/=\%\install\zlib\bin
dir %work_dir%\build\third_party\install\mkldnn\bin dir %THIRD_PARTY_PATH:/=\%\install\mklml\lib
dir %work_dir%\build\third_party\install\warpctc\bin dir %THIRD_PARTY_PATH:/=\%\install\mkldnn\bin
dir %THIRD_PARTY_PATH:/=\%\install\warpctc\bin
set PATH=%work_dir%\build\third_party\install\openblas\lib;%work_dir%\build\third_party\install\openblas\bin;%work_dir%\build\third_party\install\zlib\bin;%work_dir%\build\third_party\install\mklml\lib;%work_dir%\build\third_party\install\mkldnn\bin;%work_dir%\build\third_party\install\warpctc\bin;%PATH%
set PATH=%THIRD_PARTY_PATH:/=\%\install\openblas\lib;%THIRD_PARTY_PATH:/=\%\install\openblas\bin;%THIRD_PARTY_PATH:/=\%\install\zlib\bin;%THIRD_PARTY_PATH:/=\%\install\mklml\lib;%THIRD_PARTY_PATH:/=\%\install\mkldnn\bin;%THIRD_PARTY_PATH:/=\%\install\warpctc\bin;%PATH%
ctest.exe --output-on-failure -C Release -j 10 ctest.exe --output-on-failure -C Release -j 10
goto:eof goto:eof
...@@ -164,7 +189,7 @@ echo ============================================ >> check_change_of_unitte ...@@ -164,7 +189,7 @@ echo ============================================ >> check_change_of_unitte
echo Generate unit tests.spec of this PR. >> check_change_of_unittest.sh echo Generate unit tests.spec of this PR. >> check_change_of_unittest.sh
echo ============================================ >> check_change_of_unittest.sh echo ============================================ >> check_change_of_unittest.sh
echo EOF>> check_change_of_unittest.sh echo EOF>> check_change_of_unittest.sh
echo spec_path=$(pwd)/../paddle/fluid/UNITTEST_PR.spec>> check_change_of_unittest.sh echo spec_path=$(pwd)/UNITTEST_PR.spec>> check_change_of_unittest.sh
echo ctest -N ^| awk -F ':' '{print $2}' ^| sed '/^^$/d' ^| sed '$d' ^> ${spec_path}>> check_change_of_unittest.sh echo ctest -N ^| awk -F ':' '{print $2}' ^| sed '/^^$/d' ^| sed '$d' ^> ${spec_path}>> check_change_of_unittest.sh
echo UPSTREAM_URL='https://github.com/PaddlePaddle/Paddle'>> check_change_of_unittest.sh echo UPSTREAM_URL='https://github.com/PaddlePaddle/Paddle'>> check_change_of_unittest.sh
echo origin_upstream_url=`git remote -v ^| awk '{print $1, $2}' ^| uniq ^| grep upstream ^| awk '{print $2}'`>> check_change_of_unittest.sh echo origin_upstream_url=`git remote -v ^| awk '{print $1, $2}' ^| uniq ^| grep upstream ^| awk '{print $2}'`>> check_change_of_unittest.sh
...@@ -179,16 +204,16 @@ echo if [ ! -e "$(pwd)/../.git/refs/remotes/upstream/$BRANCH" ]; then>> check_c ...@@ -179,16 +204,16 @@ echo if [ ! -e "$(pwd)/../.git/refs/remotes/upstream/$BRANCH" ]; then>> check_c
echo git fetch upstream $BRANCH # develop is not fetched>> check_change_of_unittest.sh echo git fetch upstream $BRANCH # develop is not fetched>> check_change_of_unittest.sh
echo fi>> check_change_of_unittest.sh echo fi>> check_change_of_unittest.sh
echo git checkout -b origin_pr >> check_change_of_unittest.sh echo git checkout -b origin_pr >> check_change_of_unittest.sh
echo git checkout -b test_pr -t upstream/$BRANCH >> check_change_of_unittest.sh echo git checkout -f $BRANCH >> check_change_of_unittest.sh
echo cmake .. -G "Visual Studio 14 2015 Win64" -DWITH_AVX=%WITH_AVX% -DWITH_GPU=%WITH_GPU% -DWITH_MKL=%WITH_MKL% -DPYTHON_EXECUTABLE=%PYTHON_EXECUTABLE:\=\\% -DWITH_TESTING=%WITH_TESTING% -DWITH_PYTHON=%WITH_PYTHON% -DCUDA_TOOLKIT_ROOT_DIR="C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v10.0" -DON_INFER=%ON_INFER% -DTHIRD_PARTY_PATH=%THIRD_PARTY_PATH% >> check_change_of_unittest.sh echo cmake .. -G "Visual Studio 14 2015 Win64" -DWITH_AVX=%WITH_AVX% -DWITH_GPU=%WITH_GPU% -DWITH_MKL=%WITH_MKL% -DPYTHON_EXECUTABLE=%PYTHON_EXECUTABLE:\=\\% -DWITH_TESTING=%WITH_TESTING% -DWITH_PYTHON=%WITH_PYTHON% -DCUDA_TOOLKIT_ROOT_DIR="C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v10.0" -DON_INFER=%ON_INFER% -DTHIRD_PARTY_PATH=%THIRD_PARTY_PATH% >> check_change_of_unittest.sh
echo cat ^<^<EOF>> check_change_of_unittest.sh echo cat ^<^<EOF>> check_change_of_unittest.sh
echo ============================================ >> check_change_of_unittest.sh echo ============================================ >> check_change_of_unittest.sh
echo Generate unit tests.spec of develop. >> check_change_of_unittest.sh echo Generate unit tests.spec of develop. >> check_change_of_unittest.sh
echo ============================================ >> check_change_of_unittest.sh echo ============================================ >> check_change_of_unittest.sh
echo EOF>> check_change_of_unittest.sh echo EOF>> check_change_of_unittest.sh
echo spec_path=$(pwd)/../paddle/fluid/UNITTEST_DEV.spec>> check_change_of_unittest.sh echo spec_path=$(pwd)/UNITTEST_DEV.spec>> check_change_of_unittest.sh
echo ctest -N ^| awk -F ':' '{print $2}' ^| sed '/^^$/d' ^| sed '$d' ^> ${spec_path}>> check_change_of_unittest.sh echo ctest -N ^| awk -F ':' '{print $2}' ^| sed '/^^$/d' ^| sed '$d' ^> ${spec_path}>> check_change_of_unittest.sh
echo unittest_spec_diff=`python $(pwd)/../tools/diff_unittest.py $(pwd)/../paddle/fluid/UNITTEST_DEV.spec $(pwd)/../paddle/fluid/UNITTEST_PR.spec`>> check_change_of_unittest.sh echo unittest_spec_diff=`python $(pwd)/../tools/diff_unittest.py $(pwd)/UNITTEST_DEV.spec $(pwd)/UNITTEST_PR.spec`>> check_change_of_unittest.sh
echo if [ "$unittest_spec_diff" != "" ]; then>> check_change_of_unittest.sh echo if [ "$unittest_spec_diff" != "" ]; then>> check_change_of_unittest.sh
echo # approval_user_list: XiaoguangHu01 46782768,luotao1 6836917,phlrain 43953930,lanxianghit 47554610, zhouwei25 52485244, kolinwei 22165420>> check_change_of_unittest.sh echo # approval_user_list: XiaoguangHu01 46782768,luotao1 6836917,phlrain 43953930,lanxianghit 47554610, zhouwei25 52485244, kolinwei 22165420>> check_change_of_unittest.sh
echo approval_line=`curl -H "Authorization: token ${GITHUB_API_TOKEN}" https://api.github.com/repos/PaddlePaddle/Paddle/pulls/${GIT_PR_ID}/reviews?per_page=10000`>> check_change_of_unittest.sh echo approval_line=`curl -H "Authorization: token ${GITHUB_API_TOKEN}" https://api.github.com/repos/PaddlePaddle/Paddle/pulls/${GIT_PR_ID}/reviews?per_page=10000`>> check_change_of_unittest.sh
...@@ -210,7 +235,7 @@ echo else>> check_change_of_unittest.sh ...@@ -210,7 +235,7 @@ echo else>> check_change_of_unittest.sh
echo exit 1 >> check_change_of_unittest.sh echo exit 1 >> check_change_of_unittest.sh
echo fi>> check_change_of_unittest.sh echo fi>> check_change_of_unittest.sh
echo fi>> check_change_of_unittest.sh echo fi>> check_change_of_unittest.sh
echo git checkout origin_pr >> check_change_of_unittest.sh echo git checkout -f origin_pr >> check_change_of_unittest.sh
d:\.cache\tools\busybox64.exe bash check_change_of_unittest.sh d:\.cache\tools\busybox64.exe bash check_change_of_unittest.sh
goto:eof goto:eof
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册