Well, here's the problem:

MatSetBlockSize() used to call mat->ops->setblocksize() which the MPI matrices forwarded down to their seq submatrices.

But then this patch removed that behavior so MatSetBlockSize() is processed immediately and not forwarded down.

http://petsc.cs.iit.edu/petsc/petsc-dev/rev/80ec81eb9db9

Since the Seq inner matrices have different PetscLayouts, they don't inherit the block sizes set on their parent.

Barry, why did you remove this MatOp? How do you want the MPI matrices to forward block sizes now?

On Sat, May 19, 2012 at 10:57 AM, Mark F. Adams <mark.adams@columbia.edu> wrote:
I'm going to be tied up for a few days, should be able to get to this Wed., if not sooner, but if anyone wants to take a crack at it, here it is. This is run with 8 procs.

Mark

==51037== Command: ./ex56 -ne 19 -alpha 1.e-3 -ksp_type cg -ksp_monitor -ksp_max_it 15 -pc_type gamg -pc_gamg_type agg -pc_gamg_agg_nsmooths 1 -pc_gamg_verbose 2 -ksp_converged_reason -options_left -theta -30.0 -epsilon .01 -blob_center 0.,0. -pc_gamg_threshold .0 -pc_gamg_coarse_eq_limit 100 -use_coordinates -out_verbose 2 -aggmg_smooths 1 -mg_levels_ksp_type chebyshev -mg_levels_ksp_chebyshev_estimate_eigenvalues 0,0.2,0,1.1 -mg_levels_pc_type pbjacobi -mg_levels_ksp_max_it 1

==51039== Invalid read of size 8
==51039==    at 0x91E38B: PCApply_PBJacobi_3 (pbjacobi.c:81)
==51039==    by 0xA0FE23: PCApply (precon.c:384)
==51039==    by 0xADA9B2: KSPInitialResidual (itres.c:64)
==51039==    by 0xA7EA39: KSPSolve_GMRES (gmres.c:230)
==51039==    by 0xAB3CA2: KSPSolve (itfunc.c:446)
==51039==    by 0xAA6FF8: KSPSolve_Chebyshev (cheby.c:269)
==51039==    by 0xAB3CA2: KSPSolve (itfunc.c:446)
==51039==    by 0x9ECD2F: PCMGMCycle_Private (mg.c:20)
==51039==    by 0x9F0BEF: PCApply_MG (mg.c:321)
==51039==    by 0xA0FE23: PCApply (precon.c:384)
==51039==    by 0xA43EBF: KSPSolve_CG (cg.c:139)
==51039==    by 0xAB3CA2: KSPSolve (itfunc.c:446)
==51039==    by 0x4805: main (in ./ex56)
==51039==  Address 0x27f4c90 is 0 bytes after a block of size 24,032 alloc'd
==51039==    at 0x1B2AF16: malloc (vg_replace_malloc.c:236)
==51039==    by 0x8A8C7: PetscMallocAlign (mal.c:37)
==51039==    by 0x61E602: MatInvertBlockDiagonal_SeqAIJ (aij.c:2816)
==51039==    by 0x2F0AC3: MatInvertBlockDiagonal (matrix.c:9280)
==51039==    by 0x6D1494: MatInvertBlockDiagonal_MPIAIJ (mpiaij.c:2981)
==51039==    by 0x2F0AC3: MatInvertBlockDiagonal (matrix.c:9280)
==51039==    by 0x920A85: PCSetUp_PBJacobi (pbjacobi.c:213)
==51039==    by 0xA1783B: PCSetUp (precon.c:832)
==51039==    by 0xAB2125: KSPSetUp (itfunc.c:278)
==51039==    by 0x9F536C: PCSetUp_MG (mg.c:678)
==51039==    by 0x98C26C: PCSetUp_GAMG (gamg.c:984)
==51039==    by 0xA1783B: PCSetUp (precon.c:832)
==51039==    by 0xAB2125: KSPSetUp (itfunc.c:278)
==51039==    by 0x46AD: main (in ./ex56)
==51039==