Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
Paddle
提交
2df4be5d
P
Paddle
项目概览
BaiXuePrincess
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
2df4be5d
编写于
12月 26, 2019
作者:
Z
zhouwei25
提交者:
liuwei1031
12月 26, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix openblas bug to support compile on windows when WITH_MKL=OFF (#21902)
* Fix openblas to support compile on Windows when WITH_MKL=OFF
上级
cad058ce
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
34 addition
and
35 deletion
+34
-35
cmake/external/openblas.cmake
cmake/external/openblas.cmake
+2
-0
cmake/inference_lib.cmake
cmake/inference_lib.cmake
+6
-0
paddle/fluid/pybind/CMakeLists.txt
paddle/fluid/pybind/CMakeLists.txt
+25
-34
python/setup.py.in
python/setup.py.in
+1
-1
未找到文件。
cmake/external/openblas.cmake
浏览文件 @
2df4be5d
...
...
@@ -68,10 +68,12 @@ ELSE(NOT WIN32)
-DCMAKE_INSTALL_PREFIX=
${
CBLAS_INSTALL_DIR
}
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
-DCMAKE_BUILD_TYPE=
${
THIRD_PARTY_BUILD_TYPE
}
-DBUILD_SHARED_LIBS=ON
-DMSVC_STATIC_CRT=
${
MSVC_STATIC_CRT
}
${
EXTERNAL_OPTIONAL_ARGS
}
CMAKE_CACHE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=
${
CBLAS_INSTALL_DIR
}
-DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=ON
-DCMAKE_BUILD_TYPE:STRING=
${
THIRD_PARTY_BUILD_TYPE
}
)
SET
(
OPENBLAS_SHARED_LIB
${
CBLAS_INSTALL_DIR
}
/bin/openblas
${
CMAKE_SHARED_LIBRARY_SUFFIX
}
)
ENDIF
(
NOT WIN32
)
cmake/inference_lib.cmake
浏览文件 @
2df4be5d
...
...
@@ -71,9 +71,15 @@ function(copy_part_of_thrid_party TARGET DST)
endif
()
elseif
(
${
CBLAS_PROVIDER
}
STREQUAL EXTERN_OPENBLAS
)
set
(
dst_dir
"
${
DST
}
/third_party/install/openblas"
)
if
(
WIN32
)
copy
(
${
TARGET
}
SRCS
${
CBLAS_INSTALL_DIR
}
/lib
${
OPENBLAS_SHARED_LIB
}
${
CBLAS_INSTALL_DIR
}
/include
DSTS
${
dst_dir
}
${
dst_dir
}
/lib
${
dst_dir
}
)
else
()
copy
(
${
TARGET
}
SRCS
${
CBLAS_INSTALL_DIR
}
/lib
${
CBLAS_INSTALL_DIR
}
/include
DSTS
${
dst_dir
}
${
dst_dir
}
)
endif
()
endif
()
if
(
WITH_MKLDNN
)
...
...
paddle/fluid/pybind/CMakeLists.txt
浏览文件 @
2df4be5d
...
...
@@ -34,7 +34,6 @@ if (WITH_DISTRIBUTE)
endif
()
if
(
WITH_PYTHON
)
# generate op pybind functions automatically for dygraph.
set
(
OP_FUNCTION_GENERETOR_DEPS pybind proto_desc executor layer tracer engine imperative_profiler imperative_flag
)
list
(
APPEND OP_FUNCTION_GENERETOR_DEPS
${
GLOB_OP_LIB
}
)
...
...
@@ -45,27 +44,31 @@ if(WITH_PYTHON)
endif
(
NOT WIN32
)
add_executable
(
op_function_generator op_function_generator.cc
)
target_link_libraries
(
op_function_generator
${
OP_FUNCTION_GENERETOR_DEPS
}
)
target_link_libraries
(
op_function_generator
${
OP_FUNCTION_GENERETOR_DEPS
}
)
get_property
(
os_dependency_modules GLOBAL PROPERTY OS_DEPENDENCY_MODULES
)
target_link_libraries
(
op_function_generator
${
os_dependency_modules
}
)
if
(
WIN32
)
if
(
WIN32
)
add_custom_target
(
op_function_cmd
COMMAND
"
${
CMAKE_BINARY_DIR
}
/paddle/fluid/pybind/
${
CMAKE_BUILD_TYPE
}
/op_function_generator"
"
${
CMAKE_SOURCE_DIR
}
/paddle/fluid/pybind/op_function_impl.h"
)
add_dependencies
(
op_function_cmd op_function_generator
)
if
(
WITH_MK
L
)
add_custom_target
(
copy_mkl
COMMAND
${
CMAKE_COMMAND
}
-E copy
${
MKLML_SHARED_LIB
}
${
CMAKE_CURRENT_BINARY_DIR
}
/
${
CMAKE_BUILD_TYPE
}
COMMAND
${
CMAKE_COMMAND
}
-E copy
${
MKLML_SHARED_LIB_DEPS
}
${
CMAKE_CURRENT_BINARY_DIR
}
/
${
CMAKE_BUILD_TYPE
}
COMMAND
${
CMAKE_COMMAND
}
-E copy
${
MKLML_SHARED_IOMP_LIB
}
${
CMAKE_CURRENT_BINARY_DIR
}
/
${
CMAKE_BUILD_TYPE
}
"
${
CMAKE_SOURCE_DIR
}
/paddle/fluid/pybind/op_function_impl.h"
)
add_dependencies
(
op_function_cmd op_function_generator
)
if
(
${
CBLAS_PROVIDER
}
STREQUAL MKLM
L
)
add_custom_command
(
TARGET op_function_generator POST_BUILD
COMMAND
${
CMAKE_COMMAND
}
-E copy
${
MKLML_SHARED_LIB
}
${
CMAKE_CURRENT_BINARY_DIR
}
/
${
CMAKE_BUILD_TYPE
}
COMMAND
${
CMAKE_COMMAND
}
-E copy
${
MKLML_SHARED_LIB_DEPS
}
${
CMAKE_CURRENT_BINARY_DIR
}
/
${
CMAKE_BUILD_TYPE
}
COMMAND
${
CMAKE_COMMAND
}
-E copy
${
MKLML_SHARED_IOMP_LIB
}
${
CMAKE_CURRENT_BINARY_DIR
}
/
${
CMAKE_BUILD_TYPE
}
)
endif
(
WITH_MKL
)
else
(
${
CBLAS_PROVIDER
}
STREQUAL EXTERN_OPENBLAS
)
add_custom_command
(
TARGET op_function_generator POST_BUILD
COMMAND
${
CMAKE_COMMAND
}
-E copy
${
OPENBLAS_SHARED_LIB
}
${
CMAKE_CURRENT_BINARY_DIR
}
/
${
CMAKE_BUILD_TYPE
}
)
endif
()
if
(
WITH_MKLDNN
)
add_custom_
target
(
copy_mkldnn
add_custom_
command
(
TARGET op_function_generator POST_BUILD
COMMAND
${
CMAKE_COMMAND
}
-E copy
${
MKLDNN_SHARED_LIB
}
${
CMAKE_CURRENT_BINARY_DIR
}
/
${
CMAKE_BUILD_TYPE
}
)
endif
(
WITH_MKLDNN
)
endif
()
else
(
WIN32
)
# If there are no *.so in /usr/lib or LD_LIBRARY_PATH,
# copy these *.so to current directory and append current directory to
...
...
@@ -73,33 +76,22 @@ if(WITH_PYTHON)
# *.dll in current directory automatically.
add_custom_target
(
op_function_cmd
COMMAND
${
CMAKE_COMMAND
}
-E env
"LD_LIBRARY_PATH=$ENV{LD_LIBRARY_PATH}:."
"
${
CMAKE_CURRENT_BINARY_DIR
}
/op_function_generator"
"
${
CMAKE_SOURCE_DIR
}
/paddle/fluid/pybind/op_function_impl.h"
)
add_dependencies
(
op_function_cmd op_function_generator
)
"
${
CMAKE_CURRENT_BINARY_DIR
}
/op_function_generator"
"
${
CMAKE_SOURCE_DIR
}
/paddle/fluid/pybind/op_function_impl.h"
)
add_dependencies
(
op_function_cmd op_function_generator
)
if
(
WITH_MKL
)
add_custom_target
(
copy_mkl
COMMAND
${
CMAKE_COMMAND
}
-E copy
${
MKLML_SHARED_LIB
}
${
CMAKE_CURRENT_BINARY_DIR
}
COMMAND
${
CMAKE_COMMAND
}
-E copy
${
MKLML_SHARED_IOMP_LIB
}
${
CMAKE_CURRENT_BINARY_DIR
}
)
add_custom_command
(
TARGET op_function_generator POST_BUILD
COMMAND
${
CMAKE_COMMAND
}
-E copy
${
MKLML_SHARED_LIB
}
${
CMAKE_CURRENT_BINARY_DIR
}
COMMAND
${
CMAKE_COMMAND
}
-E copy
${
MKLML_SHARED_IOMP_LIB
}
${
CMAKE_CURRENT_BINARY_DIR
}
)
endif
(
WITH_MKL
)
if
(
WITH_MKLDNN
)
add_custom_
target
(
copy_mkldnn
add_custom_
command
(
TARGET op_function_generator POST_BUILD
COMMAND
${
CMAKE_COMMAND
}
-E copy
${
MKLDNN_SHARED_LIB
}
${
CMAKE_CURRENT_BINARY_DIR
}
)
endif
(
WITH_MKLDNN
)
endif
(
WIN32
)
if
(
WITH_MKL
)
add_dependencies
(
copy_mkl op_function_generator
)
add_dependencies
(
op_function_cmd copy_mkl
)
endif
(
WITH_MKL
)
if
(
WITH_MKLDNN
)
add_dependencies
(
copy_mkldnn op_function_generator
)
add_dependencies
(
op_function_cmd copy_mkldnn
)
endif
(
WITH_MKLDNN
)
if
(
WITH_AMD_GPU
)
hip_library
(
paddle_pybind SHARED
SRCS
${
PYBIND_SRCS
}
...
...
@@ -117,6 +109,5 @@ if(WITH_PYTHON)
get_property
(
os_dependency_modules GLOBAL PROPERTY OS_DEPENDENCY_MODULES
)
target_link_libraries
(
paddle_pybind
${
os_dependency_modules
}
)
add_dependencies
(
paddle_pybind op_function_cmd
)
add_dependencies
(
paddle_pybind op_function_cmd
)
endif
(
WITH_PYTHON
)
python/setup.py.in
浏览文件 @
2df4be5d
...
...
@@ -190,7 +190,7 @@ if '${WITH_MKL}' == 'ON':
else:
if os.name == 'nt':
# copy the openblas.dll
shutil.copy(
os.path.dirname('${CBLAS_LIBRARIES}') + '/openblas' + ext_name
, libs_path)
shutil.copy(
'${OPENBLAS_SHARED_LIB}'
, libs_path)
package_data['paddle.libs'] += ['openblas' + ext_name]
if '${WITH_PSLIB}' == 'ON':
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录