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

patchkernel: initialize partitioning in the constructor #82

Merged
merged 22 commits into from
Jan 26, 2021

Conversation

andrea-iob
Copy link
Member

Setting the communicator can now be done only when the patch is partitioned.

@andrea-iob andrea-iob force-pushed the patchkernel.protect.communicator.changes branch from 62738e1 to a5cb992 Compare August 26, 2020 18:43
@andrea-iob andrea-iob added this to the 1.7 milestone Sep 12, 2020
@andrea-iob andrea-iob force-pushed the patchkernel.protect.communicator.changes branch 2 times, most recently from 2b34dc7 to fa0adff Compare September 27, 2020 08:24
@andrea-iob andrea-iob force-pushed the patchkernel.protect.communicator.changes branch from fa0adff to 2e324ba Compare November 19, 2020 15:49
@andrea-iob andrea-iob force-pushed the patchkernel.protect.communicator.changes branch 2 times, most recently from 340b7c2 to 3cc064e Compare December 20, 2020 22:00
@andrea-iob andrea-iob force-pushed the patchkernel.protect.communicator.changes branch from 3cc064e to 8378252 Compare January 4, 2021 10:12
@andrea-iob
Copy link
Member Author

After some back and forth, I think the best solution is to initialize partitioning in the constructor. I've updated the constructors of the patches that support partitioning to accept the extra arguments needed to initialize the partitioning.

For now, it is still possible to initialize a serial patch and the partition the patch later, but this will not be possible in bitpit v1.8.

@edoardolombardi @marcocisternino Do you see any problem in this approach?

@andrea-iob andrea-iob changed the title patchkernel: declare functions that modifiy the communicator as protected patchkernel: initialize partitioning in the constructor Jan 4, 2021
@andrea-iob
Copy link
Member Author

@edoardolombardi @marcocisternino I had to make some changes in PABLO to allow moving all the octants on the first process during in the constructor. Please check if the changes look fine. I think they may be still some issues when the partitioning moves all the octants on a rank that is not the first one. This is something that should not happen with the current code, but, if this is something we want to support, some additional work may be needed.

@andrea-iob andrea-iob force-pushed the patchkernel.protect.communicator.changes branch 2 times, most recently from 82b4532 to 716c2af Compare January 4, 2021 18:18
@andrea-iob andrea-iob force-pushed the patchkernel.protect.communicator.changes branch from 716c2af to 0e259e1 Compare January 19, 2021 06:38
@@ -1520,17 +1552,7 @@ void PatchKernel::partitioningCleanup()
*/
bool PatchKernel::isPartitioned() const
Copy link
Member

Choose a reason for hiding this comment

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

Should this wrapper function isPartitioned used at the place of isCommunicatorSet function? In this case is it better to use it everywhere even in PatchKernel and its derived classes to avoid the procreation of re-coding around, in case of change in the wrapper function?

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

Please note that some functions that handle the communicator may be simplified when the deprecated partitioning functions (the ones that take the communicator as argument) are be removed.

@andrea-iob andrea-iob force-pushed the patchkernel.protect.communicator.changes branch from 0e259e1 to a6d686a Compare January 19, 2021 10:29
@edoardolombardi
Copy link
Member

Copy link
Member

@edoardolombardi edoardolombardi left a comment

Choose a reason for hiding this comment

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

@andrea-iob just check my previous comments before merging, please.

@andrea-iob andrea-iob force-pushed the patchkernel.protect.communicator.changes branch from a6d686a to 944401d Compare January 19, 2021 17:17
@andrea-iob
Copy link
Member Author

* [#82 (comment)](https://github.com/optimad/bitpit/pull/82#issuecomment-753887911)  For me it's ok. One limitation that I see: in case of restore of a patch the user has to know a-priori if the restoring patch has been constructed as parallel or serial. This can be a problem?

The same limitation exists in the current master: the restore function has to be called by the same number of processes that have called the dump function, this means that for restoring a patch it is necessary to know how it was dumped. To overcome this limitation, dump and restore should be handled by the PatchManager. Before dumping the patch, the manager could write some additional information that can later be used to identify how the patch should be restored. This will also allow to restore a patch without knowing the type of the patch (e.g., VolOctree, SurFunstructured, ...).

@andrea-iob andrea-iob force-pushed the patchkernel.protect.communicator.changes branch from 944401d to 79b0f3f Compare January 20, 2021 20:32
@andrea-iob
Copy link
Member Author

I fixed the evaluation of PABLO maximum depth when the tree is empty. Also, it seems that the maximum depth was not updated after coarsening. @marcocisternino @edoardolombardi Could you please check if the changes are fine ("PABLO: fix evaluation of maximum depth when the tree is emtpy" 84f4096 and "PABLO: update maximum depth after coarsening the tree" fb5e42a)?

Indexes are declared as std::size_t, they cannot be less than zero.
If a valid communicator is passed to the constructor, a partitioned
patch will be created, otherwise the created patch will be serial.

Patches that are filled automatically (e.g. VolOctree) will initialize
the cells only on the process identified by the rank zero in the
communicator.
@andrea-iob andrea-iob force-pushed the patchkernel.protect.communicator.changes branch from 79b0f3f to 6620ad4 Compare January 26, 2021 07:12
@marcocisternino
Copy link
Member

Max local depth fixing seems good to me. I tested the branch with a complex mesh using CFD solver. No problem found.

@andrea-iob andrea-iob merged commit 6620ad4 into master Jan 26, 2021
@andrea-iob andrea-iob deleted the patchkernel.protect.communicator.changes branch January 26, 2021 14:54
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.

3 participants