<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">Mehrzad:</div><div class="gmail_quote">We have many examples using MatLoad().</div><div class="gmail_quote">Under petsc/src/ksp/ksp/examples/tutorials</div><div class="gmail_quote"><div class="gmail_quote">grep MatLoad *.c</div><div class="gmail_quote">ex10.c: ierr = MatLoad(A,fd);CHKERRQ(ierr);</div><div class="gmail_quote">ex27.c: ierr = MatLoad(A,fd);CHKERRQ(ierr);</div><div class="gmail_quote">ex41.c: ierr = MatLoad(A,fd);CHKERRQ(ierr);</div><div class="gmail_quote"><br></div><div class="gmail_quote">ex10.c is used frequently.</div><div class="gmail_quote"><br></div><div class="gmail_quote">Under petsc/src/ksp/ksp/examples/tests</div><div class="gmail_quote"><div class="gmail_quote">grep MatLoad *.c</div><div class="gmail_quote">ex11.c: ierr = MatLoad(*A11,viewer);CHKERRQ(ierr);</div><div class="gmail_quote"><br></div><div class="gmail_quote">ex18.c: ierr = MatLoad(A,fd);CHKERRQ(ierr);</div><div class="gmail_quote">ex25.c: ierr = MatLoad(C,view);CHKERRQ(ierr);</div><div class="gmail_quote">ex27.c: ierr = MatLoad(A,fd);CHKERRQ(ierr);</div><div class="gmail_quote">ex30.c: ierr = MatLoad(A,fd);CHKERRQ(ierr);</div><div class="gmail_quote"><br></div><div class="gmail_quote">ex31.c: ierr = MatLoad(A,fd);CHKERRQ(ierr);</div><div class="gmail_quote">ex33.c: ierr = MatLoad(A,viewer);CHKERRQ(ierr);</div><div class="gmail_quote">ex33.c: ierr = MatLoad(B,viewer);CHKERRQ(ierr);</div><div class="gmail_quote">ex37.c: ierr = MatLoad(A,fd);CHKERRQ(ierr);</div><div class="gmail_quote">ex43.c: ierr = MatLoad(A,fd);CHKERRQ(ierr);</div><div class="gmail_quote">ex6.c: ierr = MatLoad(A,fd);CHKERRQ(ierr);</div><div class="gmail_quote">ex7.c: ierr = MatLoad(A,fd);CHKERRQ(ierr);</div><div class="gmail_quote"><br></div><div class="gmail_quote">Hong</div></div><div class="gmail_quote"><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div>Thank you Hong,</div><div><br></div>No I do not need that function. I'm looking for an example that reads a matrix from file and run pcg solver on it. I want to run it with CUDA and MPI. <div>/ksp/examples/tutorials/ex2.c is a good example but it does not read from file and for some reason I cannot make "reading from file work".</div><div>How can I find a working code like that?</div><div><br></div><div>Best,</div><div>Mehrzad</div></div><div class=""><div class="h5"><br><div class="gmail_quote"><div dir="ltr">On Wed, Jul 15, 2015 at 12:13 PM Hong <<a href="mailto:hzhang@mcs.anl.gov" target="_blank">hzhang@mcs.anl.gov</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">Mehrzad :</div><div class="gmail_quote">The error occurs at MatCreateNormal(A,&N), a function rarely used and not well tested. We will fix it.</div><div class="gmail_quote"><br></div><div class="gmail_quote">Do you need this function?</div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><br></div><div class="gmail_quote">Hong</div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">Hello everyone,<div><br></div><div>I'm really new to Petsc and when I try to run ksp/ksp/examples/tutorials/ex27</div><div><br></div><div>I get this error</div><div><br></div><div><div>[0]PETSC ERROR: Object is in wrong state</div><div>[0]PETSC ERROR: Must call MatXXXSetPreallocation() or MatSetUp() on argument 1 "mat" before MatGetFactorAvailable()</div><div>[0]PETSC ERROR: See <a href="http://www.mcs.anl.gov/petsc/documentation/faq.html" target="_blank">http://www.mcs.anl.gov/petsc/documentation/faq.html</a> for trouble shooting.</div><div>[0]PETSC ERROR: Petsc Release Version 3.6.0, unknown </div><div>[0]PETSC ERROR: ./ex27 on a arch-linux2-cxx-debug named scourge by mehrzads Wed Jul 15 11:27:48 2015</div><div>[0]PETSC ERROR: Configure options --with-mpi=1 --prefix=/opt/petsc --with-clanguage=cxx</div><div>[0]PETSC ERROR: #1 MatGetFactorAvailable() line 4199 in /../matrix.c</div><div>[0]PETSC ERROR: #2 PCGetDefaultType_Private() line 27 in /../precon.c</div><div>[0]PETSC ERROR: #3 PCSetFromOptions() line 159 in /../pcset.c</div><div>[0]PETSC ERROR: #4 KSPSetFromOptions() line 358 in /../itcl.c</div></div><div><br></div><div><br></div><div>Can you help me identify the problem?</div><div><br></div><div>Best,</div><div>Mehrzad</div></div>
</blockquote></div><br></div></div></blockquote></div>
</div></div></blockquote></div><br></div></div>