Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
7c36b887
P
Paddle
项目概览
PaddlePaddle
/
Paddle
1 年多 前同步成功
通知
2302
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看板
未验证
提交
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 @@
...
@@ -13,18 +13,19 @@
# limitations under the License.
# limitations under the License.
import
os
import
os
from
paddle.fluid
import
core
from
distutils.sysconfig
import
get_python_lib
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
setuptools.command.build_ext
import
build_ext
from
paddle.fluid
import
core
# refer: https://note.qidong.name/2018/03/setup-warning-strict-prototypes
# refer: https://note.qidong.name/2018/03/setup-warning-strict-prototypes
# Avoid a gcc warning below:
# Avoid a gcc warning below:
# cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid
# cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid
# for C/ObjC but not for C++
# for C/ObjC but not for C++
class
BuildExt
(
build_ext
):
class
BuildExt
(
build_ext
):
def
build_extensions
(
self
):
def
build_extensions
(
self
):
if
'-Wstrict-prototypes'
in
self
.
compiler
.
compiler_so
:
if
'-Wstrict-prototypes'
in
self
.
compiler
.
compiler_so
:
self
.
compiler
.
compiler_so
.
remove
(
'-Wstrict-prototypes'
)
self
.
compiler
.
compiler_so
.
remove
(
'-Wstrict-prototypes'
)
...
@@ -48,8 +49,9 @@ paddle_custom_kernel_include = [
...
@@ -48,8 +49,9 @@ paddle_custom_kernel_include = [
os
.
path
.
join
(
site_packages_path
,
'paddle'
,
'include'
),
os
.
path
.
join
(
site_packages_path
,
'paddle'
,
'include'
),
]
]
# include path third_party
# include path third_party
compile_third_party_path
=
os
.
path
.
join
(
os
.
environ
[
'PADDLE_BINARY_DIR'
],
compile_third_party_path
=
os
.
path
.
join
(
'third_party'
)
os
.
environ
[
'PADDLE_BINARY_DIR'
],
'third_party'
)
paddle_custom_kernel_include
+=
[
paddle_custom_kernel_include
+=
[
os
.
path
.
join
(
compile_third_party_path
,
'install/gflags/include'
),
# gflags
os
.
path
.
join
(
compile_third_party_path
,
'install/gflags/include'
),
# gflags
os
.
path
.
join
(
compile_third_party_path
,
'install/glog/include'
),
# glog
os
.
path
.
join
(
compile_third_party_path
,
'install/glog/include'
),
# glog
...
@@ -69,10 +71,13 @@ custom_kernel_dot_module = Extension(
...
@@ -69,10 +71,13 @@ custom_kernel_dot_module = Extension(
include_dirs
=
paddle_custom_kernel_include
,
include_dirs
=
paddle_custom_kernel_include
,
library_dirs
=
paddle_custom_kernel_library_dir
,
library_dirs
=
paddle_custom_kernel_library_dir
,
libraries
=
libs
,
libraries
=
libs
,
extra_compile_args
=
paddle_extra_compile_args
)
extra_compile_args
=
paddle_extra_compile_args
,
)
setup
(
name
=
'custom_kernel_dot_c'
,
setup
(
version
=
'1.0'
,
name
=
'custom_kernel_dot_c'
,
description
=
'custom kernel fot compiling'
,
version
=
'1.0'
,
cmdclass
=
{
'build_ext'
:
BuildExt
},
description
=
'custom kernel fot compiling'
,
ext_modules
=
[
custom_kernel_dot_module
])
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 @@
...
@@ -14,18 +14,17 @@
import
os
import
os
import
site
import
site
from
paddle.fluid
import
core
from
setuptools
import
Extension
,
setup
from
distutils.sysconfig
import
get_python_lib
from
distutils.core
import
setup
,
Extension
from
setuptools.command.build_ext
import
build_ext
from
setuptools.command.build_ext
import
build_ext
from
paddle.fluid
import
core
# refer: https://note.qidong.name/2018/03/setup-warning-strict-prototypes
# refer: https://note.qidong.name/2018/03/setup-warning-strict-prototypes
# Avoid a gcc warning below:
# Avoid a gcc warning below:
# cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid
# cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid
# for C/ObjC but not for C++
# for C/ObjC but not for C++
class
BuildExt
(
build_ext
):
class
BuildExt
(
build_ext
):
def
build_extensions
(
self
):
def
build_extensions
(
self
):
if
'-Wstrict-prototypes'
in
self
.
compiler
.
compiler_so
:
if
'-Wstrict-prototypes'
in
self
.
compiler
.
compiler_so
:
self
.
compiler
.
compiler_so
.
remove
(
'-Wstrict-prototypes'
)
self
.
compiler
.
compiler_so
.
remove
(
'-Wstrict-prototypes'
)
...
@@ -46,12 +45,15 @@ if core.is_compiled_with_npu():
...
@@ -46,12 +45,15 @@ if core.is_compiled_with_npu():
# include path
# include path
site_packages_path
=
site
.
getsitepackages
()
site_packages_path
=
site
.
getsitepackages
()
paddle_custom_kernel_include
=
list
(
paddle_custom_kernel_include
=
list
(
map
(
lambda
path
:
os
.
path
.
join
(
path
,
'paddle'
,
'include'
),
map
(
site_packages_path
))
lambda
path
:
os
.
path
.
join
(
path
,
'paddle'
,
'include'
),
site_packages_path
)
)
# include path third_party
# include path third_party
compile_third_party_path
=
os
.
path
.
join
(
os
.
environ
[
'PADDLE_BINARY_DIR'
],
compile_third_party_path
=
os
.
path
.
join
(
'third_party'
)
os
.
environ
[
'PADDLE_BINARY_DIR'
],
'third_party'
)
paddle_custom_kernel_include
+=
[
paddle_custom_kernel_include
+=
[
os
.
path
.
join
(
compile_third_party_path
,
'install/gflags/include'
),
# gflags
os
.
path
.
join
(
compile_third_party_path
,
'install/gflags/include'
),
# gflags
os
.
path
.
join
(
compile_third_party_path
,
'install/glog/include'
),
# glog
os
.
path
.
join
(
compile_third_party_path
,
'install/glog/include'
),
# glog
...
@@ -59,7 +61,8 @@ paddle_custom_kernel_include += [
...
@@ -59,7 +61,8 @@ paddle_custom_kernel_include += [
# libs path
# libs path
paddle_custom_kernel_library_dir
=
list
(
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
libs
=
[
':libpaddle.so'
]
libs
=
[
':libpaddle.so'
]
...
@@ -70,10 +73,13 @@ custom_kernel_dot_module = Extension(
...
@@ -70,10 +73,13 @@ custom_kernel_dot_module = Extension(
include_dirs
=
paddle_custom_kernel_include
,
include_dirs
=
paddle_custom_kernel_include
,
library_dirs
=
paddle_custom_kernel_library_dir
,
library_dirs
=
paddle_custom_kernel_library_dir
,
libraries
=
libs
,
libraries
=
libs
,
extra_compile_args
=
paddle_extra_compile_args
)
extra_compile_args
=
paddle_extra_compile_args
,
)
setup
(
name
=
'custom_kernel_dot'
,
setup
(
version
=
'1.0'
,
name
=
'custom_kernel_dot'
,
description
=
'custom kernel fot compiling'
,
version
=
'1.0'
,
cmdclass
=
{
'build_ext'
:
BuildExt
},
description
=
'custom kernel fot compiling'
,
ext_modules
=
[
custom_kernel_dot_module
])
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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录