<div><br></div><div>Hi,</div><div><br></div><div>I met a problem when I tried to use "<span style="white-space: pre-wrap; line-height: 1.5;">KSPComputeEigenvalues()</span><span style="line-height: 1.5;">".</span></div><div> </div><div>The following is the solving part of my code.</div><div>When this programme run to the line </div><div>"<span style="white-space: pre-wrap; line-height: 1.5; color: rgb(192, 192, 192);"> </span><span style="white-space: pre-wrap; line-height: 1.5;">KSPComputeEigenvalues(ksp, numberEigen, r, c,neig);</span><span style="line-height: 1.5;">"</span></div><div>Then, PETSc Errors appear.</div><div><br></div><div>Do you have any suggestions?</div><div><br></div><div>////////////////////////////////////////////</div><div>
<pre style="margin-top: 0px; margin-bottom: 0px;"><!--StartFragment--><span style=" color:#c0c0c0;">   </span><span style=" color:#008000;">//Solving</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">the</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">Linear</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">System</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">Part======================================================</span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;">    </span>cout<<<span style=" color:#008000;">"solve</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">the</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">Linear</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">system"</span><<endl;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;">    </span>t0=(<span style=" color:#808000;">double</span>)clock();</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;">    </span><span style=" color:#800080;">KSP</span><span style=" color:#c0c0c0;"> </span>ksp;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;">    </span><span style=" color:#800080;">PC</span><span style=" color:#c0c0c0;"> </span>pc;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;">    </span>KSPCreate(PETSC_COMM_WORLD,<span style=" color:#c0c0c0;"> </span>&ksp);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;">   </span><span style=" color:#008000;">//</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">KSPSetType(ksp,</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">KSPCG);</span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;">    </span>KSPSetType(ksp,<span style=" color:#c0c0c0;"> </span><span style=" color:#000080;">KSPGMRES</span>);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;">    </span>KSPSetOperators(ksp,<span style=" color:#c0c0c0;"> </span>coeff_matrix,<span style=" color:#c0c0c0;"> </span>coeff_matrix,<span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">DIFFERENT_NONZERO_PATTERN</span>);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;">    </span><span style=" color:#800080;">PetscReal</span><span style=" color:#c0c0c0;"> </span>rtol=(<span style=" color:#000080;">1.e-4</span>)*pow(h,<span style=" color:#000080;">4.0</span>);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;">    </span><span style=" color:#800080;">PetscReal</span><span style=" color:#c0c0c0;"> </span>stol=(<span style=" color:#000080;">1.e-3</span>)*pow(h,<span style=" color:#000080;">4.0</span>);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;">    </span>KSPSetTolerances(ksp,<span style=" color:#c0c0c0;"> </span>rtol,<span style=" color:#c0c0c0;"> </span>stol,<span style=" color:#c0c0c0;"> </span><span style=" color:#000080;">PETSC_DEFAULT</span>,<span style=" color:#c0c0c0;"> </span><span style=" color:#000080;">PETSC_DEFAULT</span>);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;">    </span>KSPGetPC(ksp,<span style=" color:#c0c0c0;"> </span>&pc);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;">    </span>PCSetType(pc,<span style=" color:#c0c0c0;"> </span><span style=" color:#000080;">PCGAMG</span>);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;">    </span>KSPSetFromOptions(ksp);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;">    </span><span style=" color:#008000;">//====KSPSetComputeEigenvalues()</span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;">    </span>KSPSetComputeEigenvalues(ksp,<span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">PETSC_TRUE</span>);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;">    </span><span style=" color:#008000;">//KSPSetComputeEigenvalues(ksp,</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">PETSC_FALSE);</span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;">    </span><span style=" color:#008000;">//=============================</span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;">    </span>KSPSetUp(ksp);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;">    </span>KSPSolve(ksp,<span style=" color:#c0c0c0;"> </span>load_vect,<span style=" color:#c0c0c0;"> </span>m_solut);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;">     </span>cout<<<span style=" color:#008000;">"Before</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">KSPComputeEignvalues()"</span><<endl;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;">    </span><span style=" color:#008000;">//======KSPComputeEigenvalues()</span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;">    </span>numberEigen=<span style=" color:#000080;">1</span>;<span style=" color:#008000;">//4*P_FEMMesh->P_Vertices->size();</span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;">    </span>KSPComputeEigenvalues(ksp,numberEigen,r,c,neig);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;">    </span>cout<<<span style=" color:#008000;">"After</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">KSPComputeEignvalues()"</span><<endl;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;">    </span>cout<<<span style=" color:#008000;">"EignValues:"</span><<endl;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;">    </span><span style=" color:#808000;">for</span>(<span style=" color:#808000;">unsigned</span><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">int</span><span style=" color:#c0c0c0;"> </span>j=<span style=" color:#000080;">0</span>;<span style=" color:#c0c0c0;"> </span>j<numberEigen;<span style=" color:#c0c0c0;"> </span>j++)</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;">    </span>{</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;">        </span>cout<<r[numberEigen]<<<span style=" color:#008000;">"</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">+</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">"</span><<c[numberEigen]<<<span style=" color:#008000;">"i"</span><<endl;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;">    </span>}</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;">    </span><span style=" color:#008000;">//========================</span><!--EndFragment--></pre><pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#008000;"><br></span></pre><pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#008000;"><br></span></pre><pre style="margin-top: 0px; margin-bottom: 0px;"><font size="4" face="Verdana"><br></font></pre><pre style="margin-top: 0px; margin-bottom: 0px;"><font size="4" face="Verdana">Here is Petsc errors.</font></pre><pre style="margin-top: 0px; margin-bottom: 0px;"><font size="4" face="Verdana">when the programme runs to </font></pre><pre style="margin-top: 0px; margin-bottom: 0px;"><font size="4" face="Verdana">"<span style="line-height: 1.5;">KSPComputeEigenvalues(ksp,numberEigen,r,c,neig);</span><span style="line-height: 1.5;">"</span></font></pre><pre style="margin-top: 0px; margin-bottom: 0px;"><span style="line-height: 1.5;"><font size="4" face="Verdana">These errors appear.</font></span></pre><pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre><pre style="margin-top: 0px; margin-bottom: 0px;"><font color="#008000">PETSC ERRORs</font></pre><pre style="margin-top: 0px; margin-bottom: 0px;"><p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;">[0]PETSC ERROR: --------------------- Error Message ------------------------------------</p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;">[0]PETSC ERROR: Null argument, when expecting valid pointer!</p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;">[0]PETSC ERROR: Null Pointer: Parameter # 3!</p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;">[0]PETSC ERROR: ------------------------------------------------------------------------</p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;">[0]PETSC ERROR: Petsc Release Version 3.4.3, Oct, 15, 2013 </p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;">[0]PETSC ERROR: See docs/changes/index.html for recent updates.</p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;">[0]PETSC ERROR: See docs/faq.html for hints about trouble shooting.</p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;">[0]PETSC ERROR: See docs/index.html for manual pages.</p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;">[0]PETSC ERROR: ------------------------------------------------------------------------</p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;">[0]PETSC ERROR: /Users/wumeng/MyWork/BuildMSplineTools/bin/msplinePDE_PFEM_2 on a arch-darwin-c-debug named vis032b.sophia.inria.fr by wumeng Thu Apr 24 11:50:16 2014</p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;">[0]PETSC ERROR: Libraries linked from /Users/wumeng/MyWork/PETSc/arch-darwin-c-debug/lib</p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;">[0]PETSC ERROR: Configure run at Wed Dec 18 15:31:31 2013</p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;">[0]PETSC ERROR: Configure options --with-cc=gcc --with-fc=gfortran --download-f-blas-lapack --download-mpich</p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;">[0]PETSC ERROR: ------------------------------------------------------------------------</p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;">[0]PETSC ERROR: KSPComputeEigenvalues() line 118 in /Users/wumeng/MyWork/PETSc/src/ksp/ksp/interface/itfunc.c</p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;">After KSPComputeEignvalues()</p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;">EignValues:</p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;">[0]PETSC ERROR: ------------------------------------------------------------------------</p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;">[0]PETSC ERROR: Caught signal number 11 SEGV: Segmentation Violation, probably memory access out of range</p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;">[0]PETSC ERROR: Try option -start_in_debugger or -on_error_attach_debugger</p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;">[0]PETSC ERROR: or see http://www.mcs.anl.gov/petsc/documentation/faq.html#valgrind[0]PETSC ERROR: or try http://valgrind.org on GNU/linux and Apple Mac OS X to find memory corruption errors</p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;">[0]PETSC ERROR: likely location of problem given in stack below</p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;">[0]PETSC ERROR: ---------------------  Stack Frames ------------------------------------</p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;">[0]PETSC ERROR: Note: The EXACT line numbers in the stack are not available,</p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;">[0]PETSC ERROR:       INSTEAD the line number of the start of the function</p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;">[0]PETSC ERROR:       is given.</p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;">[0]PETSC ERROR: [0] KSPComputeEigenvalues line 116 /Users/wumeng/MyWork/PETSc/src/ksp/ksp/interface/itfunc.c</p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;">[0]PETSC ERROR: --------------------- Error Message ------------------------------------</p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;">[0]PETSC ERROR: Signal received!</p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;">[0]PETSC ERROR: ------------------------------------------------------------------------</p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;">[0]PETSC ERROR: Petsc Release Version 3.4.3, Oct, 15, 2013 </p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;">[0]PETSC ERROR: See docs/changes/index.html for recent updates.</p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;">[0]PETSC ERROR: See docs/faq.html for hints about trouble shooting.</p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;">[0]PETSC ERROR: See docs/index.html for manual pages.</p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;">[0]PETSC ERROR: ------------------------------------------------------------------------</p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;">[0]PETSC ERROR: /Users/wumeng/MyWork/BuildMSplineTools/bin/msplinePDE_PFEM_2 on a arch-darwin-c-debug named vis032b.sophia.inria.fr by wumeng Thu Apr 24 11:50:16 2014</p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;">[0]PETSC ERROR: Libraries linked from /Users/wumeng/MyWork/PETSc/arch-darwin-c-debug/lib</p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;">[0]PETSC ERROR: Configure run at Wed Dec 18 15:31:31 2013</p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;">[0]PETSC ERROR: Configure options --with-cc=gcc --with-fc=gfortran --download-f-blas-lapack --download-mpich</p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;">[0]PETSC ERROR: ------------------------------------------------------------------------</p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;">[0]PETSC ERROR: User provided function() line 0 in unknown directory unknown file</p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;">application called MPI_Abort(MPI_COMM_WORLD, 59) - process 0</p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;">[unset]: aborting job:</p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;">application called MPI_Abort(MPI_COMM_WORLD, 59) - process 0</p><p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"><br></p><p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"><br></p><p style="margin: 0px; line-height: normal;"><font face="Verdana" size="4"><br></font></p><p style="margin: 0px; line-height: normal;"><font face="Verdana" size="4">Thanks,</font></p><p style="margin: 0px; line-height: normal;"><font face="Verdana" size="4"><br></font></p><p style="margin: 0px; line-height: normal;"><font face="Verdana" size="4">M.</font></p></pre></div>