You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We should introduce the same for the FEFaceValues (geometry part). The reason for this is that the constructor of FEFaceValues is very expensive for higher mapping degrees and many quadrature points. More precisely, if we have a MappingQGeneric description of degree p and r quadrature points per direction, the initialization in 3D evaluates (p+1)^3 polynomials on r^2 points, storing a table of (p+1)^3 r^2 values. What makes things worse is that we store this information on all 6 faces and with all 8 possible values for the face orientation, so a total of 48 (p+1)^3 r^2 data items need to be evaluated by TensorProductPolynomials and stored. To give a number, for p=15 and r=20 this equates to 630 MB - just that part of FEFaceValues! Parallelization won't help because we construct a separate FEFaceValues on all threads and all MPI ranks. This level of memory consumption makes this a blocker. The PR #9656 circumvented this problem for the setup of MatrixFree, which is one of the primary users of high mapping degrees and quadrature formulas with many degrees, but it would of course be better that we also provide this in other contexts, rather than saying we can't use deal.II for those degrees and quadrature formulas.
This needs the following ingredients:
We need to extract the reordering tables for adjusting for the face orientation from the matrix-free context to a static function:
for (unsignedint face = 0; face < n_faces; ++face)
std::copy(mutation.get_weights().begin(),
mutation.get_weights().end(),
std::back_inserter(weights));
}
Once we have convinced ourselves that we have a tensor product quadrature formula, which needs some restructuring in the internals of MappingQGeneric, we can set up a ShapeInfo similarly to the cell case.
For the evaluation part, we would make a call in analogy to this one:
Note that #15035 can address this from another angle: While slightly less efficient than the full tensor product path, that PR addresses the fundamental problem of that function with high orders. With some optimizations that @bergbauer is already planning for in terms of the faces, we might end up with an algorithm of complexity mapping_degree^2 x n_q_points, which is not much worse than the best case mapping_degree x n_q_points, but without having to check the face quadrature formula at all.
Once #15035 is addressed, we should revisit this PR and evaluate the performance and memory consumption, it looks like we can skip the high memory consumption mentioned in the original post.
MappingQGeneric
already supports the fast tensorized evaluation of quantities on cells via the codedealii/source/fe/mapping_q_generic.cc
Lines 1555 to 1565 in f40be01
We should introduce the same for the FEFaceValues (geometry part). The reason for this is that the constructor of
FEFaceValues
is very expensive for higher mapping degrees and many quadrature points. More precisely, if we have aMappingQGeneric
description of degreep
andr
quadrature points per direction, the initialization in 3D evaluates(p+1)^3
polynomials onr^2
points, storing a table of(p+1)^3 r^2
values. What makes things worse is that we store this information on all 6 faces and with all 8 possible values for the face orientation, so a total of48 (p+1)^3 r^2
data items need to be evaluated byTensorProductPolynomials
and stored. To give a number, for p=15 and r=20 this equates to 630 MB - just that part of FEFaceValues! Parallelization won't help because we construct a separateFEFaceValues
on all threads and all MPI ranks. This level of memory consumption makes this a blocker. The PR #9656 circumvented this problem for the setup ofMatrixFree
, which is one of the primary users of high mapping degrees and quadrature formulas with many degrees, but it would of course be better that we also provide this in other contexts, rather than saying we can't use deal.II for those degrees and quadrature formulas.This needs the following ingredients:
dealii/include/deal.II/matrix_free/mapping_info.templates.h
Lines 86 to 107 in f40be01
dealii/source/fe/mapping_q_generic.cc
Line 707 in f40be01
but here we have already expanded into all quadrature variants without tensor product here due to:
dealii/source/fe/mapping_q_generic.cc
Lines 2724 to 2726 in f40be01
For background information, the expansion into the 48 cases happens here (it is even worse for the subface values):
dealii/source/base/quadrature.cc
Lines 871 to 886 in f40be01
MappingQGeneric
, we can set up aShapeInfo
similarly to the cell case.dealii/include/deal.II/matrix_free/mapping_info.templates.h
Lines 1973 to 1993 in f40be01
Note that we here feed the orientation table and the right orientation, and we can also provide an index for the subface values.
The text was updated successfully, but these errors were encountered: