<div dir="ltr"><div dir="ltr">On Fri, Sep 11, 2020 at 3:05 PM Zhuo Chen <<a href="mailto:chenzhuotj@gmail.com">chenzhuotj@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">Hi Hong,<div><br></div><div>Thank you very much for the plan.</div><div><br></div><div>Though it may be obvious to many Petsc gurus. I would like to summarize my solution to activate the modified Gram-Schmidt orthogonalization process in Fortran now. It may help some new Petsc users.</div><div><br></div><div>Option 1: append the -ksp_gmres_modifiedgramschmidt at runtime, the code would look like</div><div><br></div><div>call KSPSetType(ksp,KSPGMRES,ierr);CHKERRQ(ierr)<br></div><div>call KSPSetFromOptions(ksp,ierr);CHKERRQ(ierr)<br></div><div><br></div><div>and to run the program, use</div><div><br></div><div>mpiexec -np 2 ./run -ksp_gmres_modifiedgramschmidt</div><div><br></div><div>Option 2: use PetscOptionsSetValue()</div><div><br></div><div><div>call KSPSetType(ksp,KSPGMRES,ierr);CHKERRQ(ierr)<br></div><div>call KSPSetFromOptions(ksp,ierr);CHKERRQ(ierr)</div></div><div>call PetscOptionsSetValue(PETSC_NULL_OPTIONS,'-ksp_gmres_modifiedgramschmidt','1',ierr);CHKERRQ(ierr)</div></div></blockquote><div><br></div><div>Does it work if you call SetValue() after SetFromOptions()? I would not think that would work.</div><div><br></div><div> Thanks,</div><div><br></div><div> Matt</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"><div>and to run the program, use</div><div><br></div><div>mpiexec -np 2 ./run<br></div><div><br></div><div>Best.</div><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Sep 11, 2020 at 9:05 AM Zhang, 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:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr">
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<span style="font-family:Calibri,sans-serif;font-size:14.6667px;background-color:rgb(255,255,255);display:inline">Zhuo,</span><br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<span style="font-family:Calibri,sans-serif;font-size:14.6667px;background-color:rgb(255,255,255);display:inline">I'll try to get it done after the incoming release. My hands are full with more urgent tasks at moment. I'll let you know
after I'm done.</span></div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<span style="font-family:Calibri,sans-serif;font-size:14.6667px;background-color:rgb(255,255,255);display:inline">Thanks for your patience.</span></div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<span style="font-family:Calibri,sans-serif;font-size:14.6667px;background-color:rgb(255,255,255);display:inline">Hong</span></div>
<div id="gmail-m_8713853663922776980gmail-m_-4912642848290829782appendonsend"></div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<hr style="display:inline-block;width:98%">
<div id="gmail-m_8713853663922776980gmail-m_-4912642848290829782divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> Zhuo Chen <<a href="mailto:chenzhuotj@gmail.com" target="_blank">chenzhuotj@gmail.com</a>><br>
<b>Sent:</b> Thursday, September 10, 2020 8:41 PM<br>
<b>To:</b> Zhang, Hong <<a href="mailto:hzhang@mcs.anl.gov" target="_blank">hzhang@mcs.anl.gov</a>><br>
<b>Cc:</b> <a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a> <<a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a>><br>
<b>Subject:</b> Re: [petsc-users] How to activate the modified Gram-Schmidt orthogonalization process in Fortran?</font>
<div> </div>
</div>
<div>
<div dir="ltr">Hi Hong,
<div><br>
</div>
<div>According to that very old thread, KSPGMRESSetOrthogonalization was not implemented in Fortran. I did as you suggested and the compiler will tell me </div>
<div><br>
</div>
<div>undefined reference to `kspgmressetorthogonalization_'</div>
<div><br>
</div>
<div>I think I will use the -ksp_gmres_modifiedgramschmidt method. Thank you so much!</div>
</div>
<br>
<div>
<div dir="ltr">On Thu, Sep 10, 2020 at 7:32 PM Zhang, Hong <<a href="mailto:hzhang@mcs.anl.gov" target="_blank">hzhang@mcs.anl.gov</a>> wrote:<br>
</div>
<blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr">
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<span style="font-family:Calibri,sans-serif;font-size:14.6667px;background-color:rgb(255,255,255);display:inline">Zhuo,</span><br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<span style="font-family:Calibri,sans-serif;font-size:14.6667px;background-color:rgb(255,255,255);display:inline">Call </span></div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<span style="font-family:Calibri,sans-serif;font-size:14.6667px;background-color:rgb(255,255,255);display:inline">KSPSetType(ksp,KSPGMRES);<br>
</span></div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<span style="font-family:Calibri,sans-serif;font-size:14.6667px;background-color:rgb(255,255,255);display:inline">KSPGMRESSetOrthogonalization(ksp,KSPGMRESModifiedGramSchmidtOrthogonalization);<br>
</span></div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<span style="font-family:Calibri,sans-serif;font-size:14.6667px;background-color:rgb(255,255,255);display:inline">Hong</span></div>
<div id="gmail-m_8713853663922776980gmail-m_-4912642848290829782x_gmail-m_-7212973788536777380gmail-m_-2926693433037637080appendonsend">
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<hr style="display:inline-block;width:98%">
<div id="gmail-m_8713853663922776980gmail-m_-4912642848290829782x_gmail-m_-7212973788536777380gmail-m_-2926693433037637080divRplyFwdMsg" dir="ltr">
<font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> Zhuo Chen <<a href="mailto:chenzhuotj@gmail.com" target="_blank">chenzhuotj@gmail.com</a>><br>
<b>Sent:</b> Thursday, September 10, 2020 8:17 PM<br>
<b>To:</b> Zhang, Hong <<a href="mailto:hzhang@mcs.anl.gov" target="_blank">hzhang@mcs.anl.gov</a>><br>
<b>Cc:</b> <a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a> <<a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a>><br>
<b>Subject:</b> Re: [petsc-users] How to activate the modified Gram-Schmidt orthogonalization process in Fortran?</font>
<div> </div>
</div>
<div>
<div dir="ltr">Hi Hong,
<div><br>
</div>
<div>Thank you very much for your help.</div>
<div><br>
</div>
<div>It seems that if I simply append -ksp_gmres_modifiedgramschmidt the warning goes away. However KSPGMRESSetOrthogonalization(ksp,KSPGMRESModifiedGramSchmidtOrthogonalization,ierr) has another issue.</div>
<div><br>
</div>
<div>Error: Symbol ‘kspgmresmodifiedgramschmidtorthogonalization’ at (1) has no IMPLICIT type<br>
</div>
<div><br>
</div>
<div>Is it because the argument is too long? I am using gcc 8.4.0 instead of ifort</div>
</div>
<br>
<div>
<div dir="ltr">On Thu, Sep 10, 2020 at 7:08 PM Zhang, Hong <<a href="mailto:hzhang@mcs.anl.gov" target="_blank">hzhang@mcs.anl.gov</a>> wrote:<br>
</div>
<blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr">
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<span style="color:rgb(0,0,255);font-family:arial,sans-serif;font-size:12.8px;background-color:rgb(255,255,255);display:inline">Zhuo,</span><br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<span style="color:rgb(0,0,255);font-family:arial,sans-serif;font-size:12.8px;background-color:rgb(255,255,255);display:inline">Run your code with option '-ksp_gmres_modifiedgramschmidt'. For example, </span></div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<span style="color:rgb(0,0,255);font-family:arial,sans-serif;font-size:12.8px;background-color:rgb(255,255,255);display:inline">petsc/src/ksp/ksp/tutorials<br>
</span></div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<span style="color:rgb(0,0,255);font-family:arial,sans-serif;font-size:12.8px;background-color:rgb(255,255,255);display:inline">mpiexec -n 2 ./ex2 -ksp_view -ksp_gmres_modifiedgramschmidt
<div>KSP Object: 2 MPI processes</div>
<div> type: gmres</div>
<div> restart=30, using Modified Gram-Schmidt Orthogonalization</div>
<div> happy breakdown tolerance 1e-30</div>
<div> maximum iterations=10000, initial guess is zero</div>
<div> tolerances: relative=0.000138889, absolute=1e-50, divergence=10000.</div>
<div> left preconditioning</div>
<div> using PRECONDITIONED norm type for convergence test</div>
<div>PC Object: 2 MPI processes</div>
type: bjacobi<br>
</span></div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<span style="color:rgb(0,0,255);font-family:arial,sans-serif;font-size:12.8px;background-color:rgb(255,255,255);display:inline">...</span></div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<span style="color:rgb(0,0,255);font-family:arial,sans-serif;font-size:12.8px;background-color:rgb(255,255,255);display:inline"><br>
</span></div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<span style="color:rgb(0,0,255);font-family:arial,sans-serif;font-size:12.8px;background-color:rgb(255,255,255);display:inline">You can call KSPGMRESSetOrthogonalization(ksp,KSPGMRESModifiedGramSchmidtOrthogonalization) in your program.</span></div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<span style="color:rgb(0,0,255);font-family:arial,sans-serif;font-size:12.8px;background-color:rgb(255,255,255);display:inline"><br>
</span></div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<span style="color:rgb(0,0,255);font-family:arial,sans-serif;font-size:12.8px;background-color:rgb(255,255,255);display:inline">Hong</span></div>
<div id="gmail-m_8713853663922776980gmail-m_-4912642848290829782x_gmail-m_-7212973788536777380gmail-m_-2926693433037637080x_gmail-m_4843333755770207763appendonsend">
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<hr style="display:inline-block;width:98%">
<div id="gmail-m_8713853663922776980gmail-m_-4912642848290829782x_gmail-m_-7212973788536777380gmail-m_-2926693433037637080x_gmail-m_4843333755770207763divRplyFwdMsg" dir="ltr">
<font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> petsc-users <<a href="mailto:petsc-users-bounces@mcs.anl.gov" target="_blank">petsc-users-bounces@mcs.anl.gov</a>> on behalf of Zhuo Chen <<a href="mailto:chenzhuotj@gmail.com" target="_blank">chenzhuotj@gmail.com</a>><br>
<b>Sent:</b> Thursday, September 10, 2020 7:52 PM<br>
<b>To:</b> <a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a> <<a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a>><br>
<b>Subject:</b> [petsc-users] How to activate the modified Gram-Schmidt orthogonalization process in Fortran?</font>
<div> </div>
</div>
<div>
<div dir="ltr">Dear Petsc users,
<div><br>
</div>
<div>I found an ancient thread discussing this problem.</div>
<div><br>
</div>
<div><a href="https://lists.mcs.anl.gov/pipermail/petsc-users/2011-October/010607.html" target="_blank">https://lists.mcs.anl.gov/pipermail/petsc-users/2011-October/010607.html</a><br>
</div>
<div><br>
</div>
<div>However, when I add</div>
<div><br>
</div>
<div>call KSPSetType(ksp,KSPGMRES,ierr);CHKERRQ(ierr)</div>
<div>call PetscOptionsSetValue(PETSC_NULL_OPTIONS,'-ksp_gmres_modifiedgramschmidt','1',ierr);CHKERRQ(ierr)<br>
</div>
<div><br>
</div>
<div>the program will tell me</div>
<div><br>
</div>
<div>WARNING! There are options you set that were not used!<br>
WARNING! could be spelling mistake, etc!<br>
There is one unused database option. It is:<br>
Option left: name:-ksp_gmres_modifiedgramschmidt value: 1<br>
</div>
<div><br>
</div>
<div>I would like to know the most correct way to activate the modified Gram-Schmidt orthogonalization process in Fortran. Thank you very much!</div>
<div><br>
</div>
<div>Best regards. </div>
<div><br>
</div>
<div><br>
</div>
<div><br clear="all">
<div><br>
</div>
-- <br>
<div dir="ltr">
<div dir="ltr">
<div>
<div dir="ltr">
<div dir="ltr">
<div dir="ltr"><font color="#0000ff" style="font-family:arial,sans-serif;font-size:12.8px">Zhuo Chen</font>
<div style="font-family:arial,sans-serif;font-size:12.8px"><font color="#0000ff">Department of Physics</font></div>
<div style="font-family:arial,sans-serif;font-size:12.8px"><font color="#0000ff">University of Alberta</font></div>
<div style="font-family:arial,sans-serif;font-size:12.8px"><font color="#0000ff">Edmonton Alberta, Canada T6G 2E1</font></div>
<div><font face="'comic sans ms', sans-serif"><a href="http://www.pas.rochester.edu/~zchen25/" style="background-color:rgb(255,255,255)" target="_blank"><font color="#000000">http://www.pas.rochester.edu/~zchen25/</font></a><br>
</font></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
<br clear="all">
<div><br>
</div>
-- <br>
<div dir="ltr">
<div dir="ltr">
<div>
<div dir="ltr">
<div dir="ltr">
<div dir="ltr"><font color="#0000ff" style="font-family:arial,sans-serif;font-size:12.8px">Zhuo Chen</font>
<div style="font-family:arial,sans-serif;font-size:12.8px"><font color="#0000ff">Department of Physics</font></div>
<div style="font-family:arial,sans-serif;font-size:12.8px"><font color="#0000ff">University of Alberta</font></div>
<div style="font-family:arial,sans-serif;font-size:12.8px"><font color="#0000ff">Edmonton Alberta, Canada T6G 2E1</font></div>
<div><font face="'comic sans ms', sans-serif"><a href="http://www.pas.rochester.edu/~zchen25/" style="background-color:rgb(255,255,255)" target="_blank"><font color="#000000">http://www.pas.rochester.edu/~zchen25/</font></a><br>
</font></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
<br clear="all">
<div><br>
</div>
-- <br>
<div dir="ltr">
<div dir="ltr">
<div>
<div dir="ltr">
<div dir="ltr">
<div dir="ltr"><font color="#0000ff" style="font-family:arial,sans-serif;font-size:12.8px">Zhuo Chen</font>
<div style="font-family:arial,sans-serif;font-size:12.8px"><font color="#0000ff">Department of Physics</font></div>
<div style="font-family:arial,sans-serif;font-size:12.8px"><font color="#0000ff">University of Alberta</font></div>
<div style="font-family:arial,sans-serif;font-size:12.8px"><font color="#0000ff">Edmonton Alberta, Canada T6G 2E1</font></div>
<div><font face="'comic sans ms', sans-serif"><a href="http://www.pas.rochester.edu/~zchen25/" style="background-color:rgb(255,255,255)" target="_blank"><font color="#000000">http://www.pas.rochester.edu/~zchen25/</font></a><br>
</font></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr"><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><font color="#0000ff" style="font-family:arial,sans-serif;font-size:12.8px">Zhuo Chen</font><div style="font-family:arial,sans-serif;font-size:12.8px"><font color="#0000ff">Department of Physics</font></div><div style="font-family:arial,sans-serif;font-size:12.8px"><font color="#0000ff">University of Alberta</font></div><div style="font-family:arial,sans-serif;font-size:12.8px"><font color="#0000ff">Edmonton Alberta, Canada T6G 2E1</font></div><div><font face="'comic sans ms', sans-serif"><a href="http://www.pas.rochester.edu/~zchen25/" style="background-color:rgb(255,255,255)" target="_blank"><font color="#000000">http://www.pas.rochester.edu/~zchen25/</font></a><br></font></div></div></div></div></div></div></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><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>