[dune-pdelab] [dune-pdelab-commit] dune-pdelab r1990 - trunk/dune/pdelab/gridoperator/common

Christian Engwer christian.engwer at uni-muenster.de
Mon Apr 23 11:54:07 CEST 2012


Hallo liebe PDELab Mitentwickler,

ich sehe gerade, dass Peter beginnt einige Performance-Optimierungen
an PDELab durchzuführen. Ich denke generell ist das super, wir haben
aber gerade zwei zunehmend divergierende Zweige. 

Wie wollen wir hier verfahren?

Ich denke die Umstrukturierungen durch die Multi-Indizies haben
einiges an Übersichtlichkeit gebracht, so dass Optimierungen leichter
fallen, ausserdem würde ich mir wünschen, dass der MultiIndex-Zweig
demnächst der Hauptzweig wird; bzw. entsprechend gemerged wird. Das
bringt mich dann auch genau zu dem Problem... Substantielle Änderungen
an der GFSs und GOs werden uns das Mergen sehr schwer machen und wir
werden im Zweifel manche Optimierungen doppelt machen müssen. Wenn es
zeitlich nicht anders geht müssen wir einfach in den sauren Apfel
beissen, wenn es eigentlich nicht drängt halte ich es für sinnvoller
erst über das weitere Vorgehen bzgl. MultiIndex zu diskutieren, bevor
wir eine neue GFS/GO Baustelle öffnen.

Ciao
Christian


On Mon, Apr 23, 2012 at 11:23:37AM +0200, peter at conan.iwr.uni-heidelberg.de wrote:
> Author: peter
> Date: Mon Apr 23 11:23:36 2012
> New Revision: 1990
> URL: http://svn.dune-project.org/websvn/listing.php?repname=dune-pdelab&path=/&rev=1990&sc=1
> 
> Log:
> first optimizations to reduce number of finds
> 
> Modified:
>    trunk/dune/pdelab/gridoperator/common/assemblerutilities.hh
> 
> Modified: trunk/dune/pdelab/gridoperator/common/assemblerutilities.hh
> ==============================================================================
> --- trunk/dune/pdelab/gridoperator/common/assemblerutilities.hh	Sun Apr 22 20:01:03 2012	(r1989)
> +++ trunk/dune/pdelab/gridoperator/common/assemblerutilities.hh	Mon Apr 23 11:23:36 2012	(r1990)
> @@ -264,26 +264,42 @@
>  
>          typename B::template Accessor<LFSV,LFSU,T> accessor(globalcontainer,lfsv,lfsu);
>  
> -        for (size_t i=0; i<lfsv.size(); i++)
> -          for (size_t j=0; j<lfsu.size(); j++){
> +        typedef typename CV::const_iterator global_vcol_iterator;
> +        typedef typename global_vcol_iterator::value_type::second_type global_vrow_type;
> +        typedef typename global_vrow_type::const_iterator global_vrow_iterator;
> +
> +        typedef typename CU::const_iterator global_ucol_iterator;
> +        typedef typename global_ucol_iterator::value_type::second_type global_urow_type;
> +        typedef typename global_urow_type::const_iterator global_urow_iterator;
> +
> +        // for (size_t i=0; i<lfsv.size(); i++) 
> +        //   for (size_t j=0; j<lfsu.size(); j++)
> +        //     accessor.add(i,j,localcontainer(lfsv,i,lfsu,j));
> +        // return;
> +
> +        // cache for row iterators
> +        const CV & cv = *pconstraintsv;
> +        std::vector<global_vcol_iterator> gvcit_cache(lfsv.size());
> +        for (size_t i=0; i<lfsv.size(); i++) {
>              SizeType gi = lfsv.globalIndex(i);
> -            SizeType gj = lfsu.globalIndex(j);
> +            gvcit_cache[i] = cv.find(gi);
> +          }
>  
> -            // Get global constraints containers for test and ansatz space
> -            const CV & cv = *pconstraintsv;
> -            const CU & cu = *pconstraintsu;
> -
> -            typedef typename CV::const_iterator global_vcol_iterator;
> -            typedef typename global_vcol_iterator::value_type::second_type global_vrow_type;
> -            typedef typename global_vrow_type::const_iterator global_vrow_iterator;
> -
> -            typedef typename CU::const_iterator global_ucol_iterator;
> -            typedef typename global_ucol_iterator::value_type::second_type global_urow_type;
> -            typedef typename global_urow_type::const_iterator global_urow_iterator;
> -
> -            // Check whether the global indices are constrained indices
> -            global_vcol_iterator gvcit = cv.find(gi);
> -            global_ucol_iterator gucit = cu.find(gj);
> +        // cache for column iterators
> +        const CU & cu = *pconstraintsu;
> +        std::vector<global_ucol_iterator> gucit_cache(lfsu.size());
> +        for (size_t j=0; j<lfsu.size(); j++){
> +          SizeType gj = lfsu.globalIndex(j);
> +          gucit_cache[j] = cu.find(gj);
> +        }
> +
> +        for (size_t i=0; i<lfsv.size(); i++) {
> +          SizeType gi = lfsv.globalIndex(i);
> +          global_vcol_iterator gvcit = gvcit_cache[i];
> +          
> +          for (size_t j=0; j<lfsu.size(); j++){
> +            SizeType gj = lfsu.globalIndex(j);
> +            global_ucol_iterator gucit = gucit_cache[j];
>  
>              // Set constrained_v true if gi is constrained dof
>              bool constrained_v(false);
> @@ -354,6 +370,7 @@
>              }while(true);
>  
>            }
> +        }
>        }
>  
>        /** \brief Adding matrix entry to pattern with respect to the
> 
> _______________________________________________
> dune-pdelab-commit mailing list
> dune-pdelab-commit at dune-project.org
> http://lists.dune-project.org/mailman/listinfo/dune-pdelab-commit
> 




More information about the dune-pdelab mailing list