Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ class DirectSolver_COO_MUMPS_Give : public DirectSolver

// Retrieves the stencil for the solver matrix at the given radial index.
const Stencil& getStencil(int i_r) const;

void nodeBuildSolverMatrixGive(int i_r, int i_theta, const PolarGrid& grid, bool DirBC_Interior,
SparseMatrixCOO<double>& solver_matrix, double arr, double att, double art,
double detDF, double coeff_beta);
};

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,8 @@ class DirectSolver_CSR_LU_Give : public DirectSolver
const Stencil& getStencil(int i_r) const;

int getStencilSize(int global_index) const;

void nodeBuildSolverMatrixGive(int i_r, int i_theta, const PolarGrid& grid, const bool DirBC_Interior,
SparseMatrixCSR<double>& solver_matrix, double arr, double att, double art,
double detDF, double coeff_beta);
};
30 changes: 10 additions & 20 deletions src/DirectSolver/DirectSolver-COO-MUMPS-Give/applySymmetryShift.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,35 +122,25 @@ void DirectSolver_COO_MUMPS_Give::applySymmetryShiftOuterBoundary(Vector<double>
}
}

// clang-format off
void DirectSolver_COO_MUMPS_Give::applySymmetryShift(Vector<double> x) const
{
assert(std::ssize(x) == grid_.numberOfNodes());
assert(grid_.nr() >= 4);

if (num_omp_threads_ == 1) {
/* Single-threaded execution */
if (DirBC_Interior_) {
applySymmetryShiftInnerBoundary(x);
}
applySymmetryShiftOuterBoundary(x);
}
else {
#pragma omp parallel sections num_threads(num_omp_threads_)
#pragma omp parallel sections num_threads(num_omp_threads_)
{
#pragma omp section
{
#pragma omp section
{
if (DirBC_Interior_) {
applySymmetryShiftInnerBoundary(x);
}
if (DirBC_Interior_) {
applySymmetryShiftInnerBoundary(x);
Comment on lines +134 to +135
Copy link
Collaborator

Choose a reason for hiding this comment

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

I wonder if we should make DirBC_Interior_ constexpr in the future. Do you have an opinion?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I am not that experienced with constexpr yet, but if you like to make this modification feel free to.

I would guess there is no performance gain due to the branch predictor disregarding the other path.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I would guess there is no performance gain due to the branch predictor disregarding the other path.

I have never studied the branch predictor in detail but you may well be right, especially after the first iteration.

I am not that experienced with constexpr yet, but if you like to make this modification feel free to.

In any case this would be for a separate PR

}
}

#pragma omp section
{
applySymmetryShiftOuterBoundary(x);
}
#pragma omp section
{
applySymmetryShiftOuterBoundary(x);
}
}
}
// clang-format on

#endif
Loading