[Dune] [Dune-Commit] dune-istl r1546 - trunk/dune/istl/paamg

Christian Engwer christian.engwer at uni-muenster.de
Thu Apr 19 17:13:40 CEST 2012


Hi Rebecca,

are you aware of the MPIGuard?

This class helps you detect exceptions on one process and communicate
those to other processes to avoid dead-locks.

Cheers
Christian

On Thu, Apr 19, 2012 at 01:36:58PM +0200, rebecca at dune-project.org wrote:
> Author: rebecca
> Date: 2012-04-19 13:36:58 +0200 (Thu, 19 Apr 2012)
> New Revision: 1546
> 
> Modified:
>    trunk/dune/istl/paamg/amg.hh
> Log:
> communicate result of coarse solver to other processes, otherwise catching the exception leads to a deadlock
> 
> Modified: trunk/dune/istl/paamg/amg.hh
> ===================================================================
> --- trunk/dune/istl/paamg/amg.hh	2012-04-19 07:06:13 UTC (rev 1545)
> +++ trunk/dune/istl/paamg/amg.hh	2012-04-19 11:36:58 UTC (rev 1546)
> @@ -263,6 +263,7 @@
>        std::size_t level;
>        bool buildHierarchy_;
>        bool additive;
> +      bool coarsesolverconverged;
>        Smoother *coarseSmoother_;
>        /** @brief The verbosity level. */
>        std::size_t verbosity_;
> @@ -276,7 +277,8 @@
>        : matrices_(&matrices), smootherArgs_(smootherArgs),
>  	smoothers_(), solver_(&coarseSolver), scalarProduct_(0),
>  	gamma_(gamma), preSteps_(preSmoothingSteps), postSteps_(postSmoothingSteps), buildHierarchy_(false),
> -	additive(additive_), coarseSmoother_(), verbosity_(2)
> +	additive(additive_), coarsesolverconverged(true),
> +	coarseSmoother_(), verbosity_(2)
>      {
>        assert(matrices_->isBuilt());
>        
> @@ -292,7 +294,8 @@
>  	smoothers_(), solver_(&coarseSolver), scalarProduct_(0),
>  	gamma_(parms.getGamma()), preSteps_(parms.getNoPreSmoothSteps()), 
>          postSteps_(parms.getNoPostSmoothSteps()), buildHierarchy_(false),
> -	additive(parms.getAdditive()), coarseSmoother_(), verbosity_(parms.debugLevel())
> +	additive(parms.getAdditive()), coarsesolverconverged(true),
> +	coarseSmoother_(), verbosity_(parms.debugLevel())
>      {
>        assert(matrices_->isBuilt());
>        
> @@ -312,7 +315,8 @@
>        : smootherArgs_(smootherArgs),
>  	smoothers_(), solver_(), scalarProduct_(0), gamma_(gamma),
>  	preSteps_(preSmoothingSteps), postSteps_(postSmoothingSteps), buildHierarchy_(true),
> -	additive(additive_), coarseSmoother_(), verbosity_(criterion.debugLevel())
> +	additive(additive_), coarsesolverconverged(true),
> +	coarseSmoother_(), verbosity_(criterion.debugLevel())
>      {
>        dune_static_assert(static_cast<int>(M::category)==static_cast<int>(S::category),
>  			 "Matrix and Solver must match in terms of category!");
> @@ -341,7 +345,8 @@
>  	smoothers_(), solver_(), scalarProduct_(0), 
>          gamma_(criterion.getGamma()), preSteps_(criterion.getNoPreSmoothSteps()), 
>          postSteps_(criterion.getNoPostSmoothSteps()), buildHierarchy_(true),
> -	additive(criterion.getAdditive()), coarseSmoother_(), verbosity_(criterion.debugLevel())
> +	additive(criterion.getAdditive()), coarsesolverconverged(true),
> +	coarseSmoother_(), verbosity_(criterion.debugLevel())
>      {
>        dune_static_assert(static_cast<int>(M::category)==static_cast<int>(S::category),
>  			 "Matrix and Solver must match in terms of category!");
> @@ -666,8 +671,8 @@
>  	  solver_->apply(*update, *rhs, res);
>  	}
>  
> -	if(!res.converged)
> -	  DUNE_THROW(MathError, "Coarse solver did not converge");
> +	if (!res.converged)
> +	  coarsesolverconverged = false;
>        }else{
>  	// presmoothing
>          presmooth();
> @@ -685,7 +690,12 @@
>  #else
>          *lhs=0;
>  #endif	
> -	
> +
> +	if(matrix == matrices_->matrices().finest()){
> +	  coarsesolverconverged = matrices_->parallelInformation().finest()->communicator().prod(coarsesolverconverged);
> +	  if(!coarsesolverconverged)
> +	    DUNE_THROW(MathError, "Coarse solver did not converge");
> +	}
>  	// postsmoothing
>          postsmooth();
>          
> 
> 
> _______________________________________________
> Dune-Commit mailing list
> Dune-Commit at dune-project.org
> http://lists.dune-project.org/mailman/listinfo/dune-commit
> 




More information about the Dune mailing list