<div style="line-height:1.7;color:#000000;font-size:14px;font-family:arial"><DIV>Hello, Matt<BR> First,thanks for your help, and I have a new recognition of MPI. As you said(only part of a Vec is stored on each MPI process),I use MPI_Send,MPI_Recv and MPI_Bcast to deal with it and get some right results.<BR> However,I have not yet fully solved this problem.The number of loops of the subroutine named PETSCSOLVE to solve Ax=b with PETSc is 20 times.I print the results of each loop and find that the front 9 times are right. In the 10 time,there is a strange error: plug the result x into the equation I find that Ax!=b. </DIV>
<DIV> The code and the A,x,b are shown below.So can you give me some hints? Thank you very much!<BR> Jim<BR> (1)code<BR> call MatView(A,PETSC_VIEWER_STDOUT_WORLD,ierr)<BR> call VecView(b,PETSC_VIEWER_STDOUT_WORLD,ierr)<BR> call KSPSolve(ksp,b,x,ierr)<BR> call VecView(x,PETSC_VIEWER_STDOUT_WORLD,ierr)<BR> (2)Ax=b<BR> A:<BR> type: mpiaij<BR> row 0: (0, 1) (1, 0) (2, 0) (3, 0) (4, 0) (5, 0) (6, 0) (7, 0) (8, 0) <BR> row 1: (0, 0) (1, 1) (2, 0) (3, 0) (4, 0) (5, 0) (6, 0) (7, 0) (8, 0) <BR> row 2: (0, 0) (1, 0) (2, -2e-06) (3, -50) (4, 0) (5, 0) (6, 0) (7, -50) (8, 0) <BR> row 3: (0, 0) (1, 0) (2, -50) (3, 1.36265e+07) (4, 0) (5, 0) (6, 0) (7, 1.23877e+06) (8, 0) <BR> row 4: (0, 0) (1, 0) (2, 0) (3, 0) (4, 1) (5, 0) (6, 0) (7, 0) (8, 0) <BR> row 5: (0, 0) (1, 0) (2, 0) (3, 0) (4, 0) (5, 1) (6, 0) (7, 0) (8, 0) <BR> row 6: (0, 0) (1, 0) (2, 0) (3, 0) (4, 0) (5, 0) (6, 1) (7, 0) (8, 0) <BR> row 7: (0, 0) (1, 0) (2, -50) (3, 1.23877e+06) (4, 0) (5, 0) (6, 0) (7, 1.36265e+07) (8, 0) <BR> row 8: (0, 0) (1, 0) (2, 0) (3, 0) (4, 0) (5, 0) (6, 0) (7, 0) (8, 1) <BR> b:<BR> type: mpi<BR> Process [0]<BR> 0<BR> 0<BR> -0.75<BR> 96949.5<BR> 0<BR> Process [1]<BR> 0<BR> -0.015<BR> 96949.5<BR> -0.015<BR> x:<BR> type: mpi<BR> Process [0]<BR> 0<BR> 0<BR> 1167.84<BR> 0.00819383<BR> 0<BR> Process [1]<BR> 0<BR> -0.00824055<BR> 0.00390865<BR> -0.00824055<BR><BR><BR></DIV>
<DIV></DIV>
<DIV id="divNeteaseMailCard"></DIV>
<DIV><BR></DIV>>ÔÚ 2012-05-22 19:33:10£¬"Matthew Knepley" <knepley@gmail.com> дµÀ£º<BR>
<BLOCKQUOTE style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" id="isReplyContent">>On Tue, May 22, 2012 at 5:17 AM, w_ang_temp <SPAN dir="ltr"><<A href="mailto:w_ang_temp@163.com" target="_blank">w_ang_temp@163.com</A>></SPAN> wrote:<BR>
<DIV class="gmail_quote">
<BLOCKQUOTE style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class="gmail_quote">
<DIV style="LINE-HEIGHT: 1.7; FONT-FAMILY: arial; FONT-SIZE: 14px">
<DIV>>Hello</DIV>
<DIV> > I am a beginner of PETSc.I find the petsc-users lists is very useful, however I do not know how to ask a question in it. So can you tell me? >And below is what I want to ask.<BR> > I am solving Ax=b with PETSc. And I only use it in a fortran subroutine to get x ,then the main function of my program use x to do other >things. The question is that: when the process is 1(mpiexec -n 1),the result of my program is ok, but when the process is more than 1 the > result is wrong.<BR></DIV></DIV></BLOCKQUOTE>
<DIV><BR></DIV>
<DIV>> "Wrong" is not an acceptable description. I suspect that you do not understand that only part of a Vec</DIV>
<DIV>> is stored on each MPI process. First, get the book Using MPI, and then read the PETSc manual</DIV>
<DIV>> section on vectors.</DIV>
<DIV><BR></DIV>
<DIV> > Thanks,</DIV>
<DIV><BR></DIV>
<DIV> > Matt</DIV>
<DIV> </DIV>
<BLOCKQUOTE style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class="gmail_quote">
<DIV style="LINE-HEIGHT: 1.7; FONT-FAMILY: arial; FONT-SIZE: 14px">
<DIV>> So where could be wrong? Can you give me some hints on how I can debug? Thanks.</DIV>
<DIV>> Jim</DIV></DIV></BLOCKQUOTE></DIV>> -- <BR>> What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their > experiments lead.<BR>> -- Norbert Wiener<BR></BLOCKQUOTE></div><br><br><span title="neteasefooter"><span id="netease_mail_footer"></span></span>