<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On 14 Apr 2022, at 12:16 PM, Zhuo Chen <<a href="mailto:chenzhuotj@gmail.com" class="">chenzhuotj@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Hi Matt and Pierre,<div class=""><br class=""></div><div class="">Thank you very much for your help. I indeed want to solve a 2D problem with geometric block domain decomposition and the blocks are in the Hilbert space curve ordering. Each block may have 32x32 cells.<br class=""><div class=""><br class=""></div><div class="">I am a Fortran user and I apologize that I do not know how to use -pc_asm_print_subdomains.</div></div></div></div></blockquote><div><br class=""></div><div>You can just put this on your command line. For example,</div><div>$ cd ${PETSC_DIR}/src/ksp/ksp/tutorials && make ex2f && mpirun -n 2 ./ex2f -pc_type asm -pc_asm_print_subdomains</div>[…]</div><div>[0:2] Subdomain 0 with overlap:<br class="">0 1 2 3 4 <br class="">[1:2] Subdomain 0 with overlap:<br class="">5 6 7 8 <br class="">Norm of error  0.1205E-04 iterations     4<br class=""><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class=""><div class=""> Should I use call PetscOptionsGetBool(NULL, NULL, "-pc_asm_print_subdomains", .true., NULL, ierr)? It would be great if you can point me to the right tutorial.</div></div></div></div></blockquote><div><br class=""></div><div>You could also use the following line of code:</div><div>      call PetscOptionsInsertString(PETSC_NULL_OPTIONS,'-pc_asm_print_subdomains',ierr)</div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class=""><div class="">After reading some example programs, I would like to know if it is possible to use</div><div class=""><br class=""></div><div class="">IS, allocatable, dimension(:) :: is1,is2<br class=""></div><div class="">integer :: nlocalblk</div><div class=""><br class=""></div><div class="">call PCASMGetLocalSubdomains(pc,nlocalblk,is1,is2,ierr)</div><div class="">call ISView(is1,PETSC_VIEWER_STDOUT_SELF,ierr)</div><div class="">call ISView(is2,PETSC_VIEWER_STDOUT_SELF,ierr)</div><div class=""><br class=""></div><div class="">to realize the function you have mentioned.</div></div></div></div></blockquote><div><br class=""></div><div>That is another way to do it, yes.</div><div>In fact, for debugging purposes, I’d advise that you use GASM instead of ASM because it prints slightly more coherent information.</div><div>E.g., with PCASM, the above log shows that the displayed information is _wrong_. These are not the subdomains with overlap, but the subdomains _without_ overlap.</div><div>Furthermore, if you increase -pc_asm_overlap, you’ll still get the same subdomains.</div><div>$ mpirun -n 2 ./ex2f -pc_type asm -pc_asm_overlap 4 -pc_asm_print_subdomains   </div>[0:2] Subdomain 0 with overlap:<br class="">0 1 2 3 4 <br class="">[1:2] Subdomain 0 with overlap:<br class="">5 6 7 8 <br class="">Norm of error  0.1192E-05 iterations     4<br class=""><div><br class=""></div><div>On the contrary, with PCGASM, you get the proper subdomains with and without overlap.</div><div>$ mpirun -n 2 ./ex2f -pc_type gasm -pc_gasm_print_subdomains</div>Inner subdomain:<br class="">0 1 2 3 4 <br class="">Outer subdomain:<br class="">0 1 2 3 4 <br class="">Inner subdomain:<br class="">5 6 7 8 <br class="">Outer subdomain:<br class="">5 6 7 8 <br class=""><div>$ mpirun -n 2 ./ex2f -pc_type gasm -pc_gasm_print_subdomains -pc_gasm_overlap 4</div>Inner subdomain:<br class="">0 1 2 3 4 <br class="">Outer subdomain:<br class="">0 1 2 3 4 5 6 7 8 <br class="">Inner subdomain:<br class="">5 6 7 8 <br class="">Outer subdomain:<br class="">0 1 2 3 4 5 6 7 8 <br class=""><div><br class=""></div><div>Thanks,</div><div>Pierre</div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class=""><div class="">Thank you very much!<br class=""><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div></div></div></div><div dir="ltr" class=""></div><br class=""><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Apr 13, 2022 at 10:18 PM Zhuo Chen <<a href="mailto:chenzhuotj@gmail.com" target="_blank" class="">chenzhuotj@gmail.com</a>> wrote:<br class=""></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" class="">Thank you, Pierre!</div><br class=""><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Apr 13, 2022 at 10:05 PM Pierre Jolivet <<a href="mailto:pierre@joliv.et" target="_blank" class="">pierre@joliv.et</a>> wrote:<br class=""></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="">You can also use the uncommented option -pc_asm_print_subdomains which will, as Matt told you, show you that it is exactly the same algorithm.<div class=""><br class=""></div><div class="">Thanks,</div><div class="">Pierre<br class=""><div class=""><br class=""><blockquote type="cite" class=""><div class="">On 13 Apr 2022, at 3:58 PM, Zhuo Chen <<a href="mailto:chenzhuotj@gmail.com" target="_blank" class="">chenzhuotj@gmail.com</a>> wrote:</div><br class=""><div class=""><div dir="ltr" class="">Thank you, Matt! I will do that.</div><br class=""><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Apr 13, 2022 at 9:55 PM Matthew Knepley <<a href="mailto:knepley@gmail.com" target="_blank" class="">knepley@gmail.com</a>> wrote:<br class=""></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" class=""><div dir="ltr" class="">On Wed, Apr 13, 2022 at 9:53 AM Zhuo Chen <<a href="mailto:chenzhuotj@gmail.com" target="_blank" class="">chenzhuotj@gmail.com</a>> wrote:<br class=""></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" class="">Dear Pierre,<div class=""><br class=""></div><div class="">Thank you! I looked into the webpage you sent me and I think it is not the situation that I am talking about.</div><div class=""><br class=""></div><div class="">I think I need to attach a figure for an illustrative purpose. This figure is Figure 14.5 of "Iterative Method for Sparse Linear Systems" by Saad.</div><div class=""><span id="gmail-m_-7875060808135279206gmail-m_3377797180640090925gmail-m_3141105389219103399cid:ii_l1xmo4fd0" class=""><domaindecompostion.png></span></div><div class=""><br class=""></div><div class="">If I divide the domain into these three subdomains, as you can see, the middle block has two interfaces. In the matrix form, its rows are not contiguous, i.e., distributed in different processors. If ASM only expands in the contiguous direction, the domain decomposition become ineffective, I guess.</div></div></blockquote><div class=""><br class=""></div><div class="">No, we get exactly this picture. Saad is talking about exactly the algorithm we use.</div><div class=""><br class=""></div><div class="">Maybe you should just look at the subdomains being produced, -mat_view draw -draw_pause 3</div><div class=""><br class=""></div><div class="">   Matt</div><div class=""> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Apr 13, 2022 at 9:36 PM Pierre Jolivet <<a href="mailto:pierre@joliv.et" target="_blank" class="">pierre@joliv.et</a>> wrote:<br class=""></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class=""><br class=""><div class=""><br class=""><blockquote type="cite" class=""><div class="">On 13 Apr 2022, at 3:30 PM, Zhuo Chen <<a href="mailto:chenzhuotj@gmail.com" target="_blank" class="">chenzhuotj@gmail.com</a>> wrote:</div><br class=""><div class=""><div dir="ltr" class="">Dear Matthew and Mark,<div class=""><br class=""></div><div class="">Thank you very much for the reply! Much appreciated!</div><div class=""><br class=""></div><div class="">The question was about a 1D problem. I think I should say core 1 has row 1:32 instead of 1:32, 1:32 as it might be confusing.</div><div class=""><br class=""></div><div class="">So the overlap is extended to both directions for the middle processor but only toward the increasing direction for the first processor and the decreasing direction for the last processor. In 1D, this makes sense as the domain is contiguous. However, in 2D with domain decomposition with spacial overlaps, this overlapping would not work as one subdomain can have several neighbor domains. Mark mentioned generalized ASM, is that the correct direction that I should look for?</div></div></div></blockquote><div class=""><br class=""></div><div class="">What is it that you want to do exactly?</div><div class="">If you are using a standard discretisation kernel, e.g., piecewise linear finite elements, MatIncreaseOverlap() called by PCASM will generate an overlap algebraically which is equivalent to the overlap you would have gotten geometrically.</div><div class="">If you know that “geometric” overlap (or want to use a custom definition of overlap), you could use <a href="https://petsc.org/release/docs/manualpages/PC/PCASMSetLocalSubdomains.html" target="_blank" class="">https://petsc.org/release/docs/manualpages/PC/PCASMSetLocalSubdomains.html</a></div><div class=""><br class=""></div><div class="">Thanks,</div><div class="">Pierre</div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="">Best regards.</div><div class=""><br class=""></div></div><br class=""><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Apr 13, 2022 at 9:14 PM Matthew Knepley <<a href="mailto:knepley@gmail.com" target="_blank" class="">knepley@gmail.com</a>> wrote:<br class=""></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" class=""><div dir="ltr" class="">On Wed, Apr 13, 2022 at 9:11 AM Mark Adams <<a href="mailto:mfadams@lbl.gov" target="_blank" class="">mfadams@lbl.gov</a>> wrote:<br class=""></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" class=""><div dir="ltr" class=""><br class=""></div><br class=""><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Apr 13, 2022 at 8:56 AM Matthew Knepley <<a href="mailto:knepley@gmail.com" target="_blank" class="">knepley@gmail.com</a>> wrote:<br class=""></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" class=""><div dir="ltr" class="">On Wed, Apr 13, 2022 at 6:42 AM Mark Adams <<a href="mailto:mfadams@lbl.gov" target="_blank" class="">mfadams@lbl.gov</a>> wrote:<br class=""></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" class="">No, without overlap you have, let say: <div class=""><div class="">core 1:   1:32, 1:32</div><div class="">core 2:   33:64,  33:64</div></div><div class=""><br class=""></div><div class="">Overlap will increase the size of each domain so you get:</div><div class=""><div class="">core 1:   1:33, 1:33</div><div class="">core 2:   32:65,  32:65</div></div></div></blockquote><div class=""><br class=""></div><div class="">I do not think this is correct. Here is the algorithm. Imagine the matrix is a large graph. When you divide rows, you</div><div class="">can think of that as dividing the vertices into sets. If overlap = 1, it means start with my vertex set, and add all vertices</div><div class="">that are just 1 edge away from my set.</div></div></div></blockquote><div class=""><br class=""></div><div class="">I think that is what was said. You increase each subdomain by one row of vertices.</div><div class="">So in 1D, vertex 32 and 33 are in both subdomains and you have an overlap region of size 2. </div><div class="">They want an overlap region of size 1, vertex 33.</div></div></div></blockquote><div class=""><br class=""></div><div class="">This is true, but I did not think they specified a 1D mesh.</div><div class=""><br class=""></div><div class="">  Matt</div><div class=""> </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" class=""><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" class=""><div class="gmail_quote"><div class=""><br class=""></div><div class="">  Thanks,</div><div class=""><br class=""></div><div class="">     Matt</div><div class=""> </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" class=""><div class="">What you want is reasonable but requires PETSc to pick a separator set, which is not well defined.</div><div class="">You need to build that yourself with gasm (I think) if you want this.</div><div class=""><br class=""></div><div class="">Mark</div></div><br class=""><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Apr 13, 2022 at 3:17 AM Zhuo Chen <<a href="mailto:chenzhuotj@gmail.com" target="_blank" class="">chenzhuotj@gmail.com</a>> wrote:<br class=""></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" class="">Hi,<div class=""><br class=""></div><div class="">I hope that everything is going well with everybody.</div><div class=""><br class=""></div><div class="">I have a question about the PCASMSetOverlap. If I have a 128x128 matrix and I use 4 cores with overlap=1. Does it mean that from core 1 to core 4, the block ranges are (starting from 1):</div><div class=""><br class=""></div><div class="">core 1:   1:33, 1:33</div><div class="">core 2:   33:65,  33:65</div><div class="">core 3:   65:97,  65:97</div><div class="">core 4:   95:128, 95:128</div><div class=""><br class=""></div><div class="">Or is it something else? I cannot tell from the manual.</div><div class=""><br class=""></div><div class="">Many thanks in advance.</div><div class=""><br class=""></div><div class=""><br clear="all" class=""><div class=""><br class=""></div>-- <br class=""><div dir="ltr" class=""><div dir="ltr" class=""><div dir="ltr" class=""><div dir="ltr" class=""><div dir="ltr" class=""><font style="font-family:arial,sans-serif;font-size:12.8px" class="">Zhuo Chen</font><div style="font-family:arial,sans-serif;font-size:12.8px" class=""><font class="">Department of Astronomy</font></div><div style="font-family:arial,sans-serif;font-size:12.8px" class=""><font class="">Tsinghua University</font></div><div style="font-family:arial,sans-serif;font-size:12.8px" class=""><font class="">Beijing, China 100084</font></div><div class=""><font face="'comic sans ms', sans-serif" class=""><font class=""><u class=""><a href="https://czlovemath123.github.io/" target="_blank" class="">https://czlovemath123.github.io/</a></u></font><br class=""></font></div></div></div></div></div></div></div></div>
</blockquote></div>
</blockquote></div><br clear="all" class=""><div class=""><br class=""></div>-- <br class=""><div dir="ltr" class=""><div dir="ltr" class=""><div class=""><div dir="ltr" class=""><div class=""><div dir="ltr" class=""><div class="">What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br class="">-- Norbert Wiener</div><div class=""><br class=""></div><div class=""><a href="http://www.cse.buffalo.edu/~knepley/" target="_blank" class="">https://www.cse.buffalo.edu/~knepley/</a><br class=""></div></div></div></div></div></div></div></div>
</blockquote></div></div>
</blockquote></div><br clear="all" class=""><div class=""><br class=""></div>-- <br class=""><div dir="ltr" class=""><div dir="ltr" class=""><div class=""><div dir="ltr" class=""><div class=""><div dir="ltr" class=""><div class="">What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br class="">-- Norbert Wiener</div><div class=""><br class=""></div><div class=""><a href="http://www.cse.buffalo.edu/~knepley/" target="_blank" class="">https://www.cse.buffalo.edu/~knepley/</a><br class=""></div></div></div></div></div></div></div></div>
</blockquote></div><br clear="all" class=""><div class=""><br class=""></div>-- <br class=""><div dir="ltr" class=""><div dir="ltr" class=""><div dir="ltr" class=""><div dir="ltr" class=""><div dir="ltr" class=""><font style="font-family:arial,sans-serif;font-size:12.8px" class="">Zhuo Chen</font><div style="font-family:arial,sans-serif;font-size:12.8px" class=""><font class="">Department of Astronomy</font></div><div style="font-family:arial,sans-serif;font-size:12.8px" class=""><font class="">Tsinghua University</font></div><div style="font-family:arial,sans-serif;font-size:12.8px" class=""><font class="">Beijing, China 100084</font></div><div class=""><font face="'comic sans ms', sans-serif" class=""><font class=""><u class=""><a href="https://czlovemath123.github.io/" target="_blank" class="">https://czlovemath123.github.io/</a></u></font><br class=""></font></div></div></div></div></div></div>
</div></blockquote></div><br class=""></div></blockquote></div><br clear="all" class=""><div class=""><br class=""></div>-- <br class=""><div dir="ltr" class=""><div dir="ltr" class=""><div dir="ltr" class=""><div dir="ltr" class=""><div dir="ltr" class=""><font style="font-family:arial,sans-serif;font-size:12.8px" class="">Zhuo Chen</font><div style="font-family:arial,sans-serif;font-size:12.8px" class=""><font class="">Department of Astronomy</font></div><div style="font-family:arial,sans-serif;font-size:12.8px" class=""><font class="">Tsinghua University</font></div><div style="font-family:arial,sans-serif;font-size:12.8px" class=""><font class="">Beijing, China 100084</font></div><div class=""><font face="'comic sans ms', sans-serif" class=""><font class=""><u class=""><a href="https://czlovemath123.github.io/" target="_blank" class="">https://czlovemath123.github.io/</a></u></font><br class=""></font></div></div></div></div></div></div>
</blockquote></div><br clear="all" class=""><div class=""><br class=""></div>-- <br class=""><div dir="ltr" class=""><div dir="ltr" class=""><div class=""><div dir="ltr" class=""><div class=""><div dir="ltr" class=""><div class="">What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br class="">-- Norbert Wiener</div><div class=""><br class=""></div><div class=""><a href="http://www.cse.buffalo.edu/~knepley/" target="_blank" class="">https://www.cse.buffalo.edu/~knepley/</a><br class=""></div></div></div></div></div></div></div></div>
</blockquote></div><br clear="all" class=""><div class=""><br class=""></div>-- <br class=""><div dir="ltr" class=""><div dir="ltr" class=""><div dir="ltr" class=""><div dir="ltr" class=""><div dir="ltr" class=""><font style="font-family:arial,sans-serif;font-size:12.8px" class="">Zhuo Chen</font><div style="font-family:arial,sans-serif;font-size:12.8px" class=""><font class="">Department of Astronomy</font></div><div style="font-family:arial,sans-serif;font-size:12.8px" class=""><font class="">Tsinghua University</font></div><div style="font-family:arial,sans-serif;font-size:12.8px" class=""><font class="">Beijing, China 100084</font></div><div class=""><font face="'comic sans ms', sans-serif" class=""><font class=""><u class=""><a href="https://czlovemath123.github.io/" target="_blank" class="">https://czlovemath123.github.io/</a></u></font><br class=""></font></div></div></div></div></div></div>
</div></blockquote></div><br class=""></div></div></blockquote></div><br clear="all" class=""><div class=""><br class=""></div>-- <br class=""><div dir="ltr" class=""><div dir="ltr" class=""><div dir="ltr" class=""><div dir="ltr" class=""><div dir="ltr" class=""><font style="font-family:arial,sans-serif;font-size:12.8px" class="">Zhuo Chen</font><div style="font-family:arial,sans-serif;font-size:12.8px" class=""><font class="">Department of Astronomy</font></div><div style="font-family:arial,sans-serif;font-size:12.8px" class=""><font class="">Tsinghua University</font></div><div style="font-family:arial,sans-serif;font-size:12.8px" class=""><font class="">Beijing, China 100084</font></div><div class=""><font face="'comic sans ms', sans-serif" class=""><font class=""><u class=""><a href="https://czlovemath123.github.io/" target="_blank" class="">https://czlovemath123.github.io/</a></u></font><br class=""></font></div></div></div></div></div></div>
</blockquote></div><br clear="all" class=""><div class=""><br class=""></div>-- <br class=""><div dir="ltr" class=""><div dir="ltr" class=""><div dir="ltr" class=""><div dir="ltr" class=""><div dir="ltr" class=""><font style="font-family:arial,sans-serif;font-size:12.8px" class="">Zhuo Chen</font><div style="font-family:arial,sans-serif;font-size:12.8px" class=""><font class="">Department of Astronomy</font></div><div style="font-family:arial,sans-serif;font-size:12.8px" class=""><font class="">Tsinghua University</font></div><div style="font-family:arial,sans-serif;font-size:12.8px" class=""><font class="">Beijing, China 100084</font></div><div class=""><font face="'comic sans ms', sans-serif" class=""><font class=""><u class=""><a href="https://czlovemath123.github.io/" target="_blank" class="">https://czlovemath123.github.io/</a></u></font><br class=""></font></div></div></div></div></div></div>
</div></blockquote></div><br class=""></body></html>