[Dune] dynamic_cast cost

Marco Cisternino marco.cisternino at optimad.it
Mon Nov 21 11:55:50 CET 2016


Hi Andreas,
I'll try to prepare a simple example even if a simple example would not put this cost in evidence, I think.
I experienced that cost by profiling my code, a finite volume discretization for Navier-Stokes equations. That dynamic_cast in updateFaceInfo costs 13% of the whole run (~5000 time iterations over ~2000 cells).
UpdateFaceInfo is called by
- Dune::LeafIntersectionIteratorWrapper<>::LeafIntersectionIteratorWrapper(LeafIntersectionIteratorWrapper<> const &)
- Dune::ALU3dGridIntersectionIterator<>::increment()

About your PS: can I replace dynamic_cast with reinterpret_cast without problems and see an improvement in performance?

Thank you for your help.


Marco Cisternino, PhD
marco.cisternino at optimad.it
_______________________________
OPTIMAD Engineering srl
Via Giacinto Collegno 18, Torino, Italia.
+3901119719782
www.optimad.it


________________________________________
Da: Andreas Dedner <a.s.dedner at warwick.ac.uk>
Inviato: giovedì 17 novembre 2016 10.49
A: dune at dune-project.org
Oggetto: Re: [Dune] dynamic_cast cost

Hi Marco.
Even if you can't port your own code it might be worthwhile to set up a
simple test case using
the newest version of dune and file a bug report. If we have a simple
case which demonstrates the problem we might be able to solve it (in
2.5) but if the files haven't changed that much perhaps you
can backport the fix? A lot of might and perhaps in that sentence of
course...
As Christoph says, we are not going to fix anything like this in ALU 1.5
any more I'm afraid - just not enough time.
Andreas
PS: why are you so sure that the dynamic_cast is causing the issues -
have you replaced it with a reinterpret_cast and seen the improvement?

On 17/11/16 09:34, Marco Cisternino wrote:
> Thank you Christoph,
> unfortunately, I have no time to porting the code to the newer versions of dune.
> In any case, I don't think it is a problem, I would say it is the way dune did the iterations on the intersections.
> I don't know if the newer versions changed the way to do this. In 2.4 it is exactly the same thing (same line same file different location in dune folders)!
> I don' t think it is a matter of version, but I didn't see the 2.5...
> Anyone using alugrid in any version until 2.4.1 can experience the cost of this dynamic_cast by looping over the intersections. Am I wrong?
> However, thank you for your reply.
> Bests,
>
> Marco Cisternino, PhD
> marco.cisternino at optimad.it
> _______________________________
> OPTIMAD Engineering srl
> Via Giacinto Collegno 18, Torino, Italia.
> +3901119719782
> www.optimad.it
>
>
> ________________________________________
> Da: Christoph Grüninger <christoph.grueninger at iws.uni-stuttgart.de>
> Inviato: giovedì 17 novembre 2016 09.32.51
> A: Marco Cisternino; dune at dune-project.org
> Oggetto: Re: [Dune] dynamic_cast cost
>
> Hi Marco,
> I cannot speak for others, but I doubt that ALUGrid 1.52 and
> Dune 2.3 will receive the kind of love you would need.
>
> It might be a good idea to create a minimal example that shows
> the problem with the most current dune-alugrid. Then you can
> open an issue in dune-alugrid's issue tracker.
> There is even a slim chance, that the problem does no longer
> exist in the current trunk. Then you can consider updating or
> investigating the changes for a pack-port.
>
> Bye
> Christoph
>
> --
> [..] Mathematicians are like theologians: we regard
> existence as the prime attribute of what we study.
> But unlike theologians, we need not always rely upon
> faith alone.                      [Lawrence Evans]
>
> _______________________________________________
> Dune mailing list
> Dune at dune-project.org
> http://lists.dune-project.org/mailman/listinfo/dune






More information about the Dune mailing list