Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Op refine for making build system more automatic #3852

Closed
wants to merge 32 commits into from
Closed

Op refine for making build system more automatic #3852

wants to merge 32 commits into from

Conversation

luotao1
Copy link
Contributor

@luotao1 luotao1 commented Sep 4, 2017

@luotao1 luotao1 requested a review from typhoonzero September 4, 2017 08:47
@@ -14,7 +14,7 @@

#define EIGEN_USE_GPU
#include "paddle/framework/op_registry.h"
#include "paddle/operators/add_op.h"
#include "paddle/operators/add_two_op.h"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious why rename to add_two_op?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because REGISTER_OP(add_two, ops::AddOp, ops::AddOpMaker, add_two_grad, ops::AddOpGrad); in add_op.cc, and USE_OP(add_two) in pybind.cc

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add_two_op seems odd, add_op may be more clear? Since we have mul_op.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, then I will revert and change add_two in REGISTER_OP and USE_OP to be add.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks very much!

gather_op
scatter_op)
foreach(src ${ONLYCPU_OPS})
op_library(${src} SRCS ${src}.cc)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this make it simpler if we make op_library smarter, just call op_library(${src}), then it can do the following:

find if have both .cc and .cu file, call cc_library and nv_library to add corresponding library.

So we can call op_library(${src}) for general ops and op_library(${src} DEPS xxx) for ops have dependencies.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right, I will refine it.

Most ops have the same name for .cc and .cu. But for recurrent_op, the ${src} is not recurrent_op.cc and recurrent_op.cu.

Thus, if ${src} is none, cmake will auto find ${src}.cc and ${src}.cu. If user specific ${src}, cmake will use what user specify.

@luotao1 luotao1 closed this Sep 5, 2017
@luotao1 luotao1 deleted the op_refine branch September 5, 2017 10:15
@luotao1 luotao1 restored the op_refine branch September 5, 2017 10:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Simplify operator development by making build system more automatic
6 participants