Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
机器未来
Paddle
提交
13e4280f
P
Paddle
项目概览
机器未来
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
13e4280f
编写于
3月 03, 2021
作者:
Z
Zhou Wei
提交者:
GitHub
3月 03, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[Custom OP]polish doc of custom OP (#31369)
上级
946dbdae
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
46 addition
and
38 deletion
+46
-38
paddle/fluid/extension/include/ext_exception.h
paddle/fluid/extension/include/ext_exception.h
+1
-1
paddle/fluid/framework/data_feed.cc
paddle/fluid/framework/data_feed.cc
+7
-7
paddle/fluid/framework/details/exception_holder.h
paddle/fluid/framework/details/exception_holder.h
+1
-1
python/paddle/fluid/tests/custom_op/test_check_error.cc
python/paddle/fluid/tests/custom_op/test_check_error.cc
+1
-1
python/paddle/utils/cpp_extension/cpp_extension.py
python/paddle/utils/cpp_extension/cpp_extension.py
+36
-28
未找到文件。
paddle/fluid/extension/include/ext_exception.h
浏览文件 @
13e4280f
...
...
@@ -102,7 +102,7 @@ class ErrorMessage {
do { \
auto __message__ = ::paddle::ErrorMessage(__VA_ARGS__).to_string(); \
throw ::paddle::PD_Exception(__message__, __FILE__, __LINE__, \
"An error occur
ed.");
\
"An error occur
red.");
\
} while (0)
}
// namespace paddle
paddle/fluid/framework/data_feed.cc
浏览文件 @
13e4280f
...
...
@@ -519,7 +519,7 @@ bool MultiSlotDataFeed::CheckFile(const char* filename) {
VLOG
(
0
)
<<
"error: the number of ids is a negative number: "
<<
num
;
VLOG
(
0
)
<<
"please check line<"
<<
instance_cout
<<
"> in file<"
<<
filename
<<
">"
;
VLOG
(
0
)
<<
"Error occured when parsing "
<<
i
VLOG
(
0
)
<<
"Error occur
r
ed when parsing "
<<
i
<<
" th slot with total slots number: "
<<
all_slots_
.
size
();
return
false
;
}
else
if
(
num
==
0
)
{
...
...
@@ -530,14 +530,14 @@ bool MultiSlotDataFeed::CheckFile(const char* filename) {
"characters."
;
VLOG
(
0
)
<<
"please check line<"
<<
instance_cout
<<
"> in file<"
<<
filename
<<
">"
;
VLOG
(
0
)
<<
"Error occured when parsing "
<<
i
VLOG
(
0
)
<<
"Error occur
r
ed when parsing "
<<
i
<<
" th slot with total slots number: "
<<
all_slots_
.
size
();
return
false
;
}
else
if
(
errno
==
ERANGE
||
num
>
INT_MAX
)
{
VLOG
(
0
)
<<
"error: the number of ids greater than INT_MAX"
;
VLOG
(
0
)
<<
"please check line<"
<<
instance_cout
<<
"> in file<"
<<
filename
<<
">"
;
VLOG
(
0
)
<<
"Error occured when parsing "
<<
i
VLOG
(
0
)
<<
"Error occur
r
ed when parsing "
<<
i
<<
" th slot with total slots number: "
<<
all_slots_
.
size
();
return
false
;
}
...
...
@@ -549,7 +549,7 @@ bool MultiSlotDataFeed::CheckFile(const char* filename) {
"representable values for float"
;
VLOG
(
0
)
<<
"please check line<"
<<
instance_cout
<<
"> in file<"
<<
filename
<<
">"
;
VLOG
(
0
)
<<
"Error occured when parsing "
<<
i
VLOG
(
0
)
<<
"Error occur
r
ed when parsing "
<<
i
<<
" th slot with total slots number: "
<<
all_slots_
.
size
();
VLOG
(
0
)
<<
"and in this slot: "
<<
j
...
...
@@ -558,7 +558,7 @@ bool MultiSlotDataFeed::CheckFile(const char* filename) {
}
if
(
j
+
1
!=
num
&&
endptr
-
str
==
len
)
{
VLOG
(
0
)
<<
"error: there is a wrong with the number of ids."
;
VLOG
(
0
)
<<
"Error occured when parsing "
<<
i
VLOG
(
0
)
<<
"Error occur
r
ed when parsing "
<<
i
<<
" th slot with total slots number: "
<<
all_slots_
.
size
();
VLOG
(
0
)
<<
"and in this slot: "
<<
j
...
...
@@ -574,7 +574,7 @@ bool MultiSlotDataFeed::CheckFile(const char* filename) {
if
(
errno
==
ERANGE
)
{
VLOG
(
0
)
<<
"error: the value is out of the range of "
"representable values for uint64_t"
;
VLOG
(
0
)
<<
"Error occured when parsing "
<<
i
VLOG
(
0
)
<<
"Error occur
r
ed when parsing "
<<
i
<<
" th slot with total slots number: "
<<
all_slots_
.
size
();
VLOG
(
0
)
<<
"and in this slot: "
<<
j
...
...
@@ -585,7 +585,7 @@ bool MultiSlotDataFeed::CheckFile(const char* filename) {
}
if
(
j
+
1
!=
num
&&
endptr
-
str
==
len
)
{
VLOG
(
0
)
<<
"error: there is a wrong with the number of ids."
;
VLOG
(
0
)
<<
"Error occured when parsing "
<<
i
VLOG
(
0
)
<<
"Error occur
r
ed when parsing "
<<
i
<<
" th slot with total slots number: "
<<
all_slots_
.
size
();
VLOG
(
0
)
<<
"and in this slot: "
<<
j
...
...
paddle/fluid/framework/details/exception_holder.h
浏览文件 @
13e4280f
...
...
@@ -108,7 +108,7 @@ class ExceptionHolder {
type_
=
kNone
;
}
// NOTE: currently in PE, multiple exceptions may occured in multiple
// NOTE: currently in PE, multiple exceptions may occur
r
ed in multiple
// threads, and the exception that occur later will overwrite that
// occur earlier, but what we want should be the first triggered exception.
// However, EOF exception is lower priority exception and can be overwritten,
...
...
python/paddle/fluid/tests/custom_op/test_check_error.cc
浏览文件 @
13e4280f
...
...
@@ -21,7 +21,7 @@ TEST(PD_THROW, empty) {
}
catch
(
const
std
::
exception
&
e
)
{
caught_exception
=
true
;
std
::
string
err_msg
=
e
.
what
();
EXPECT_TRUE
(
err_msg
.
find
(
"An error occured."
)
!=
std
::
string
::
npos
);
EXPECT_TRUE
(
err_msg
.
find
(
"An error occur
r
ed."
)
!=
std
::
string
::
npos
);
#if _WIN32
EXPECT_TRUE
(
err_msg
.
find
(
"tests
\\
custom_op
\\
test_check_error.cc:20"
)
!=
std
::
string
::
npos
);
...
...
python/paddle/utils/cpp_extension/cpp_extension.py
浏览文件 @
13e4280f
...
...
@@ -52,24 +52,28 @@ def setup(**attr):
It encapsulates the python built-in ``setuptools.setup`` function and keeps arguments
and usage same as the native interface. Meanwhile, it hiddens Paddle inner framework
concepts, such as necessary compiling flags, included paths of head files, and linking
flags. It also will automatically search and valid local enviromment and versions of
``cc`` and
``
nvcc`` , then compiles customized operators supporting CPU or GPU device according to
the specified Extension type.
flags. It also will automatically search and valid local enviromment and versions of
``
cc(Linux)`` , ``cl.exe(Windows)`` and ``nvcc`` , then compiles customized operators
supporting CPU or GPU device according to
the specified Extension type.
Moreover, `ABI compatibility <https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html>`_
will be checked to ensure that compiler version from ``cc``
will be checked to ensure that compiler version from ``cc
(Linux)`` , ``cl.exe(Windows)
``
on local machine is compatible with pre-installed Paddle whl in python site-packages.
For example if Paddle with CUDA 10.1 is built with GCC 8.2, then the version of user's
local machine should satisfy GCC >= 8.2. Otherwise, a fatal error will occur because of
ABI compatibility.
.. note::
For Linux, GCC version will be checked . For example if Paddle with CUDA 10.1 is built with GCC 8.2,
then the version of user's local machine should satisfy GCC >= 8.2.
For Windows, Visual Studio version will be checked, and it shoule be greater than or equal to that of
PaddlePaddle (Visual Studio 2015 update3).
If the above conditions are not met, the corresponding warning will be printed, and a fatal error may
occur because of ABI compatibility.
1. Compiler ABI compatibility is forward compatible. On Linux platform,
we recommend to use GCC 8.2 as soft linking condidate of ``/usr/bin/cc`` .
2. Using ``which cc`` to ensure location of ``cc`` and using ``cc --version``
to ensure linking GCC version on Linux.
3. Currently we support Linux and Windows platfrom. MacOS is supporting...
.. note::
1. Currently we support Linux and Windows platfrom. MacOS is supporting...
2. On Linux platform, we recommend to use GCC 8.2 as soft linking condidate of ``/usr/bin/cc`` .
Then, Use ``which cc`` to ensure location of ``cc`` and using ``cc --version`` to ensure linking
GCC version.
3. On Windows platform, we recommend to install `` Visual Studio`` (>=2015 update3).
Compared with Just-In-Time ``load`` interface, it only compiles once by executing
...
...
@@ -673,19 +677,23 @@ def load(name,
append user defined custom operators in background while building models.
It will perform compiling, linking, Python API generation and module loading
processes under a individual subprocess. It does not require CMake or Ninja
environment
and only ``g++/nvcc`` on Linux and clang++ on MacOS. For example it requires
GCC compiler with version is greater than 5.4 and linked into ``/usr/bin/cc`` .
If compiling Operators supporting GPU device, please make sure ``nvcc`` compiler
is installed in local environment.
processes under a individual subprocess. It does not require CMake or Ninja
environment. On Linux platform, it requires GCC compiler whose version is
greater than 5.4 and it should be soft linked to ``/usr/bin/cc`` . On Windows
platform, it requires Visual Studio whose version is greater than 2015 update3.
On MacOS, clang++ is requited. In addition, if compiling Operators supporting
GPU device, please make sure ``nvcc`` compiler is installed in local environment.
Moreover, `ABI compatibility <https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html>`_
will be checked to ensure that compiler version from ``cc``
will be checked to ensure that compiler version from ``cc
(Linux)`` , ``cl.exe(Windows)
``
on local machine is compatible with pre-installed Paddle whl in python site-packages.
For example if Paddle with CUDA 10.1 is built with GCC 8.2, then the version of user's
local machine should satisfy GCC >= 8.2. Otherwise, a fatal error will occur because of
ABI compatibility.
For Linux, GCC version will be checked . For example if Paddle with CUDA 10.1 is built with GCC 8.2,
then the version of user's local machine should satisfy GCC >= 8.2.
For Windows, Visual Studio version will be checked, and it shoule be greater than or equal to that of
PaddlePaddle (Visual Studio 2015 update3).
If the above conditions are not met, the corresponding warning will be printed, and a fatal error may
occur because of ABI compatibility.
Compared with ``setup`` interface, it doesn't need extra ``setup.py`` and excute
``python setup.py install`` command. The interface contains all compiling and installing
...
...
@@ -693,11 +701,11 @@ def load(name,
.. note::
1. C
ompiler ABI compatibility is forward compatible. On Linux platform,
we recommend to use GCC 8.2 as soft linking condidate of ``/usr/bin/cc`` .
2. Using ``which cc`` to ensure location of ``cc`` and using ``cc --version``
to ensure linking GCC version on Linux
.
3.
Currenly we support Linux and Windows platfrom. MacOS is supporting..
.
1. C
urrently we support Linux and Windows platfrom. MacOS is supporting...
2. On Linux platform,
we recommend to use GCC 8.2 as soft linking condidate of ``/usr/bin/cc`` .
Then, Use ``which cc`` to ensure location of ``cc`` and using ``cc --version`` to ensure linking
GCC version
.
3.
On Windows platform, we recommend to install `` Visual Studio`` (>=2015 update3)
.
**A simple example:**
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录