-
Notifications
You must be signed in to change notification settings - Fork 94
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
Named lambda operation #1667
Named lambda operation #1667
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor typo. Otherwise looks good!
core/test/base/executor.cpp
Outdated
|
||
exec->run([] {}, [] {}, [] {}, [] {}); | ||
|
||
ASSERT_EQ("unname", name_logger->op_name); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ASSERT_EQ("unname", name_logger->op_name); | |
ASSERT_EQ("unnamed", name_logger->op_name); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I'm going to delete this test. The 'default' name is not really important, since we don't specify it publicly. Testing that value seems rather pointless.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it makes sense to test that the value returned is a valid string literal and not an invalid pointer (which would otherwise be very unlikely to be found)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
core/test/base/executor.cpp
Outdated
|
||
exec->run([] {}, [] {}, [] {}, [] {}); | ||
|
||
ASSERT_EQ("unname", name_logger->op_name); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it makes sense to test that the value returned is a valid string literal and not an invalid pointer (which would otherwise be very unlikely to be found)
@@ -659,6 +659,17 @@ class Executor : public log::EnableLogging<Executor> { | |||
this->run(op); | |||
} | |||
|
|||
template <typename ClosureOmp, typename ClosureCuda, typename ClosureHip, | |||
typename ClosureDpcpp> | |||
void run(std::string name, const ClosureOmp& op_omp, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding a new overload, would it make sense to extend this to include ReferenceExecutor
? We can't change the other one, since it would break interface
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would make sense, so I will add that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any ordering preference? I would add it before op_omp
, since I think we usually order them that way. But of course, this is then not compatible with the other overload.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds sensible, since this is a new overload. We can't add reference
to the other one though, since that would create ambiguities with the std::string parameter and the additional templated parameter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess we could think about deprecating the other overload. Adding a name to an operation seems quite useful, especially since all ginkgo kernels are already named.
6e3f78d
to
0b88ed4
Compare
- test only for existence of default name - add closure for reference op - deprecate lambda run without name Co-authored-by: Pratik Nayak <pratik.nayak@kit.edu> Co-authored-by: Tobias Ribizel <mail@ribizel.de>
0b88ed4
to
ac8bbdd
Compare
This merge adds an overload for `Executor::run`, which requires a name for the lambda operation, and also a reference lambda operation. The other overload has been deprecated. Related PR: ginkgo-project#1667
This PR enables the naming of lambda operations.