<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body style="overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><div><br></div><p style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo; color: rgb(200, 20, 201);"><span style="font-variant-ligatures: no-common-ligatures">src/mat/tests/ex9.c and other examples in that directory use it.</span></p><p style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo; color: rgb(200, 20, 201);"><span style="font-variant-ligatures: no-common-ligatures"><br></span></p><p style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo; color: rgb(200, 20, 201);"><span style="font-variant-ligatures: no-common-ligatures"><br></span></p><div><br><blockquote type="cite"><div>On Mar 17, 2023, at 11:05 AM, user_gong Kim <ksi2443@gmail.com> wrote:</div><br class="Apple-interchange-newline"><div><div dir="ltr">PETSC_COMM_SELF generates an error in more than 2 processes.<br></div></div></blockquote><div><br></div>It should not</div><div><br></div><div><br><blockquote type="cite"><div><div dir="ltr"><br>I would like to use the other method you said, matcreateredundantmatrix. However, there is no example in the manual. Can you give an example using this function?<br><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">2023년 3월 17일 (금) 오후 11:53, Barry Smith <<a href="mailto:bsmith@petsc.dev">bsmith@petsc.dev</a>>님이 작성:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div><br></div> Use <div><br></div><div><blockquote type="cite"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><div>MatCreate(PETSC_COMM_SELF, &mat);</div><div> PetscViewerBinaryOpen(PETSC_COMM_SELF, "mat.bin", FILE_MODE_READ, &viewer);</div></div></div></blockquote></div></blockquote><br><div><br></div><div> If it one program running that both views and loads the matrix you can use MatCreateRedundantMatrix() to reproduce the entire matrix on each MPI rank. It is better than using the filesystem to do it.</div><div><br></div><div><br><blockquote type="cite"><div>On Mar 17, 2023, at 9:45 AM, user_gong Kim <<a href="mailto:ksi2443@gmail.com" target="_blank">ksi2443@gmail.com</a>> wrote:</div><br><div><div dir="ltr">Following your comments, I did an test.<div>However, if I run the application in parallel. </div><div>In all processes, it is not possible to obtain values at all positions in the matrix through MatGetValue.</div><div>As in the previous case of saving in binary, it is read in parallel divided form.<br></div><div>Is it impossible to want to get the all value in the whole process?<br></div><div><br></div><div><br></div><div>Thanks,</div><div>Hyung Kim</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">2023년 3월 17일 (금) 오후 7:35, Matthew Knepley <<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>>님이 작성:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr">On Fri, Mar 17, 2023 at 5:51 AM user_gong Kim <<a href="mailto:ksi2443@gmail.com" target="_blank">ksi2443@gmail.com</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><p class="MsoNormal" style="margin:0cm 0cm 8pt;text-align:justify;line-height:107%;font-size:10pt;font-family:"\00b9d1\00c740 \00ace0\00b515""><span lang="EN-US">Hello,</span></p><div style="margin:0cm 0cm 8pt;text-align:justify;line-height:107%;font-size:10pt;font-family:"\00b9d1\00c740 \00ace0\00b515""><span lang="EN-US"> </span><br></div><p class="MsoNormal" style="margin:0cm 0cm 8pt;text-align:justify;line-height:107%;font-size:10pt;font-family:"\00b9d1\00c740 \00ace0\00b515""><span lang="EN-US">I have 2 questions about MatView.</span></p><div style="margin:0cm 0cm 8pt;text-align:justify;line-height:107%;font-size:10pt;font-family:"\00b9d1\00c740 \00ace0\00b515""><span lang="EN-US"> </span><br></div><p style="margin:0cm 0cm 8pt 40pt;text-align:justify;line-height:107%;font-size:10pt;font-family:"\00b9d1\00c740 \00ace0\00b515""><span lang="EN-US">1.<span style="font-variant-numeric:normal;font-variant-east-asian:normal;font-variant-alternates:normal;font-kerning:auto;font-feature-settings:normal;font-stretch:normal;font-size:7pt;line-height:normal;font-family:"Times New Roman"">
</span></span><span lang="EN-US">I would like to ask if the
process below is possible.<br>
When running in parallel, is it possible to make the matrix of the mpiaij
format into a txt file, output it, and read it again so that the entire process
has the same matrix?</span></p></div></blockquote><div>No. However, you can do this with a binary viewer. I suggest using</div><div><br></div><div> MatViewFromOptions(mat, NULL, "-my_view");</div><div><br></div><div>and then the command line argument</div><div><br></div><div> -my_view binary:mat.bin</div><div><br></div><div>and then you can read this in using</div><div><br></div><div> MatCreate(PETSC_COMM_WORLD, &mat);</div><div> PetscViewerBinaryOpen(PETSC_COMM_WORLD, "mat.bin", FILE_MODE_READ, &viewer);</div><div> MatLoad(mat, viewer);</div><div> ViewerDestroy(&viewer);</div><div><br></div><div> THanks,</div><div><br></div><div> Matt</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><p style="margin:0cm 0cm 8pt 40pt;text-align:justify;line-height:107%;font-size:10pt;font-family:"\00b9d1\00c740 \00ace0\00b515""><span lang="EN-US">2.<span style="font-variant-numeric:normal;font-variant-east-asian:normal;font-variant-alternates:normal;font-kerning:auto;font-feature-settings:normal;font-stretch:normal;font-size:7pt;line-height:normal;font-family:"Times New Roman"">
</span></span><span lang="EN-US">If possible, please let me know
which function can be used to create a txt file and how to read the txt file.</span></p><div style="margin:0cm 0cm 8pt;text-align:justify;line-height:107%;font-size:10pt;font-family:"\00b9d1\00c740 \00ace0\00b515""><span lang="EN-US"> </span><br></div><p class="MsoNormal" style="margin:0cm 0cm 8pt;text-align:justify;line-height:107%;font-size:10pt;font-family:"\00b9d1\00c740 \00ace0\00b515""><span lang="EN-US">Thanks,</span></p><p class="MsoNormal" style="margin:0cm 0cm 8pt;text-align:justify;line-height:107%;font-size:10pt;font-family:"\00b9d1\00c740 \00ace0\00b515""><span lang="EN-US">Hyung Kim</span></p></div>
</blockquote></div><br clear="all"><div><br></div><span>-- </span><br><div dir="ltr"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div>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</div><div><br></div><div><a href="http://www.cse.buffalo.edu/~knepley/" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br></div></div></div></div></div></div></div></div>
</blockquote></div>
</div></blockquote></div><br></div></div></blockquote></div>
</div></blockquote></div><br></body></html>