In general, we strive to make deal.II faster with new releases,
and for many cases that is also true as I can confirm from my
applications. I have ran step-23 on release 8.0 as well as the
current development sources and I can confirm that the new version
is slower on my machine. If I disable output of step-23, I get a
run time of 4.7 seconds for version 8.0 and 5.3 seconds for the
current version. After some investigations I found out that while
some solver-related operations got faster indeed (the problem with
16k dofs is small enough to run from L3 cache in my case), we are
slower in the FEValues::reinit() calls. This call appears in
VectorTools::create_right_hand_side() and the
VectorTools::interpolate_boundary_values in the time loop. The
reason for this is that we nowadays call
"MappingQGeneric::compute_mapping_support_points" also for the
bilinear mapping MappingQ1, which allocates and de-allocates a
vector. While this is uncritical on higher order mappings, in 2D
with linear shape functions the time spent there is indeed not
negligible. This is indeed unfortunate for your use case, but I
want to stress that the changes were made in the hope to make that
part of the code more reliable. Furthermore, those parts of the
code are not performance critical and not accurately tracked. It
is a rather isolated issue that got worse here, so from this
single example one definitely not say that we are going the wrong
direction as a project.
While there are plenty of things I could imagine to make this particular case more efficient in the application code, way beyond the performance of what the version 8.0 provided - note that I would not write the code like that if it were performance critical - the only obvious thing is that we could try to work around the memory allocations by not returning a vector in MappingQGeneric::compute_mapping_support_points but rather fill an existing array in MappingQGeneric::InternalData::mapping_support_points. Nobody of us developers has this high on the priority list right now, but we would definitely appreciate if some of our users, like you, wants to look into that. I could guide you to the right spots.
Best regards,
Martin
--
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see https://groups.google.com/d/forum/dealii?hl=en
---
You received this message because you are subscribed to the Google Groups "deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dealii+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Dear Dmitry,
Thanks for the info. This sounds interesting. May I ask some more
details: Are you using Q1 elements in your 2D model (this is the
element used in step-23)? I have not looked into your history
model, but I guess it can be adapted. Since your code is limited
by FEValues::get_function_values, I suggest you take a look at the
step-48 tutorial program. That code does indeed have
performance-tuned components. It requires a somewhat different
approach to write the loops, but it should pay off for
time-dependent cases, I expect a speedup of a factor 4-6 in 2D for
linear elements for the part corresponding to
FEValues::get_function_values and FEValues::reinit. I would be
happy to guide you more closely if this sounds applicable.
Best,
Martin
On 30-Dec-2017, at 11:40 PM, luca.heltai <luca....@gmail.com> wrote:I’m thinking of a matrix of size (n_quadrature_points x n_active_cells) x n_dofs, and then you slice the results cellwise instead of repeatedly calling get_function_values.
once:
M[q+active_cell_index*n_dofs_per_cell, i] = fe_values.shape_value(i,q);