Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
Paddle
提交
7d4998ac
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看板
未验证
提交
7d4998ac
编写于
4月 23, 2021
作者:
C
Chen Weihang
提交者:
GitHub
4月 23, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[CustomOp] Remove useless extension headers for old custom op (#32463)
* remove useless ext headers * fix boost header compile failed
上级
8fa8a37f
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
16 addition
and
27 deletion
+16
-27
paddle/extension.h
paddle/extension.h
+1
-1
python/setup.py.in
python/setup.py.in
+15
-26
未找到文件。
paddle/extension.h
浏览文件 @
7d4998ac
...
@@ -15,4 +15,4 @@ limitations under the License. */
...
@@ -15,4 +15,4 @@ limitations under the License. */
#pragma once
#pragma once
// All paddle apis in C++ frontend
// All paddle apis in C++ frontend
#include "paddle/
fluid/
extension/include/ext_all.h"
#include "paddle/extension/include/ext_all.h"
python/setup.py.in
浏览文件 @
7d4998ac
...
@@ -392,15 +392,22 @@ if os.name == 'nt':
...
@@ -392,15 +392,22 @@ if os.name == 'nt':
elif sys.platform == 'darwin':
elif sys.platform == 'darwin':
ext_modules = []
ext_modules = []
def find_files(pattern, root):
def find_files(pattern, root
, recursive=False
):
for dirpath, _, files in os.walk(root):
for dirpath, _, files in os.walk(root):
for filename in fnmatch.filter(files, pattern):
for filename in fnmatch.filter(files, pattern):
yield os.path.join(dirpath, filename)
yield os.path.join(dirpath, filename)
if not recursive:
break
headers = (
headers = (
list(find_files('*.h', '@PADDLE_SOURCE_DIR@/paddle')) +
list(find_files('*.h', '@PADDLE_SOURCE_DIR@/paddle')) +
list(find_files('*.h', '@PADDLE_SOURCE_DIR@/paddle/fluid/extension')) + # extension
list(find_files('*.h', '@PADDLE_SOURCE_DIR@/paddle/fluid/extension/include')) + # extension
list(find_files('*', '${BOOST_INCLUDE_DIR}/boost'))) # boost
list(find_files('*', '${BOOST_INCLUDE_DIR}/boost', True)) + # boost
# For paddle uew custom op, only copy data type headers from `paddle/fluid/platform`
# to `extension/incude`,
['@PADDLE_SOURCE_DIR@/paddle/fluid/platform/complex64.h'] +
['@PADDLE_SOURCE_DIR@/paddle/fluid/platform/complex128.h'] +
['@PADDLE_SOURCE_DIR@/paddle/fluid/platform/float16.h'])
if '${WITH_MKLDNN}' == 'ON':
if '${WITH_MKLDNN}' == 'ON':
headers += list(find_files('*', '${MKLDNN_INSTALL_DIR}/include')) # mkldnn
headers += list(find_files('*', '${MKLDNN_INSTALL_DIR}/include')) # mkldnn
...
@@ -440,35 +447,18 @@ class InstallHeaders(Command):
...
@@ -440,35 +447,18 @@ class InstallHeaders(Command):
('install_headers', 'install_dir'),
('install_headers', 'install_dir'),
('force', 'force'))
('force', 'force'))
def copy_data_type_headers(self):
# For paddle uew custom op, only copy data type headers from `paddle/fluid/platform`
# to `extension/incude`,
data_type_headers = (['@PADDLE_SOURCE_DIR@/paddle/fluid/platform/complex64.h'] +
['@PADDLE_SOURCE_DIR@/paddle/fluid/platform/complex128.h'] +
['@PADDLE_SOURCE_DIR@/paddle/fluid/platform/float16.h'])
install_dir = os.path.join(self.install_dir, "paddle/fluid/extension/include")
if not os.path.exists(install_dir):
self.mkpath(install_dir)
for header in data_type_headers:
self.copy_file(header, install_dir)
def mkdir_and_copy_file(self, header):
def mkdir_and_copy_file(self, header):
if 'pb.h' in header:
if 'pb.h' in header:
install_dir = re.sub('${PADDLE_BINARY_DIR}/', '', header)
install_dir = re.sub('${PADDLE_BINARY_DIR}/', '', header)
elif 'third_party' not in header:
elif 'third_party' not in header:
# paddle headers
# paddle headers
install_dir = re.sub('@PADDLE_SOURCE_DIR@/', '', header)
install_dir = re.sub('@PADDLE_SOURCE_DIR@/', '', header)
if 'fluid' in install_dir:
install_dir = "paddle/extension/include/"
else:
else:
# third_party
# third_party
install_dir = re.sub('${THIRD_PARTY_PATH}', 'third_party', header)
install_dir = re.sub('${THIRD_PARTY_PATH}', 'third_party', header)
patterns = ['eigen3/src/extern_eigen3', 'boost/src/extern_boost',
patterns = ['boost/src/extern_boost', 'install/mkldnn/include']
'dlpack/src/extern_dlpack/include',
'install/protobuf/include',
'install/gflags/include',
'install/glog/include', 'install/xxhash/include',
'install/mkldnn/include',
'threadpool/src/extern_threadpool']
for pattern in patterns:
for pattern in patterns:
install_dir = re.sub(pattern, '', install_dir)
install_dir = re.sub(pattern, '', install_dir)
install_dir = os.path.join(self.install_dir, os.path.dirname(install_dir))
install_dir = os.path.join(self.install_dir, os.path.dirname(install_dir))
...
@@ -484,7 +474,6 @@ class InstallHeaders(Command):
...
@@ -484,7 +474,6 @@ class InstallHeaders(Command):
for header in hdrs:
for header in hdrs:
(out, _) = self.mkdir_and_copy_file(header)
(out, _) = self.mkdir_and_copy_file(header)
self.outfiles.append(out)
self.outfiles.append(out)
self.copy_data_type_headers()
def get_inputs(self):
def get_inputs(self):
return self.distribution.headers or []
return self.distribution.headers or []
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录