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

Named lambda operation #1667

Merged
merged 4 commits into from
Aug 29, 2024
Merged

Named lambda operation #1667

merged 4 commits into from
Aug 29, 2024

Conversation

MarcelKoch
Copy link
Member

This PR enables the naming of lambda operations.

@MarcelKoch MarcelKoch self-assigned this Aug 15, 2024
@MarcelKoch MarcelKoch requested a review from a team August 15, 2024 09:52
@ginkgo-bot ginkgo-bot added reg:testing This is related to testing. mod:core This is related to the core module. labels Aug 15, 2024
@MarcelKoch MarcelKoch added the 1:ST:ready-for-review This PR is ready for review label Aug 15, 2024
Copy link
Member

@pratikvn pratikvn left a 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!


exec->run([] {}, [] {}, [] {}, [] {});

ASSERT_EQ("unname", name_logger->op_name);
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
ASSERT_EQ("unname", name_logger->op_name);
ASSERT_EQ("unnamed", name_logger->op_name);

Copy link
Member Author

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.

Copy link
Member

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)

Copy link
Member

@upsj upsj left a comment

Choose a reason for hiding this comment

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

LGTM!


exec->run([] {}, [] {}, [] {}, [] {});

ASSERT_EQ("unname", name_logger->op_name);
Copy link
Member

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,
Copy link
Member

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

Copy link
Member Author

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.

Copy link
Member Author

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.

Copy link
Member

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.

Copy link
Member Author

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.

@MarcelKoch MarcelKoch added this to the Ginkgo 1.9.0 milestone Aug 26, 2024
@MarcelKoch MarcelKoch requested review from pratikvn and removed request for pratikvn August 27, 2024 12:01