Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
4d6d2db8
P
Paddle
项目概览
PaddlePaddle
/
Paddle
大约 1 年 前同步成功
通知
2298
Star
20931
Fork
5422
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1423
列表
看板
标记
里程碑
合并请求
543
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1,423
Issue
1,423
列表
看板
标记
里程碑
合并请求
543
合并请求
543
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
4d6d2db8
编写于
3月 04, 2021
作者:
W
wuhuanzhou
提交者:
GitHub
3月 04, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Windows system supports Ninja compilation (#31161)
上级
0fff9306
变更
9
展开全部
显示空白变更内容
内联
并排
Showing
9 changed file
with
1309 addition
and
25 deletion
+1309
-25
cmake/external/cryptopp.cmake
cmake/external/cryptopp.cmake
+8
-0
cmake/external/protobuf.cmake
cmake/external/protobuf.cmake
+3
-0
cmake/generic.cmake
cmake/generic.cmake
+4
-3
cmake/inference_lib.cmake
cmake/inference_lib.cmake
+5
-5
cmake/third_party.cmake
cmake/third_party.cmake
+2
-1
paddle/fluid/framework/CMakeLists.txt
paddle/fluid/framework/CMakeLists.txt
+15
-5
paddle/fluid/pybind/CMakeLists.txt
paddle/fluid/pybind/CMakeLists.txt
+10
-5
paddle/scripts/paddle_build.bat
paddle/scripts/paddle_build.bat
+23
-6
patches/cryptopp/CMakeLists.txt
patches/cryptopp/CMakeLists.txt
+1239
-0
未找到文件。
cmake/external/cryptopp.cmake
浏览文件 @
4d6d2db8
...
...
@@ -22,6 +22,13 @@ SET(CRYPTOPP_TAG CRYPTOPP_8_2_0)
IF
(
WIN32
)
SET
(
CRYPTOPP_LIBRARIES
"
${
CRYPTOPP_INSTALL_DIR
}
/lib/cryptopp-static.lib"
CACHE FILEPATH
"cryptopp library."
FORCE
)
# There is a compilation parameter 'FI\"winapifamily.h\"' can't be used correctly
# with Ninja on Windows. The only difference between the patch file and original
# file is that the compilation parameters are changed to 'FIwinapifamily.h'. This
# patch command can be removed when upgrading to a higher version.
if
(
"
${
CMAKE_GENERATOR
}
"
STREQUAL
"Ninja"
)
set
(
CRYPTOPP_PATCH_COMMAND
${
CMAKE_COMMAND
}
-E copy_if_different
"
${
PADDLE_SOURCE_DIR
}
/patches/cryptopp/CMakeLists.txt"
"<SOURCE_DIR>/"
)
endif
()
ELSE
(
WIN32
)
SET
(
CRYPTOPP_LIBRARIES
"
${
CRYPTOPP_INSTALL_DIR
}
/lib/libcryptopp.a"
CACHE FILEPATH
"cryptopp library."
FORCE
)
ENDIF
(
WIN32
)
...
...
@@ -58,6 +65,7 @@ ExternalProject_Add(
COMMAND git clone
${
GIT_URL
}
/noloader/cryptopp-cmake
"<SOURCE_DIR>/cmake"
COMMAND cd
"<SOURCE_DIR>/cmake"
&& git checkout tags/
${
CRYPTOPP_TAG
}
-b
${
CRYPTOPP_TAG
}
COMMAND
${
CMAKE_COMMAND
}
-E copy_directory
"<SOURCE_DIR>/cmake/"
"<SOURCE_DIR>/"
COMMAND
${
CRYPTOPP_PATCH_COMMAND
}
INSTALL_DIR
${
CRYPTOPP_INSTALL_DIR
}
CMAKE_ARGS
${
CRYPTOPP_CMAKE_ARGS
}
CMAKE_CACHE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=
${
CRYPTOPP_INSTALL_DIR
}
...
...
cmake/external/protobuf.cmake
浏览文件 @
4d6d2db8
...
...
@@ -250,5 +250,8 @@ IF(NOT PROTOBUF_FOUND)
SET
(
PROTOBUF_PROTOC_EXECUTABLE
${
extern_protobuf_PROTOC_EXECUTABLE
}
CACHE FILEPATH
"protobuf executable."
FORCE
)
# `EXTERN_PROTOBUF_DEPEND` used in cmake function `proto_library` to ensure
# `protoc.exe` existed before calling it.
set
(
EXTERN_PROTOBUF_DEPEND extern_protobuf
)
PROMPT_PROTOBUF_LIB
(
extern_protobuf
)
ENDIF
(
NOT PROTOBUF_FOUND
)
cmake/generic.cmake
浏览文件 @
4d6d2db8
...
...
@@ -260,8 +260,8 @@ function(merge_static_libs TARGET_NAME)
# msvc will put libarary in directory of "/Release/xxxlib" by default
# COMMAND cmake -E remove "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}/${TARGET_NAME}.lib"
add_custom_command
(
TARGET
${
TARGET_NAME
}
POST_BUILD
COMMAND cmake -E make_directory
"
${
CMAKE_CURRENT_BINARY_DIR
}
/
${
CMAKE_BUILD_TYPE
}
"
COMMAND lib /OUT:
$
{
CMAKE_CURRENT_BINARY_DIR
}
/
${
CMAKE_BUILD_TYPE
}
/lib
${
TARGET_NAME
}
.lib
${
libfiles
}
COMMAND cmake -E make_directory
$<TARGET_FILE_DIR:
${
TARGET_NAME
}
>
COMMAND lib /OUT:$
<TARGET_FILE:
${
TARGET_NAME
}
>
${
libfiles
}
)
endif
(
WIN32
)
endfunction
(
merge_static_libs
)
...
...
@@ -755,7 +755,8 @@ function(paddle_protobuf_generate_cpp SRCS HDRS)
COMMAND
${
PROTOBUF_PROTOC_EXECUTABLE
}
-I
${
CMAKE_CURRENT_SOURCE_DIR
}
--cpp_out
"
${
CMAKE_CURRENT_BINARY_DIR
}
"
${
ABS_FIL
}
DEPENDS
${
ABS_FIL
}
protoc
# Set `EXTERN_PROTOBUF_DEPEND` only if need to compile `protoc.exe`.
DEPENDS
${
ABS_FIL
}
${
EXTERN_PROTOBUF_DEPEND
}
COMMENT
"Running C++ protocol buffer compiler on
${
FIL
}
"
VERBATIM
)
endforeach
()
...
...
cmake/inference_lib.cmake
浏览文件 @
4d6d2db8
...
...
@@ -164,11 +164,11 @@ copy_part_of_thrid_party(inference_lib_dist ${PADDLE_INFERENCE_INSTALL_DIR})
set
(
src_dir
"
${
PADDLE_SOURCE_DIR
}
/paddle/fluid"
)
if
(
WIN32
)
if
(
WITH_STATIC_LIB
)
set
(
paddle_inference_lib
$
{
PADDLE_BINARY_DIR
}
/paddle/fluid/inference/
${
CMAKE_BUILD_TYPE
}
/libpaddle_inference.lib
$
{
PADDLE_BINARY_DIR
}
/paddle/fluid/inference/
${
CMAKE_BUILD_TYPE
}
/paddle_inference.*
)
set
(
paddle_inference_lib $
<TARGET_FILE_DIR:paddle_inference>
/libpaddle_inference.lib
$
<TARGET_FILE_DIR:paddle_inference>
/paddle_inference.*
)
else
()
set
(
paddle_inference_lib
$
{
PADDLE_BINARY_DIR
}
/paddle/fluid/inference/
${
CMAKE_BUILD_TYPE
}
/paddle_inference.dll
$
{
PADDLE_BINARY_DIR
}
/paddle/fluid/inference/
${
CMAKE_BUILD_TYPE
}
/paddle_inference.lib
)
set
(
paddle_inference_lib $
<TARGET_FILE_DIR:paddle_inference_shared>
/paddle_inference.dll
$
<TARGET_FILE_DIR:paddle_inference_shared>
/paddle_inference.lib
)
endif
()
copy
(
inference_lib_dist
SRCS
${
src_dir
}
/inference/api/paddle_*.h
${
paddle_inference_lib
}
...
...
@@ -200,7 +200,7 @@ copy_part_of_thrid_party(inference_lib_dist ${PADDLE_INFERENCE_C_INSTALL_DIR})
set
(
src_dir
"
${
PADDLE_SOURCE_DIR
}
/paddle/fluid"
)
if
(
WIN32
)
set
(
paddle_inference_c_lib
$
{
PADDLE_BINARY_DIR
}
/paddle/fluid/inference/capi/
${
CMAKE_BUILD_TYPE
}
/paddle_inference_c.*
)
set
(
paddle_inference_c_lib $
<TARGET_FILE_DIR:paddle_inference_c>
/paddle_inference_c.*
)
else
(
WIN32
)
set
(
paddle_inference_c_lib
${
PADDLE_BINARY_DIR
}
/paddle/fluid/inference/capi/libpaddle_inference_c.*
)
endif
(
WIN32
)
...
...
cmake/third_party.cmake
浏览文件 @
4d6d2db8
...
...
@@ -222,7 +222,7 @@ if(WITH_MKLDNN)
endif
()
include
(
external/protobuf
)
# find first, then download, build, install protobuf
if
(
NOT PROTOBUF_FOUND OR WIN32
)
if
(
TARGET extern_protobuf
)
list
(
APPEND third_party_deps extern_protobuf
)
endif
()
...
...
@@ -317,6 +317,7 @@ endif (WITH_LITE)
if
(
WITH_CRYPTO
)
include
(
external/cryptopp
)
# download, build, install cryptopp
list
(
APPEND third_party_deps extern_cryptopp
)
add_definitions
(
-DPADDLE_WITH_CRYPTO
)
endif
(
WITH_CRYPTO
)
...
...
paddle/fluid/framework/CMakeLists.txt
浏览文件 @
4d6d2db8
...
...
@@ -374,11 +374,16 @@ if (LINUX)
endif
()
if
(
WIN32
)
if
(
"
${
CMAKE_GENERATOR
}
"
STREQUAL
"Ninja"
)
set
(
paddle_framework_lib_path
${
CMAKE_CURRENT_BINARY_DIR
}
)
else
()
set
(
paddle_framework_lib_path
${
CMAKE_CURRENT_BINARY_DIR
}
/
${
CMAKE_BUILD_TYPE
}
)
endif
()
set
(
FLUID_FRAMEWORK_IMPORT_LIB
${
PADDLE_BINARY_DIR
}
/paddle/fluid/framework/
${
CMAKE_BUILD_TYPE
}
/paddle_framework.lib
${
paddle_framework_lib_path
}
/paddle_framework.lib
CACHE INTERNAL
"Fluid framework lib"
)
set
(
FLUID_FRAMEWORK_SHARED_LIB
${
PADDLE_BINARY_DIR
}
/paddle/fluid/framework/
${
CMAKE_BUILD_TYPE
}
/paddle_framework.dll
${
paddle_framework_lib_path
}
/paddle_framework.dll
CACHE INTERNAL
"Fluid framework dll"
)
endif
()
...
...
@@ -417,11 +422,16 @@ if (LINUX)
endif
()
if
(
WIN32
)
if
(
"
${
CMAKE_GENERATOR
}
"
STREQUAL
"Ninja"
)
set
(
paddle_custom_op_lib_path
${
CMAKE_CURRENT_BINARY_DIR
}
)
else
()
set
(
paddle_custom_op_lib_path
${
CMAKE_CURRENT_BINARY_DIR
}
/
${
CMAKE_BUILD_TYPE
}
)
endif
()
set
(
PADDLE_CUSTOM_OP_IMPORT_LIB
${
PADDLE_BINARY_DIR
}
/paddle/fluid/framework/
${
CMAKE_BUILD_TYPE
}
/paddle_custom_op.lib
${
paddle_custom_op_lib_path
}
/paddle_custom_op.lib
CACHE INTERNAL
"Paddle custom op import lib"
)
set
(
PADDLE_CUSTOM_OP_SHARED_LIB
${
PADDLE_BINARY_DIR
}
/paddle/fluid/framework/
${
CMAKE_BUILD_TYPE
}
/paddle_custom_op.dll
${
paddle_custom_op_lib_path
}
/paddle_custom_op.dll
CACHE INTERNAL
"Paddle custom op dll"
)
endif
()
...
...
paddle/fluid/pybind/CMakeLists.txt
浏览文件 @
4d6d2db8
...
...
@@ -101,11 +101,16 @@ if(WITH_PYTHON)
set
(
tmp_impl_file
${
impl_file
}
.tmp
)
if
(
WIN32
)
if
(
"
${
CMAKE_GENERATOR
}
"
STREQUAL
"Ninja"
)
set
(
op_function_generator_path
"
${
CMAKE_CURRENT_BINARY_DIR
}
"
)
else
()
set
(
op_function_generator_path
"
${
CMAKE_CURRENT_BINARY_DIR
}
/
${
CMAKE_BUILD_TYPE
}
"
)
endif
()
file
(
WRITE
${
CMAKE_BINARY_DIR
}
/paddle/fluid/pybind/op_function_generator_retry.bat
""
"set build_times=1
\n
"
":retry
\n
"
"ECHO op_function_generator run %build_times% time
\n
"
"
${
CMAKE_BINARY_DIR
}
/paddle/fluid/pybind/
${
CMAKE_BUILD_TYPE
}
/op_function_generator
${
impl_file
}
\n
"
"
${
op_function_generator_path
}
/op_function_generator
${
impl_file
}
\n
"
"if %ERRORLEVEL% NEQ 0 (
\n
"
" set /a build_times=%build_times%+1
\n
"
" if %build_times% GTR 100 (
\n
"
...
...
@@ -123,19 +128,19 @@ if(WITH_PYTHON)
if
(
${
CBLAS_PROVIDER
}
STREQUAL MKLML
)
add_custom_command
(
TARGET op_function_generator
PRE_LINK
COMMAND
${
CMAKE_COMMAND
}
-E copy
${
MKLML_SHARED_LIB
}
${
CMAKE_CURRENT_BINARY_DIR
}
/
${
CMAKE_BUILD_TYPE
}
COMMAND
${
CMAKE_COMMAND
}
-E copy
${
MKLML_SHARED_IOMP_LIB
}
${
CMAKE_CURRENT_BINARY_DIR
}
/
${
CMAKE_BUILD_TYPE
}
COMMAND
${
CMAKE_COMMAND
}
-E copy
${
MKLML_SHARED_LIB
}
${
op_function_generator_path
}
COMMAND
${
CMAKE_COMMAND
}
-E copy
${
MKLML_SHARED_IOMP_LIB
}
${
op_function_generator_path
}
)
else
(
${
CBLAS_PROVIDER
}
STREQUAL EXTERN_OPENBLAS
)
add_custom_command
(
TARGET op_function_generator
PRE_LINK
COMMAND
${
CMAKE_COMMAND
}
-E copy
${
OPENBLAS_SHARED_LIB
}
${
CMAKE_CURRENT_BINARY_DIR
}
/
${
CMAKE_BUILD_TYPE
}
COMMAND
${
CMAKE_COMMAND
}
-E copy
${
OPENBLAS_SHARED_LIB
}
${
op_function_generator_path
}
)
endif
()
if
(
WITH_MKLDNN
)
add_custom_command
(
TARGET op_function_generator
PRE_LINK
COMMAND
${
CMAKE_COMMAND
}
-E copy
${
MKLDNN_SHARED_LIB
}
${
CMAKE_CURRENT_BINARY_DIR
}
/
${
CMAKE_BUILD_TYPE
}
COMMAND
${
CMAKE_COMMAND
}
-E copy
${
MKLDNN_SHARED_LIB
}
${
op_function_generator_path
}
)
endif
()
else
(
WIN32
)
...
...
paddle/scripts/paddle_build.bat
浏览文件 @
4d6d2db8
...
...
@@ -146,6 +146,15 @@ rem set CLCACHE_OBJECT_CACHE_TIMEOUT_MS=1000000
:: set maximum cache size to 20G
rem clcache.exe -M 21474836480
:: install ninja if GENERATOR is Ninja
if
%GENERATOR%
==
"Ninja"
(
pip
install
ninja
if
%errorlevel%
NEQ
0
(
echo
pip
install
ninja
failed
!
exit
/b
7
)
)
rem ------show summary of current environment----------
cmake
--version
nvcc
--version
...
...
@@ -285,14 +294,14 @@ if "%WITH_GPU%"=="ON" (
)
:cmake
_impl
echo
cmake
..
-G
%GENERATOR%
-DWITH
_AVX
=
%WITH_AVX%
-DWITH
_GPU
=
%WITH_GPU%
-DWITH
_MKL
=
%WITH_MKL%
^
echo
cmake
..
-G
%GENERATOR%
-D
CMAKE
_BUILD_TYPE
=
Release
-D
WITH
_AVX
=
%WITH_AVX%
-DWITH
_GPU
=
%WITH_GPU%
-DWITH
_MKL
=
%WITH_MKL%
^
-DWITH
_TESTING
=
%WITH_TESTING%
-DWITH
_PYTHON
=
%WITH_PYTHON%
-DPYTHON
_EXECUTABLE
=
%PYTHON_EXECUTABLE%
-DON
_INFER
=
%ON_INFER%
^
-DWITH
_INFERENCE_API_TEST
=
%WITH_INFERENCE_API_TEST%
-DTHIRD
_PARTY_PATH
=
%THIRD_PARTY_PATH%
^
-DINFERENCE
_DEMO_INSTALL_DIR
=
%INFERENCE_DEMO_INSTALL_DIR%
-DWITH
_STATIC_LIB
=
%WITH_STATIC_LIB%
^
-DWITH
_TENSORRT
=
%WITH_TENSORRT%
-DTENSORRT
_ROOT
=
"
%TENSORRT_ROOT%
"
-DMSVC
_STATIC_CRT
=
%MSVC_STATIC_CRT%
^
-DWITH
_UNITY_BUILD
=
%WITH_UNITY_BUILD%
-DCUDA
_ARCH_NAME
=
%CUDA_ARCH_NAME%
cmake
..
-G
%GENERATOR%
-DWITH
_AVX
=
%WITH_AVX%
-DWITH
_GPU
=
%WITH_GPU%
-DWITH
_MKL
=
%WITH_MKL%
^
cmake
..
-G
%GENERATOR%
-D
CMAKE
_BUILD_TYPE
=
Release
-D
WITH
_AVX
=
%WITH_AVX%
-DWITH
_GPU
=
%WITH_GPU%
-DWITH
_MKL
=
%WITH_MKL%
^
-DWITH
_TESTING
=
%WITH_TESTING%
-DWITH
_PYTHON
=
%WITH_PYTHON%
-DPYTHON
_EXECUTABLE
=
%PYTHON_EXECUTABLE%
-DON
_INFER
=
%ON_INFER%
^
-DWITH
_INFERENCE_API_TEST
=
%WITH_INFERENCE_API_TEST%
-DTHIRD
_PARTY_PATH
=
%THIRD_PARTY_PATH%
^
-DINFERENCE
_DEMO_INSTALL_DIR
=
%INFERENCE_DEMO_INSTALL_DIR%
-DWITH
_STATIC_LIB
=
%WITH_STATIC_LIB%
^
...
...
@@ -317,7 +326,11 @@ for /F %%# in ('wmic cpu get NumberOfLogicalProcessors^|findstr [0-9]') do set /
set
build_times
=
1
:build
_tp
echo
Build
third_party
the
%build_times%
time
:
msbuild
/m /p
:Configuration
=
Release
/verbosity
:quiet
third_party
.vcxproj
if
%GENERATOR%
==
"Ninja"
(
ninja
third_party
)
else
(
msbuild
/m /p
:Configuration
=
Release
/verbosity
:quiet
third_party
.vcxproj
)
if
%ERRORLEVEL%
NEQ
0
(
set
/a
build_times
=
%build_times%
+
1
if
%build_times%
GTR
2
(
...
...
@@ -335,10 +348,14 @@ set build_times=1
rem clcache.exe -z
echo
Build
Paddle
the
%build_times%
time
:
if
"
%WITH_CLCACHE%
"
==
"OFF
"
(
msbuild
/m
:
%PARALLEL_PROJECT_COUNT%
/p
:Configuration
=
Release
/verbosity
:
%LOG_LEVEL%
paddle
.sln
if
%GENERATOR%
==
"Ninja
"
(
ninja
-j
%PARALLEL_PROJECT_COUNT%
)
else
(
if
"
%WITH_CLCACHE%
"
==
"OFF"
(
msbuild
/m
:
%PARALLEL_PROJECT_COUNT%
/p
:Configuration
=
Release
/verbosity
:
%LOG_LEVEL%
paddle
.sln
)
else
(
msbuild
/m
:
%PARALLEL_PROJECT_COUNT%
/p
:TrackFileAccess
=
false
/p
:CLToolExe
=
clcache
.exe
/p
:CLToolPath
=
%PYTHON_ROOT%
\Scripts
/p
:Configuration
=
Release
/verbosity
:
%LOG_LEVEL%
paddle
.sln
)
)
if
%ERRORLEVEL%
NEQ
0
(
...
...
patches/cryptopp/CMakeLists.txt
0 → 100644
浏览文件 @
4d6d2db8
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录