-
Notifications
You must be signed in to change notification settings - Fork 17
New collcommobj #329
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
base: master
Are you sure you want to change the base?
New collcommobj #329
Conversation
Where possible an ifdef was added. So, depending on the cmake flag for ENABLE_PERSISTENT, the code is compiled differently.
Signed-off-by: Christoph Niethammer <niethammer@hlrs.de>
…onfig Move cmake configuration for persistent collectives into the mpi module
This updated wrapper has an improved interface and is more compact due to the environment class being internal.
This function does not clear the forces in the SoA structure.
This reverts commit 4ba2dff.
This reverts commit 813b6ec.
This reverts commit 3adc768.
FG-TUM
left a comment
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.
Impressive template magic :D
Can you explain in the main text of the PR why all of this is "just" behind an ifdef and why we can't simply get rid of the old communicator class?
Previously it was named Coll_Comm_Obj, but most of ls1 follows camel case, so the name was adjusted.
The CollectiveCommunicationPersistent.h and CollectiveCommunicationPersistent_helper.h will now always be included, if ENABLE_MPI is set. This was done to get rid of the ifdef-endif blocks enclosing all collective communication calls. The ENABLE_PERSISTENT was moved inside the CollCommObj class to determine if a persistent collective communication call is to be used. The implementation of CollCommObj also changed because of that. Now the persistent collective and the normal collective functions share exactly the same interface with the only difference being the ENABLE_PERSISTENT determining which is used. The new communicate() functions now start all types of collective communication, therefore is it no longer possible to omit the collective function type at construction and give it during communication.
The function now returns a tuple of the received data. This change makes it obvious that data is returned from this function. Another advantage is that with structured bindings (C++ 17) the returned tuple can be used to declare the variables into which the tuple values should be copied (see docu in CollectiveCommunicationPersistent.h for more detail).
This was done to match the style of the rest of the code.
The Deallocator class was replaced with the MPI_Environment class which wraps the MPI_Init, MPI_Init_thread and MPI_Finalize functions. This new approach to control the destruction of the static data members is more concise than the previous approach.
These functions were used to create a CollCommObj, but make little sense to use. So, they were removed.
The template argument was not necessary for the template deductions and was replaced with a normal constructor argument. The mutex data member was also removed.
Update to the documentation concerning recent commits. The code formatting was also updated to be in line with javadoc style and the rest of the code.
| numMolecules = domainDecomp->collCommGetUnsLong(); | ||
| rotDOF = domainDecomp->collCommGetUnsLong(); | ||
| domainDecomp->collCommFinalize(); | ||
| auto collComm = makeCollCommObjAllreduceAdd(domainDecomp->getCommunicator(), summv2, sumIw2, numMolecules, rotDOF); |
Check notice
Code scanning / CodeQL
Declaration hides variable Note
line 175
| for(int d=0; d < 3; d++) sigv[d] = domainDecomp->collCommGetDouble(); | ||
| domainDecomp->collCommFinalize(); | ||
|
|
||
| auto collComm = makeCollCommObjAllreduceAdd(domainDecomp->getCommunicator(), sigv[0], sigv[1], sigv[2]); |
Check notice
Code scanning / CodeQL
Declaration hides variable Note
line 175
Variable collComm hides another variable of the same name (on
line 215
This should get rid an error occurring with the static variables.
Added a fake getCommunicator function in DomainDecompBase.h. Added a FakeCollCommObj which does nothing but satisfies the interface of the non-fake object. Also added creation functions for the fake object that match the non-fake ones.
Previously the MPI communicator was stored as a separate member, but it is now part of the MPI_Members member. This was done because it makes code clearer to store members with similar usage together. There was a check added to the CollCommObj constructor that checks, if the given communicator has been changed (this is especially important to pass all tests). The MPI_Members members has been reverted to a pointer. This was done to fix the MPI_x_free after MPI_Finalize issue.
# Conflicts: # tools/gui/generators/CubicGridGenerator.cpp # tools/gui/generators/RayleighTaylorGenerator.cpp
Signed-off-by: Christoph Niethammer <niethammer@hlrs.de>
cniethammer
left a comment
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.
Just some minor suggestions to be included.
LGTM
Co-authored-by: Christoph Niethammer <cniethammer@users.noreply.github.com>
Co-authored-by: Christoph Niethammer <cniethammer@users.noreply.github.com>
Co-authored-by: Christoph Niethammer <cniethammer@users.noreply.github.com>
Co-authored-by: Christoph Niethammer <cniethammer@users.noreply.github.com>
Co-authored-by: Christoph Niethammer <cniethammer@users.noreply.github.com>
Co-authored-by: Christoph Niethammer <cniethammer@users.noreply.github.com>
…nto new_collcommobj
Description
Implemented persistent communication class. This class can also be used to replace most of the already present collective communication in the code.
Related Pull Requests
Resolved Issues
How Has This Been Tested?
Tested with Spinodal Decomposition example and unit tests.