[petsc-users] Unreproducible number of iterations for consecutives solves (GCR + ML)

Karl Rupp rupp at mcs.anl.gov
Thu Jun 27 10:55:07 CDT 2013


Hi,

running a
  `find externalpackages/ml/src/ | xargs grep rand`
returns quite a number of hits, for example

src/Coarsen/ml_agg_uncoupled.c:      ML_randomize(Nrows, randomVector);
src/Coarsen/ml_aggregate.c:      ML_random_vec(&dtemp,1,Amat->comm);
src/Coarsen/ml_aggregate.c:      ML_random_vec(&dtemp,1,Amat->comm);
src/Coarsen/ml_aggregate.c:  ML_random_global_subset(mat, 5.,&the_list, 
&the_length, num_PDE_eqns);

src/Utils/ml_MultiLevelPreconditioner.cpp:      // put random values
src/Utils/ml_MultiLevelPreconditioner.cpp: 
field_of_values->R_coeff[0] =  (double)rand()/RAND_MAX;
src/Utils/ml_MultiLevelPreconditioner.cpp: 
field_of_values->R_coeff[1] =  (double)rand()/RAND_MAX;
src/Utils/ml_MultiLevelPreconditioner.cpp: 
field_of_values->R_coeff[2] =  (double)rand()/RAND_MAX;
src/Utils/ml_MultiLevelPreconditioner.cpp: 
field_of_values->P_coeff[0] =  (double)rand()/RAND_MAX;
src/Utils/ml_MultiLevelPreconditioner.cpp: 
field_of_values->P_coeff[1] =  (double)rand()/RAND_MAX;
src/Utils/ml_MultiLevelPreconditioner.cpp: 
field_of_values->P_coeff[2] =  (double)rand()/RAND_MAX;


Thus, it seems that there is a little share of randomness involved, 
which may only be significant when the solver needs to run a large 
number of iterations. So, the fluctuation of iterations when using ML 
does not seem to be something you need to be worried about.

Best regards,
Karli



On 06/27/2013 09:40 AM, Mark F. Adams wrote:
> If this happens in serial and does not happen with other solvers then
> there is probably a non-deterministic random seed (RHS for the eigen
> estimator...).  I could imagine the documentation not going into that
> much detail, but I would not imagine that ML would be non-determinstic
> by default ...  It could be a floating point issues also.
>
> On Jun 27, 2013, at 4:08 AM, Thomas DE-SOZA <thomas.de-soza at edf.fr
> <mailto:thomas.de-soza at edf.fr>> wrote:
>
>>
>> Dear PETSc users,
>>
>> We've been using the Krylov solvers in PETSc for a while in our
>> software package for implicit structural mechanics and recently added
>> algebraic multigrid preconditioning through the ML and Hypre libraries
>> provided as part of PETSc.
>> Though we're quite happy with this new feature, we've encountered a
>> strange behaviour when using KSPGCR in conjunction with the PCML
>> preconditioner.
>> Indeed, identical and  consecutives solves inside the same run do not
>> display the same number of Krylov iterations even in sequential and we
>> were wondering why :
>>
>> 1st solve
>> 723 KSP unpreconditioned resid norm 2.911385065051e-02 true resid norm
>> 2.911385065051e-02 ||r(i)||/||b|| 9.979426047969e-09
>>
>> 2nd solve
>> 787 KSP unpreconditioned resid norm 2.896035212670e-02 true resid norm
>> 2.896035212670e-02 ||r(i)||/||b|| 9.926810982197e-09
>>
>> 3rd solve
>> 721 KSP unpreconditioned resid norm 2.913123687343e-02 true resid norm
>> 2.913123687343e-02 ||r(i)||/||b|| 9.985385566274e-09
>>
>>
>> Would you say this case requires a great number of iterations and
>> therefore reproductibility is not ensured (indeed it is
>> ill-conditioned and is not very suited for algebraic multigrid) ?
>> Or is there a seed somewhere in ML that would explain this ? I
>> searched the ML manual for that and couln't find any. We're using the
>> uncoupled coarsening scheme in ML (call
>> PetscOptionsSetValue('-pc_ml_CoarsenScheme', 'Uncoupled', ierr)).
>>
>> Final notes : several consecutive runs of the program do display
>> identical behaviour (that is the 1st solve always require 723
>> iterations, the 2nd 787, etc). Moreover other cases that are
>> well-conditioned require the same number number of iterations for each
>> consecutive solve (though the converged residual differs a bit).
>>
>> Thanks for any hints,
>> Thomas
>>
>>
>> Ce message et toutes les pièces jointes (ci-après le 'Message') sont
>> établis à l'intention exclusive des destinataires et les informations
>> qui y figurent sont strictement confidentielles. Toute utilisation de
>> ce Message non conforme à sa destination, toute diffusion ou toute
>> publication totale ou partielle, est interdite sauf autorisation expresse.
>>
>> Si vous n'êtes pas le destinataire de ce Message, il vous est interdit
>> de le copier, de le faire suivre, de le divulguer ou d'en utiliser
>> tout ou partie. Si vous avez reçu ce Message par erreur, merci de le
>> supprimer de votre système, ainsi que toutes ses copies, et de n'en
>> garder aucune trace sur quelque support que ce soit. Nous vous
>> remercions également d'en avertir immédiatement l'expéditeur par
>> retour du message.
>>
>> Il est impossible de garantir que les communications par messagerie
>> électronique arrivent en temps utile, sont sécurisées ou dénuées de
>> toute erreur ou virus.
>> ____________________________________________________
>>
>> This message and any attachments (the 'Message') are intended solely
>> for the addressees. The information contained in this Message is
>> confidential. Any use of information contained in this Message not in
>> accord with its purpose, any dissemination or disclosure, either whole
>> or partial, is prohibited except formal approval.
>>
>> If you are not the addressee, you may not copy, forward, disclose or
>> use any part of it. If you have received this message in error, please
>> delete it and all copies from your system and notify the sender
>> immediately by return message.
>>
>> E-mail communication cannot be guaranteed to be timely secure, error
>> or virus-free.
>>
>



More information about the petsc-users mailing list