Hello all,<div><br></div><div>I am creating a large rectangular MPIAIJ matrix, then a shell NormalMatrix that eventually gets passed to a KSP object (all part of a constrained least-squares solver).</div><div>Code looks as follows:</div>
<div><br></div><div> //user.A_mat and user.Hess are PETSc Mat</div><div><br></div><div><div> info = MatCreateMPIAIJWithSplitArrays( PETSC_COMM_WORLD, *locrow, *loccol, nrow,</div><div><span class="Apple-tab-span" style="white-space:pre">                         </span>  *ncol, onrowidx, oncolidx,</div>
<div><span class="Apple-tab-span" style="white-space:pre">                              </span>  (PetscScalar*) onvals, offrowidx, offcolidx,</div><div><span class="Apple-tab-span" style="white-space:pre">                               </span>  (PetscScalar*) values, &user.A_mat ); CHKERRQ(info);</div>
<div><br></div><div> info = MatCreateNormal( user.A_mat, &user.Hess ); CHKERRQ(info);</div></div><div> info = MatSetUp( user.Hess );</div><div><br></div><div>Is MatSetUp() required for A or Hess to be initialized correctly? Or some call to MatSetPreallocation?</div>
<div><br></div><div>My code crashes after displaying (with -info -mat_view_info):</div><div><br></div><div><div><font face="courier new, monospace">[0] PetscCommDuplicate(): Duplicating a communicator 47534399113024 67425648 max tags = 2147483647</font></div>
<div><font face="courier new, monospace">[0] PetscCommDuplicate(): Duplicating a communicator 47534399112000 67760592 max tags = 2147483647</font></div><div><font face="courier new, monospace">[0] MatCreate_SeqAIJ_Inode(): Not using Inode routines due to -mat_no_inode</font></div>
<div><font face="courier new, monospace">[0] MatAssemblyEnd_SeqAIJ(): Matrix size: 8920860 X 1508490; storage space: 0 unneeded,34572269 used</font></div><div><font face="courier new, monospace">[0] MatAssemblyEnd_SeqAIJ(): Number of mallocs during MatSetValues() is 0</font></div>
<div><font face="courier new, monospace">[0] MatAssemblyEnd_SeqAIJ(): Maximum nonzeros in any row is 615</font></div><div><font face="courier new, monospace">Matrix Object: 1 MPI processes</font></div><div><font face="courier new, monospace">  type: seqaij</font></div>
<div><font face="courier new, monospace">  rows=8920860, cols=1508490</font></div><div><font face="courier new, monospace">  total: nonzeros=34572269, allocated nonzeros=0</font></div><div><font face="courier new, monospace">  total number of mallocs used during MatSetValues calls =0</font></div>
<div><font face="courier new, monospace">    not using I-node routines</font></div><div><font face="courier new, monospace">[0] PetscCommDuplicate(): Using internal PETSc communicator 47534399112000 67760592</font></div><div>
<font face="courier new, monospace">[0] MatCreate_SeqAIJ_Inode(): Not using Inode routines due to -mat_no_inode</font></div><div><font face="courier new, monospace">[0] MatAssemblyEnd_SeqAIJ(): Matrix size: 8920860 X 18752388; storage space: 0 unneeded,1762711 used</font></div>
<div><font face="courier new, monospace">[0] MatAssemblyEnd_SeqAIJ(): Number of mallocs during MatSetValues() is 0</font></div><div><font face="courier new, monospace">[0] MatAssemblyEnd_SeqAIJ(): Maximum nonzeros in any row is 349</font></div>
<div><font face="courier new, monospace">Matrix Object: 1 MPI processes</font></div><div><font face="courier new, monospace">  type: seqaij</font></div><div><font face="courier new, monospace">  rows=8920860, cols=18752388</font></div>
<div><font face="courier new, monospace">  total: nonzeros=1762711, allocated nonzeros=0</font></div><div><font face="courier new, monospace">  total number of mallocs used during MatSetValues calls =0</font></div><div><font face="courier new, monospace">    not using I-node routines</font></div>
<div><font face="courier new, monospace">[0] MatAssemblyEnd_SeqAIJ(): Matrix size: 8920860 X 1508490; storage space: 0 unneeded,34572269 used</font></div><div><font face="courier new, monospace">[0] MatAssemblyEnd_SeqAIJ(): Number of mallocs during MatSetValues() is 0</font></div>
<div><font face="courier new, monospace">[0] MatAssemblyEnd_SeqAIJ(): Maximum nonzeros in any row is 615</font></div><div><font face="courier new, monospace">Matrix Object: 1 MPI processes</font></div><div><font face="courier new, monospace">  type: seqaij</font></div>
<div><font face="courier new, monospace">  rows=8920860, cols=1508490</font></div><div><font face="courier new, monospace">  total: nonzeros=34572269, allocated nonzeros=0</font></div><div><font face="courier new, monospace">  total number of mallocs used during MatSetValues calls =0</font></div>
<div><font face="courier new, monospace">    not using I-node routines</font></div><div><font face="courier new, monospace">[0] MatAssemblyEnd_SeqAIJ(): Matrix size: 8920860 X 18752388; storage space: 0 unneeded,1762711 used</font></div>
<div><font face="courier new, monospace">[0] MatAssemblyEnd_SeqAIJ(): Number of mallocs during MatSetValues() is 0</font></div><div><font face="courier new, monospace">[0] MatAssemblyEnd_SeqAIJ(): Maximum nonzeros in any row is 349</font></div>
<div><font face="courier new, monospace">Matrix Object: 1 MPI processes</font></div><div><font face="courier new, monospace">  type: seqaij</font></div><div><font face="courier new, monospace">  rows=8920860, cols=18752388</font></div>
<div><font face="courier new, monospace">  total: nonzeros=1762711, allocated nonzeros=0</font></div><div><font face="courier new, monospace">  total number of mallocs used during MatSetValues calls =0</font></div><div><font face="courier new, monospace">    not using I-node routines</font></div>
<div><font face="courier new, monospace">[0] MatAssemblyEnd_SeqAIJ(): Matrix size: 8920860 X 1508490; storage space: 0 unneeded,34572269 used</font></div><div><font face="courier new, monospace">[0] MatAssemblyEnd_SeqAIJ(): Number of mallocs during MatSetValues() is 0</font></div>
<div><font face="courier new, monospace">[0] MatAssemblyEnd_SeqAIJ(): Maximum nonzeros in any row is 615</font></div><div><font face="courier new, monospace">[0] PetscCommDuplicate(): Using internal PETSc communicator 47534399112000 67760592</font></div>
<div><font face="courier new, monospace">[0] PetscCommDuplicate(): Using internal PETSc communicator 47534399112000 67760592</font></div><div><font face="courier new, monospace">[0] VecScatterCreateCommon_PtoS(): Using blocksize 1 scatter</font></div>
<div><font face="courier new, monospace">[0] VecScatterCreate(): General case: MPI to Seq</font></div><div><font face="courier new, monospace">[0] MatAssemblyEnd_SeqAIJ(): Matrix size: 8920860 X 38109; storage space: 0 unneeded,1762711 used</font></div>
<div><font face="courier new, monospace">[0] MatAssemblyEnd_SeqAIJ(): Number of mallocs during MatSetValues() is 0</font></div><div><font face="courier new, monospace">[0] MatAssemblyEnd_SeqAIJ(): Maximum nonzeros in any row is 349</font></div>
<div><font face="courier new, monospace">Matrix Object: 160 MPI processes</font></div><div><font face="courier new, monospace">  type: mpiaij</font></div><div><font face="courier new, monospace">  rows=131858910, cols=18752388</font></div>
</div><div><br></div><div>The code ran just fine on a smaller (pruned) input dataset.</div><div>I don't get a stacktrace unfortunately... (running in production mode, trying to switch to debug mode now).</div><div><br>
</div><div><br></div><div>Regards,</div><div>Mihai</div><div><br></div>