Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
Paddle
提交
7c36b887
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看板
未验证
提交
7c36b887
编写于
12月 21, 2022
作者:
A
Aganlengzi
提交者:
GitHub
12月 21, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix unittests (#49203) (#49210)
上级
fb19648a
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
37 addition
and
26 deletion
+37
-26
python/paddle/fluid/tests/custom_kernel/custom_kernel_dot_c_setup.py
...le/fluid/tests/custom_kernel/custom_kernel_dot_c_setup.py
+16
-11
python/paddle/fluid/tests/custom_kernel/custom_kernel_dot_setup.py
...ddle/fluid/tests/custom_kernel/custom_kernel_dot_setup.py
+21
-15
未找到文件。
python/paddle/fluid/tests/custom_kernel/custom_kernel_dot_c_setup.py
浏览文件 @
7c36b887
...
...
@@ -13,18 +13,19 @@
# limitations under the License.
import
os
from
paddle.fluid
import
core
from
distutils.sysconfig
import
get_python_lib
from
distutils.core
import
setup
,
Extension
from
setuptools
import
Extension
,
setup
from
setuptools.command.build_ext
import
build_ext
from
paddle.fluid
import
core
# refer: https://note.qidong.name/2018/03/setup-warning-strict-prototypes
# Avoid a gcc warning below:
# cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid
# for C/ObjC but not for C++
class
BuildExt
(
build_ext
):
def
build_extensions
(
self
):
if
'-Wstrict-prototypes'
in
self
.
compiler
.
compiler_so
:
self
.
compiler
.
compiler_so
.
remove
(
'-Wstrict-prototypes'
)
...
...
@@ -48,8 +49,9 @@ paddle_custom_kernel_include = [
os
.
path
.
join
(
site_packages_path
,
'paddle'
,
'include'
),
]
# include path third_party
compile_third_party_path
=
os
.
path
.
join
(
os
.
environ
[
'PADDLE_BINARY_DIR'
],
'third_party'
)
compile_third_party_path
=
os
.
path
.
join
(
os
.
environ
[
'PADDLE_BINARY_DIR'
],
'third_party'
)
paddle_custom_kernel_include
+=
[
os
.
path
.
join
(
compile_third_party_path
,
'install/gflags/include'
),
# gflags
os
.
path
.
join
(
compile_third_party_path
,
'install/glog/include'
),
# glog
...
...
@@ -69,10 +71,13 @@ custom_kernel_dot_module = Extension(
include_dirs
=
paddle_custom_kernel_include
,
library_dirs
=
paddle_custom_kernel_library_dir
,
libraries
=
libs
,
extra_compile_args
=
paddle_extra_compile_args
)
extra_compile_args
=
paddle_extra_compile_args
,
)
setup
(
name
=
'custom_kernel_dot_c'
,
version
=
'1.0'
,
description
=
'custom kernel fot compiling'
,
cmdclass
=
{
'build_ext'
:
BuildExt
},
ext_modules
=
[
custom_kernel_dot_module
])
setup
(
name
=
'custom_kernel_dot_c'
,
version
=
'1.0'
,
description
=
'custom kernel fot compiling'
,
cmdclass
=
{
'build_ext'
:
BuildExt
},
ext_modules
=
[
custom_kernel_dot_module
],
)
python/paddle/fluid/tests/custom_kernel/custom_kernel_dot_setup.py
浏览文件 @
7c36b887
...
...
@@ -14,18 +14,17 @@
import
os
import
site
from
paddle.fluid
import
core
from
distutils.sysconfig
import
get_python_lib
from
distutils.core
import
setup
,
Extension
from
setuptools
import
Extension
,
setup
from
setuptools.command.build_ext
import
build_ext
from
paddle.fluid
import
core
# refer: https://note.qidong.name/2018/03/setup-warning-strict-prototypes
# Avoid a gcc warning below:
# cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid
# for C/ObjC but not for C++
class
BuildExt
(
build_ext
):
def
build_extensions
(
self
):
if
'-Wstrict-prototypes'
in
self
.
compiler
.
compiler_so
:
self
.
compiler
.
compiler_so
.
remove
(
'-Wstrict-prototypes'
)
...
...
@@ -46,12 +45,15 @@ if core.is_compiled_with_npu():
# include path
site_packages_path
=
site
.
getsitepackages
()
paddle_custom_kernel_include
=
list
(
map
(
lambda
path
:
os
.
path
.
join
(
path
,
'paddle'
,
'include'
),
site_packages_path
))
map
(
lambda
path
:
os
.
path
.
join
(
path
,
'paddle'
,
'include'
),
site_packages_path
)
)
# include path third_party
compile_third_party_path
=
os
.
path
.
join
(
os
.
environ
[
'PADDLE_BINARY_DIR'
],
'third_party'
)
compile_third_party_path
=
os
.
path
.
join
(
os
.
environ
[
'PADDLE_BINARY_DIR'
],
'third_party'
)
paddle_custom_kernel_include
+=
[
os
.
path
.
join
(
compile_third_party_path
,
'install/gflags/include'
),
# gflags
os
.
path
.
join
(
compile_third_party_path
,
'install/glog/include'
),
# glog
...
...
@@ -59,7 +61,8 @@ paddle_custom_kernel_include += [
# libs path
paddle_custom_kernel_library_dir
=
list
(
map
(
lambda
path
:
os
.
path
.
join
(
path
,
'paddle'
,
'fluid'
),
site_packages_path
))
map
(
lambda
path
:
os
.
path
.
join
(
path
,
'paddle'
,
'fluid'
),
site_packages_path
)
)
# libs
libs
=
[
':libpaddle.so'
]
...
...
@@ -70,10 +73,13 @@ custom_kernel_dot_module = Extension(
include_dirs
=
paddle_custom_kernel_include
,
library_dirs
=
paddle_custom_kernel_library_dir
,
libraries
=
libs
,
extra_compile_args
=
paddle_extra_compile_args
)
extra_compile_args
=
paddle_extra_compile_args
,
)
setup
(
name
=
'custom_kernel_dot'
,
version
=
'1.0'
,
description
=
'custom kernel fot compiling'
,
cmdclass
=
{
'build_ext'
:
BuildExt
},
ext_modules
=
[
custom_kernel_dot_module
])
setup
(
name
=
'custom_kernel_dot'
,
version
=
'1.0'
,
description
=
'custom kernel fot compiling'
,
cmdclass
=
{
'build_ext'
:
BuildExt
},
ext_modules
=
[
custom_kernel_dot_module
],
)
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录