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

palace::Mesh and libCEED quadrature data refactor #166

Merged
merged 32 commits into from
Jan 18, 2024

Conversation

sebastiangrimberg
Copy link
Contributor

@sebastiangrimberg sebastiangrimberg commented Jan 8, 2024

This PR aims to refactor the quadrature data construction for libCEED operators by precomputing the geometric factors (element Jacobian determinants, inverse, etc.) and using these in QFunctions rather than assembling and storing quadrature data for every operator. This also necessitates changing how material properties are handled as coefficients. The end result is improved memory usage and operator setup time (especially on GPUs, coming soon).

Summary of changes:

  • Add MaterialPropertyCoefficient class which contains a mapping from attribute to material property and a list of material properties. This also introduces the concept of different domain and boundary element attributes: The MFEM attributes (global, starting at 1, do not need to be contiguous) are associated with the mesh. There are now libCEED attributes which are local to a process and contiguous, and conversions between the two. MaterialPropertyOperator and MaterialPropertyCoefficient objects work with the libCEED attributes. For certain models with hundreds or even thousands of attributes, this improves scalability. This set of changes simplifies a lot of the models and their interaction with material properties (for example, boundary conditions with dependence on neighboring element material properties, see wave ports). It is fully functional with boundary SubMesh objects.
  • Add palace::Mesh class which composes an mfem::ParMesh with data for Palace (similar to palace::FiniteElementSpace which composes an mfem::ParFiniteElementSpace and libCEED objects). The palace::Mesh includes functionality for precomputing libCEED geometry factor quadrature data like the libCEED attributes and Jacobian data, to be used in QFunctions.
  • Refactor libCEED interface: Rewrite QFunctions to use geometry factor quadrature data, get rid of need for global object caches by attaching CeedBasis and CeedElemRestriction objects directly to their associated FiniteElementSpace. This makes up a lot of the large number of file changes, and the changes are the same across all files. The unit tests are comprehensive here and ensure correctness across all integrators. Performance against the previous implementation has been validated.

Resolves #122

@sebastiangrimberg sebastiangrimberg added enhancement New feature or request performance Related to performance labels Jan 8, 2024
@sebastiangrimberg sebastiangrimberg force-pushed the sjg/mat-coeff-revisions branch 2 times, most recently from 37672e3 to f17ab7d Compare January 9, 2024 00:56
@sebastiangrimberg sebastiangrimberg changed the base branch from sjg/mat-coeff-dev to main January 9, 2024 01:22
@sebastiangrimberg sebastiangrimberg marked this pull request as ready for review January 9, 2024 17:39
… handle material property coefficients on the mesh
…aredFaceTransformations and the need for passing around a local to shared face map
Copy link
Collaborator

@hughcars hughcars left a comment

Choose a reason for hiding this comment

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

Mostly just minor things, typos, range loops etc. There's the possibility of some a slightly different design on the restricted coefficients, and some slightly expanded or simplified interface on integrators. Suggestions on hughcars/mat-coeff-revisions use whatever you like. Almost certainly missed some stuff as this was a lot of files to read.

palace/fem/mesh.hpp Outdated Show resolved Hide resolved
palace/fem/mesh.hpp Show resolved Hide resolved
Comment on lines +127 to +131
for (auto it = bdr_attr_map.begin(); it != bdr_attr_map.end(); ++it)
{
Copy link
Collaborator

Choose a reason for hiding this comment

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

for (const auto &[k,v] : bdr_attr_map)
{
 loc_attr_list.Append(v);
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, but I don't think this is substantially better than the iterator-based for loop.

palace/fem/mesh.cpp Show resolved Hide resolved
palace/fem/mesh.cpp Show resolved Hide resolved
test/unit/main.cpp Show resolved Hide resolved
palace/fem/fespace.hpp Outdated Show resolved Hide resolved
// Use default
case config::LinearSolverData::SymFactType::METIS:
this->SetReorderingStrategy(strumpack::ReorderingStrategy::METIS);
// this->SetReorderingStrategy(strumpack::ReorderingStrategy::AND);
Copy link
Collaborator

Choose a reason for hiding this comment

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

debris

break;
case config::LinearSolverData::SymFactType::AMD:
this->SetReorderingStrategy(strumpack::ReorderingStrategy::AMD);
// this->SetReorderingStrategy(strumpack::ReorderingStrategy::MMD);
Copy link
Collaborator

Choose a reason for hiding this comment

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

debris?

palace/linalg/vector.hpp Outdated Show resolved Hide resolved
@sebastiangrimberg sebastiangrimberg merged commit 2960554 into main Jan 18, 2024
17 checks passed
@sebastiangrimberg sebastiangrimberg deleted the sjg/mat-coeff-revisions branch January 18, 2024 17:08
sebastiangrimberg added a commit that referenced this pull request Jan 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request performance Related to performance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Memory usage optimizations for partially assembled operators
2 participants