auto generate USE_OP() in pybind.cc#4101
Merged
luotao1 merged 6 commits intoPaddlePaddle:developfrom Sep 14, 2017
luotao1:use_op
Merged
auto generate USE_OP() in pybind.cc#4101luotao1 merged 6 commits intoPaddlePaddle:developfrom luotao1:use_op
luotao1 merged 6 commits intoPaddlePaddle:developfrom
luotao1:use_op
Conversation
typhoonzero
reviewed
Sep 14, 2017
doc/howto/dev/new_op_cn.md
Outdated
| USE_NO_KENREL_OP(recurrent); | ||
| ``` | ||
|
|
||
| 编译器 [paddle/operators/CMakeLists.txt](https://github.com/PaddlePaddle/Paddle/blob/develop/paddle/operators/CMakeLists.txt) 会自动为Op绑定Python,生成[`paddle/pybind/pybind.h](https://github.com/PaddlePaddle/Paddle/blob/develop/paddle/pybind/pybind.h),绑定规则如下: |
Contributor
There was a problem hiding this comment.
这里是实现的细节了,感觉这些内容可以放到一个单独的md文件里,说明如何完成构建系统的。在这个开发文档中只需要在前面某个位置简单说明:“只需要paddle构建系统会根据文件名(*_op.h, *_op.cc, *_op.cu)自动构建op何其对应的python扩展。“
|
|
||
| - 为每个Op创建单独的`*_op.h`(如有)、`*_op.cc`和`*_op.cu`(如有)。不允许一个文件中包含多个Op,这将会导致编译出错。 | ||
| - 注册Op时的类型名,需要和该Op的名字一样。即不允许在`A_op.cc`里面,注册`REGISTER_OP(B, ...)`等,这将会导致单元测试出错。 | ||
| - 如果Op没有实现GPU Kernel,请不要创建空的`*_op.cu`,这将会导致单元测试出错。 |
Contributor
There was a problem hiding this comment.
可能有的op需要用一些公用的函数,但是也不是math库,能否创建一些非*_op.h格式的文件,然后这些op依赖这些文件呢?
Contributor
Author
There was a problem hiding this comment.
是可以创建一些非*_op的文件,比如目前的gather.h头文件,会补充进文档中,谢谢提醒。
luotao1
commented
Sep 14, 2017
doc/howto/dev/new_op_cn.md
Outdated
| USE_NO_KENREL_OP(recurrent); | ||
| ``` | ||
|
|
||
| 编译器 [paddle/operators/CMakeLists.txt](https://github.com/PaddlePaddle/Paddle/blob/develop/paddle/operators/CMakeLists.txt) 会自动为Op绑定Python,生成[`paddle/pybind/pybind.h](https://github.com/PaddlePaddle/Paddle/blob/develop/paddle/pybind/pybind.h),绑定规则如下: |
|
|
||
| - 为每个Op创建单独的`*_op.h`(如有)、`*_op.cc`和`*_op.cu`(如有)。不允许一个文件中包含多个Op,这将会导致编译出错。 | ||
| - 注册Op时的类型名,需要和该Op的名字一样。即不允许在`A_op.cc`里面,注册`REGISTER_OP(B, ...)`等,这将会导致单元测试出错。 | ||
| - 如果Op没有实现GPU Kernel,请不要创建空的`*_op.cu`,这将会导致单元测试出错。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fix #4055