ooops, sorry, here it is.<br>^_^<br><br>Alan<br><br><div class="gmail_quote">On Fri, Jun 10, 2011 at 3:09 PM, Matthew Knepley <span dir="ltr"><<a href="mailto:knepley@gmail.com">knepley@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div class="im">On Fri, Jun 10, 2011 at 3:05 PM, <span dir="ltr"><<a href="mailto:zhenglun.wei@gmail.com" target="_blank">zhenglun.wei@gmail.com</a>></span> wrote:<br>
</div><div class="gmail_quote"><div class="im"><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Dear Matt,<br> Following your suggestions, I modified the VecView_VTK in /src/ksp/ksp/example/tutorial/ex29.c to <br><br> PetscFunctionBegin;<br> PetscViewerASCIIOpen(comm, filename, &viewer);<br> PetscViewerSetFormat(viewer, PETSC_VIEWER_ASCII_MATLAB);<br>
</blockquote><div><br></div></div><div>I told you to use ASCII_VTK, not ASCII_MATLAB.</div><div class="im"><div> </div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
DMView(x, viewer);<br>
VecView(x, PETSC_VIEWER_STDOUT_WORLD);<br> PetscViewerDestroy(&viewer);<br> PetscFunctionReturn(0);<br><br> However, I always give me some error. Could you please briefly check if there is any obvious coding problem here.<br>
</blockquote><div><br></div></div><div>How can I possibly know what went wrong if you do not send the ENTIRE error message.</div><div><br></div><div> Matt</div><div><div></div><div class="h5"><div> </div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
thanks,<br>Alan<div><br><br>On , Matthew Knepley <<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>> wrote:<br>> On Thu, Jun 9, 2011 at 6:18 PM, Matthew Knepley <a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>> wrote:<br>
> <br>> On Thu, Jun 9, 2011 at 6:01 PM, <a href="mailto:zhenglun.wei@gmail.com" target="_blank">zhenglun.wei@gmail.com</a>> wrote:<br>> <br>> <br>> Dear Sir/Madam,<br>> I'm still studying on the ex29 of /src/ksp/ksp/example/tutorial. Before I met a problem on VecView_VTK in parallel computation. I'm trying to modify it in order to output some data from the computation. <br>
> <br>> <br>> <br>> <br>> Here is a better answer. If you want output, throw away this old function which is broken, and use<br>> <br>> <br>> PetscViewerASCIIOpen()<br>> PetscViewerASCIISetFormat(PETSC_VIEWER_ASCII_VTK)<br>
> <br>> DMView()<br>> VecView()<br>> PetscViewerDestroy()<br>> <br>> <br>> Thanks,<br>> <br>> <br>> Matt<br>> <br>> <br>> 1) My first questions is that what does this section do in VecView_VTK:<br>
> <br>> 272: MPI_Comm_rank(comm, &rank);<br>> <br>> 273: MPI_Comm_size(comm, &size);<br>> 274: MPI_Reduce(&n, &maxn, 1, MPIU_INT, MPI_MAX, 0, comm);<br>> <br>> 275: tag = ((PetscObject) viewer)->tag;<br>
> 276: if (!rank) {<br>> 277: PetscMalloc((maxn+1) * sizeof(PetscScalar), &values);<br></div>> 278: for(i = 0; i 279: PetscViewerASCIIPrintf(viewer, "%G\n", PetscRealPart(array[i]));<br>
> <br>> <br>> 280: }<br>> 281: for(p = 1; p 282: MPI_Recv(values, (PetscMPIInt) n, MPIU_SCALAR, p, tag, comm, &status);<div><br>> 283: MPI_Get_count(&status, MPIU_SCALAR, &nn);<br>
> 284: for(i = 0; i <br>> <br></div><div><div></div><div>> 285: PetscViewerASCIIPrintf(viewer, "%G\n", PetscRealPart(array[i]));<br>> 286: }<br>> 287: }<br>> 288: PetscFree(values);<br>
> 289: } else {<br>> 290: MPI_Send(array, n, MPIU_SCALAR, 0, tag, comm);<br>> <br>> <br>> 291: }<br>> <br>> What I understand is: it gather all the data from different process in parallel computation, and output it to the 'viewer'. I comment out everything in VecView_VTK except this part, there is no error message coming up in my parallel computation so far. <br>
> <br>> <br>> <br>> 2) however, I really don't know how did it split the domain for parallel computation. For example, if I use 4 processes, is the domain split like:<br>> <br>> <br>> The DMDA describes the domain splitting.<br>
> <br>> <br>> <br>> <br>> Matt<br>> <br>> a) <br>> |<br>> 0 | 1 <br>> |<br>> <br>> <br>> ---------------|--------------<br>> | <br>
> 2 | 3<br>> |<br>> <br>> b) <br>> |<br>> 0 | 2 <br>> |<br>> ---------------|--------------<br>> | <br>
> <br>> <br>> 1 | 3<br>> |<br>> <br>> c) <br>> | | | |<br>> | | | |<br>> 0 | | 2 | |<br>> | 1 | | 3 |<br>
> | | | |<br>> | | | |<br>> <br>> <br>> <br>> d)<br>> 0<br>> ------------------------<br>> 1<br>> ------------------------<br>> 2<br>
> ------------------------<br>> 3<br>> <br>> thanks in advance,<br>> Alan<br>> <br>> <br>> <br>> <br>> -- <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>> <br>> <br>> <br>> <br>> -- <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>></div></div></blockquote></div></div></div><div><div></div><div class="h5"><br><br clear="all"><br>-- <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>
</div></div></blockquote></div><br>