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

Add documentation about the functional algorithms #50

Merged
merged 5 commits into from
Oct 9, 2023
Merged

Conversation

jmcarcell
Copy link
Member

BEGINRELEASENOTES

  • Add documentation about the functional algorithms in Gaudi

ENDRELEASENOTES

Copy link
Contributor

@tmadlener tmadlener left a comment

Choose a reason for hiding this comment

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

Very nice summary. I was planning on introducing a How-To section where things like functional could go. We can always reshuffle this to that afterwards.

## Setup
We will need Gaudi, k4FWCore and all their dependencies. Installing these by
ourselves is not easy but there are software stacks on cvmfs, see the
{doc}`/setup-and-getting-started/README.md` to set up the key4hep stack.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
{doc}`/setup-and-getting-started/README.md` to set up the key4hep stack.
{doc}`/setup-and-getting-started/README.md` to set up the key4hep stack.

Should this be a link?

Copy link
Member Author

Choose a reason for hiding this comment

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

But that's a link, right? At least we have it like that in other parts of the documentation to link to other parts of the documentation

Copy link
Contributor

Choose a reason for hiding this comment

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

I think a link should be [text](dest) . At least the current form doesn't render as a link in the github markdown viewer (maybe it does when run through sphinx?)

Comment on lines +301 to +310
## Avoiding const in `operator()`
There is a way of working around `operator()` being const and that is by adding
the keyword `mutable` to our data member. This will allow us to change our data
member inside `operator()` and will cause code that wasn't compiling because of
this to compile. Of course, this is not a good idea because unless the member of
our class is thread-safe, that means that our algorithm is no longer thread-safe
and running with multiple threads can cause different results. Even worse than
that, it's very possible that there are not any errors or crashes but the
results are simply wrong from having several threads changing a member at the
same time, for example.
Copy link
Contributor

Choose a reason for hiding this comment

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

I am not sure whether we should actually mention this. People who need to modify internal state will (most likely) know this, and people who don't know this probably shouldn't be using mutable ;) Maybe, there should rather be a paragraph explaining where setup work can be done (does Functional still have an initialize?)

Copy link
Member Author

Choose a reason for hiding this comment

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

But hiding it won't make people not use mutable so I'd rather keep it so that if someone reads that at least they know what are the consequences, because people adding mutable so that the code compiles has already happened in experiments that use Gaudi. On top of that there will be places where it will be necessary to use mutable, like histogramming

Copy link
Contributor

Choose a reason for hiding this comment

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

Fair enough.

@jmcarcell
Copy link
Member Author

The documentation is not fully complete; there are other topics like histogramming that I should add at some point but I think for now this is a decent reference

@tmadlener
Copy link
Contributor

Yeah, I think this is in a decent shape and we can add more things later.

@jmcarcell jmcarcell merged commit f85a3df into main Oct 9, 2023
3 checks passed
@jmcarcell jmcarcell deleted the functional branch October 9, 2023 09:50
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.

2 participants