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

MPI Point-to-Point Refactoring + New Periodic BC Implementation #652

Merged
merged 86 commits into from
Apr 24, 2019

Conversation

economon
Copy link
Member

@economon economon commented Feb 15, 2019

Proposed Changes

Give a brief overview of your contribution here in a few sentences.

This is one for v7 and needs some testing. This PR contains a complete refactoring of the point-to-point MPI infrastructure and an entirely new implementation of the periodic BC for the FV solvers.

For the MPI refactoring:

  • All calls are abstracted to parent classes (geometry, solver, matrix), meaning we will remove all Set_MPI_* routines.
  • Point-to-point comms are all non-blocking calls that have been separated into InitiateComms() & CompleteComms(), so that, in theory, they can be overlapped with computation where possible. It would also be possible now to group the comms into larger messages easily. These optimizations are a next step (not for this PR).
  • Persistent communication schedules and memory are used throughout the calculation.
  • Results are the same, this is just a refactoring to improve performance, scalability, etc. while making the code much simpler and separating the periodic part.

For the periodic BC:

  • No longer need a preprocessing with SU2_MSH - use the original grid and just call SU2_CFD.
  • Adjacent periodic faces are now possible, e.g., triply-periodic cube.
  • Concept is now based on completing the residuals from partial control volumes on either side of a periodic face instead of creating extra halo cells.
  • All periodic comms have been separated from the MPI point-to-point comms and are performed first for consistency.

In a follow-up PR, I will remove many lines of code that are no longer needed (all Set_MPI_* routines, many outdated geometry routines, etc.)

Related Work

Resolve any issues (bug fix or feature request), note any related PRs, or mention interactions with the work of others, if any.

I could use some help with testing this one, in particular the rotational periodicity, which might still need some changes. Unfortunately, I do not have the original meshes for the periodic cases in the repo that are failing (other than Poiseuille)..

@salvovitale @LaSerpe @arubino: do you have the original grids for the periodic cases before adding the halos with SU2_MSH? I would like to make sure that everything is working ok for all previous capability.

All periodic meshes in the regressions have been updated for the new periodic BC, and a python script has been added to remove halo cells from old meshes that were preprocessed with SU2_MSH for the previous periodic BC implementation.

Resolves #550
Resolves #431
Resolves #416
Resolves #252

PR Checklist

Put an X by all that apply. You can fill this out after submitting the PR. If you have any questions, don't hesitate to ask! We want to help. These are a guide for you to know what the reviewers will be looking for in your contribution.

  • I am submitting my contribution to the develop branch.
  • My contribution generates no new compiler warnings (try with the '-Wall -Wextra -Wno-unused-parameter -Wno-empty-body' compiler flags).
  • My contribution is commented and consistent with SU2 style.
  • I have added a test case that demonstrates my contribution, if necessary.

…be generalized to all solvers and parallelization should be improved.
…sors, and eigenvalues. Both Euler and N-S operational. Fixed multiple bugs.
@economon
Copy link
Member Author

This PR is ready from my point of view. All periodic / turbomachinery meshes and regressions have been updated (thanks @salvovitale), and I can confirm they converge with the new periodic implementation. Only a few other regression tests needed to be updated due to the refactoring of the MPI, but they were very minor.

If the tests pass, then I recommend we merge very soon. Any final comments or reviews are most welcome.

@EduardoMolina
Copy link
Contributor

Hi Tom,

Thanks for this great PR. I have two notes:
a) I have one grid (flow around a high lift airfoil) where the periodic boundaries are not placed entirely on fix plane, like y=0.0, but on a very small value and fluctuates around, i.e. y~1.e-5. Now, many bad match points are found in the last commit of this PR. Previously, I was able to run the same mesh in a different commit. Do you change the tolerance of the search algorithm? Or I need to make sure now that all the periodic BC nodes must be placed on a fix plane.
b) I would like to share the results of the Taylor Green Vortex with the community. Indeed, the results are good and they are comparable with the reference DNS solution.
SU2_TGV_DissipationRate

Thank you one more time.

Best,

Eduardo

Copy link
Contributor

@rsanfer rsanfer left a comment

Choose a reason for hiding this comment

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

LGTM, @economon, thanks so much for this great effort. Really looking forward to that follow-up PR that will remove all the Set_MPI_*** routines.

Practical aspect: @economon @pcarruscag let me know how you want to handle merging this and #653, as they are both ready to go in but there will be some small conflicts.

@economon
Copy link
Member Author

@EduardoMolina : Nice results! Thanks for the comments. You are seeing more warnings bc I did in fact change the tolerance that controls the warning. But, note that this tolerance only controls when to print the warnings, so the matches should have still be the same (nearest neighbor after transformation).

The reason is that the new implementation assumes a 1-to-1 matching of the nodes and surface elements on either side of the periodic face. To be consistent, the points/faces on either side should match exactly so that they can be summed into a complete dual control volume (this assumption is made in the implementation and the partial residuals are summed as such).

