Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
411d64ad
P
Paddle
项目概览
PaddlePaddle
/
Paddle
大约 1 年 前同步成功
通知
2299
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看板
未验证
提交
411d64ad
编写于
12月 17, 2021
作者:
S
sneaxiy
提交者:
GitHub
12月 17, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add _compile_dir argument for custom ops compilation (#38211)
* add compile_dir * follow comments
上级
66a9d71a
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
34 addition
and
1 deletion
+34
-1
python/paddle/utils/cpp_extension/extension_utils.py
python/paddle/utils/cpp_extension/extension_utils.py
+34
-1
未找到文件。
python/paddle/utils/cpp_extension/extension_utils.py
浏览文件 @
411d64ad
...
...
@@ -441,13 +441,46 @@ def _reset_so_rpath(so_path):
run_cmd
(
cmd
)
def
_get_include_dirs_when_compiling
(
compile_dir
):
"""
Get all include directories when compiling the PaddlePaddle
source code.
"""
include_dirs_file
=
'includes.txt'
path
=
os
.
path
.
abspath
(
compile_dir
)
include_dirs_file
=
os
.
path
.
join
(
path
,
include_dirs_file
)
if
not
os
.
path
.
isfile
(
include_dirs_file
):
return
[]
with
open
(
include_dirs_file
,
'r'
)
as
f
:
include_dirs
=
[
line
.
strip
()
for
line
in
f
.
readlines
()
if
line
.
strip
()]
extra_dirs
=
[
'paddle/fluid/platform'
]
all_include_dirs
=
list
(
include_dirs
)
for
extra_dir
in
extra_dirs
:
for
include_dir
in
include_dirs
:
d
=
os
.
path
.
join
(
include_dir
,
extra_dir
)
if
os
.
path
.
isdir
(
d
):
all_include_dirs
.
append
(
d
)
all_include_dirs
.
append
(
path
)
all_include_dirs
.
sort
()
return
all_include_dirs
def
normalize_extension_kwargs
(
kwargs
,
use_cuda
=
False
):
"""
Normalize include_dirs, library_dir and other attributes in kwargs.
"""
assert
isinstance
(
kwargs
,
dict
)
include_dirs
=
[]
# NOTE: the "_compile_dir" argument is not public to users. It is only
# reserved for internal usage. We do not guarantee that this argument
# is always valid in the future release versions.
compile_dir
=
kwargs
.
get
(
"_compile_dir"
,
None
)
if
compile_dir
:
include_dirs
=
_get_include_dirs_when_compiling
(
compile_dir
)
# append necessary include dir path of paddle
include_dirs
=
kwargs
.
get
(
'include_dirs'
,
[]
)
include_dirs
=
kwargs
.
get
(
'include_dirs'
,
include_dirs
)
include_dirs
.
extend
(
find_paddle_includes
(
use_cuda
))
kwargs
[
'include_dirs'
]
=
include_dirs
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录