[petsc-users] [petsc-maint #118299] Re: SAME_PRECONDITIONER vs. DIFFERENT_NONZERO_PATTERN

John Fettig john.fettig at gmail.com
Wed May 30 22:14:24 CDT 2012

(switching back to petsc-users so that others may see this resolution)

On Wed, May 30, 2012 at 10:47 PM, Barry Smith <bsmith at mcs.anl.gov> wrote:
> On May 30, 2012, at 9:42 PM, John Fettig wrote:
>> I don't think it does in the PETSc driver, but I'm not certain.  The
>> only place I find reference to "rand" is in the aggregation object,
>> which has the ability to use a random ordering rather than the natural
>> one.  This isn't used by the PETSc driver, though.
>   Are you sure? You could run in the debugger and put a break point in rand() to see if it is called.

Ok, it turns out ML has its own random number generator, ML_srandom1,
which is called from ML_random_vec.  It is indeed called during the
call to ML_Gen_MultiLevelHierarchy_UsingAggregation in PCSetUp_ML:

#0  ML_random_vec (u=0x14b1ee0, N=1449, comm=0x12ebeb8)
    at ./Utils/ml_utils.c:1767
#1  0x00002aedf3b060c6 in ML_CG_ComputeEigenvalues (data=0x14b1ee0,
    length=1449, scale_by_diag=19840696) at ./Krylov/ml_cg.c:189
#2  0x00002aedf3ababfb in ML_Krylov_Solve (data=0x14b1ee0, leng=1449,
    invec=0x12ebeb8, outvec=0x2aedf25cfbc8) at ./Krylov/ml_krylov.c:358
#3  0x00002aedf3a7a1e8 in ML_AGG_Gen_Prolongator (ml=0x14b1ee0, level=1449,
    clevel=19840696, data=0x2aedf25cfbc8) at ./Coarsen/ml_agg_genP.c:490
#4  0x00002aedf3a7e316 in ML_MultiLevel_Gen_Prolongator (ml=0x14b1ee0,
    level=1449, clevel=19840696, data=0x2aedf25cfbc8)
    at ./Coarsen/ml_agg_genP.c:2913
#5  0x00002aedf3a7cb33 in ML_Gen_MultiLevelHierarchy (ml=0x14b1ee0,
    fine_level=1449, user_next_level=0x12ebeb8,
    user_gen_restriction=0x2aedf25cfbc8 <hpmp_flag_signals>,
    user_gen_prolongator=0x3, user_data=0x20000)
    at ./Coarsen/ml_agg_genP.c:2557
#6  0x00002aedf3a7befd in ML_Gen_MultiLevelHierarchy_UsingAggregation (
    ml=0x14b1ee0, start=1449, increment_or_decrement=19840696,
    ag=0x2aedf25cfbc8) at ./Coarsen/ml_agg_genP.c:2444
#7  0x00002aedf35f048f in PCSetUp_ML (pc=0x1351a00)
    at /home/jfe/local/petsc-dev/src/ksp/pc/impls/ml/ml.c:692

This must be the reason the different results.  Now that you mention
it, if I try solving the exact same system twice with
DIFFERENT_NONZERO_PATTERN, the residual history and the solution are
different.  If I use SAME_PRECONDITIONER the residual history and the
solution are the same.


More information about the petsc-users mailing list