Nice catch on the fem_solver check. I will add that to the conditional.

Thanks for the review @rsanfer. I will submit the final version shortly and if the tests pass, I would propose we merge this one first, if alright with @pcarruscag (the reason being that I would likely need your help to update the implementation for templating in the end anyway :) ).

@economon
Copy link
Member Author

Thanks for the input, everyone. Time to finally merge this one.

@pcarruscag : let's finish up #653 as a next step and get that merged asap. I can help fix up any conflicts in the matrix classes.

Copy link
Contributor

@TobiKattmann TobiKattmann left a comment

Choose a reason for hiding this comment

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

A bit late to the party, I guess...
I thought i better submit that now instead of not submitting at all.
Most of it is quite pedantic.

@@ -144,6 +144,7 @@ class CConfig {
Sens_Remove_Sharp, /*!< \brief Flag for removing or not the sharp edges from the sensitivity computation. */
Hold_GridFixed, /*!< \brief Flag hold fixed some part of the mesh during the deformation. */
Axisymmetric, /*!< \brief Flag for axisymmetric calculations */
TaylorGreen,
Copy link
Contributor

Choose a reason for hiding this comment

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

Description missing

@@ -5986,6 +5987,8 @@ class CConfig {
*/
bool GetAxisymmetric(void);

bool GetTaylorGreen(void);
Copy link
Contributor

Choose a reason for hiding this comment

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

Description missing + indentation

bool Domain, /*!< \brief Indicates if a point must be computed or belong to another boundary */
Boundary, /*!< \brief To see if a point belong to the boundary (including MPI). */
PhysicalBoundary, /*!< \brief To see if a point belong to the physical boundary (without includin MPI). */
SolidBoundary; /*!< \brief To see if a point belong to the physical boundary (without includin MPI). */
SolidBoundary, /*!< \brief To see if a point belong to the physical boundary (without includin MPI). */
Copy link
Contributor

Choose a reason for hiding this comment

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

Copied description.
including instead includin.
Difference between solid and physical not clear to me.

@@ -380,7 +421,86 @@ class CGeometry {
* \brief Destructor of the class.
*/
virtual ~CGeometry(void);

/*!
Copy link
Contributor

Choose a reason for hiding this comment

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

2x brief, not sure if that has a meaning within doxygen?

@@ -715,6 +835,12 @@ class CGeometry {
*/
virtual void MatchInterface(CConfig *config);

/*!
* \brief A virtual member.
* \param[in] config - Definition of the particular problem.
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing input val_periodic. Can be copied from the non-virtual MatchPeriodic from l. 2119

* \param[in] config - Definition of the particular problem.
* \param[in] val_periodic - Index of the first periodic face in a pair.
*/
void MatchPeriodic(CConfig *config, unsigned short val_periodic);
Copy link
Contributor

Choose a reason for hiding this comment

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

Input parameters as a list

@@ -191,10 +191,11 @@ class CSysSolve {
* \param[in] tol - tolerance with which to solve the system
* \param[in] m - maximum size of the search subspace
* \param[in] monitoring - turn on priting residuals from solver to screen.
* \param[in] config - Definition of the particular problem.
*/
unsigned long CG_LinSolver(const CSysVector & b, CSysVector & x, CMatrixVectorProduct & mat_vec,
Copy link
Contributor

Choose a reason for hiding this comment

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

Input parameters as a list

@@ -206,10 +207,11 @@ class CSysSolve {
* \param[in] m - maximum size of the search subspace
* \param[in] residual
* \param[in] monitoring - turn on priting residuals from solver to screen.
* \param[in] config - Definition of the particular problem.
*/
unsigned long FGMRES_LinSolver(const CSysVector & b, CSysVector & x, CMatrixVectorProduct & mat_vec,
Copy link
Contributor

Choose a reason for hiding this comment

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

Input parameters as a list

@@ -221,10 +223,11 @@ class CSysSolve {
* \param[in] m - maximum size of the search subspace
* \param[in] residual
* \param[in] monitoring - turn on priting residuals from solver to screen.
* \param[in] config - Definition of the particular problem.
*/
unsigned long BCGSTAB_LinSolver(const CSysVector & b, CSysVector & x, CMatrixVectorProduct & mat_vec,
Copy link
Contributor

Choose a reason for hiding this comment

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

Input parameters as a list

@@ -57,7 +57,7 @@ vector<double> GEMM_Profile_MaxTime; /*!< \brief Maximum time spent for thi
#include "../include/ad_structure.hpp"
#include "../include/toolboxes/printing_toolbox.hpp"

CConfig::CConfig(char case_filename[MAX_STRING_SIZE], unsigned short val_software, unsigned short val_iZone, unsigned short val_nZone, unsigned short val_nDim, unsigned short verb_level) {
CConfig::CConfig(char case_filename[MAX_STRING_SIZE], unsigned short val_software, unsigned short val_iZone, unsigned short val_nZone, unsigned short val_nDim, bool verb_high) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Input parameters as a list

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants