Hi Matthew, Yes. These four lines are in a do while loop.
On Fri, Sep 11, 2020 at 2:07 PM Matthew Knepley <[email protected]> wrote: > On Fri, Sep 11, 2020 at 3:56 PM Zhuo Chen <[email protected]> wrote: > >> Hi Matthew, >> >> Yes, if use >> >> call KSPSetType(ksp,KSPGMRES,ierr);CHKERRQ(ierr) >> call KSPSetFromOptions(ksp,ierr);CHKERRQ(ierr) >> call >> PetscOptionsSetValue(PETSC_NULL_OPTIONS,'-ksp_gmres_modifiedgramschmidt','1',ierr);CHKERRQ(ierr) >> call >> PetscOptionsSetValue(PETSC_NULL_OPTIONS,'-ksp_view','',ierr);CHKERRQ(ierr) >> > > Are you running in a loop? > > Thanks, > > Matt > > >> to see if the modified Gram-Schmidt process is actually active. The >> output is >> >> KSP Object: 4 MPI processes >> type: gmres >> restart=30, using Modified Gram-Schmidt Orthogonalization >> happy breakdown tolerance 1e-30 >> maximum iterations=10000, initial guess is zero >> tolerances: relative=1e-11, absolute=1e-50, divergence=10000. >> left preconditioning >> using PRECONDITIONED norm type for convergence test >> >> I think that means calling PetscOptionsSetValue() >> after KSPSetFromOptions() works. Correct me if I am wrong. >> >> Best. >> >> On Fri, Sep 11, 2020 at 1:31 PM Matthew Knepley <[email protected]> >> wrote: >> >>> On Fri, Sep 11, 2020 at 3:05 PM Zhuo Chen <[email protected]> wrote: >>> >>>> Hi Hong, >>>> >>>> Thank you very much for the plan. >>>> >>>> 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. >>>> >>>> Option 1: append the -ksp_gmres_modifiedgramschmidt at runtime, the >>>> code would look like >>>> >>>> call KSPSetType(ksp,KSPGMRES,ierr);CHKERRQ(ierr) >>>> call KSPSetFromOptions(ksp,ierr);CHKERRQ(ierr) >>>> >>>> and to run the program, use >>>> >>>> mpiexec -np 2 ./run -ksp_gmres_modifiedgramschmidt >>>> >>>> Option 2: use PetscOptionsSetValue() >>>> >>>> call KSPSetType(ksp,KSPGMRES,ierr);CHKERRQ(ierr) >>>> call KSPSetFromOptions(ksp,ierr);CHKERRQ(ierr) >>>> call >>>> PetscOptionsSetValue(PETSC_NULL_OPTIONS,'-ksp_gmres_modifiedgramschmidt','1',ierr);CHKERRQ(ierr) >>>> >>> >>> Does it work if you call SetValue() after SetFromOptions()? I would not >>> think that would work. >>> >>> Thanks, >>> >>> Matt >>> >>> >>>> and to run the program, use >>>> >>>> mpiexec -np 2 ./run >>>> >>>> Best. >>>> >>>> >>>> >>>> On Fri, Sep 11, 2020 at 9:05 AM Zhang, Hong <[email protected]> wrote: >>>> >>>>> Zhuo, >>>>> 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. >>>>> Thanks for your patience. >>>>> Hong >>>>> >>>>> ------------------------------ >>>>> *From:* Zhuo Chen <[email protected]> >>>>> *Sent:* Thursday, September 10, 2020 8:41 PM >>>>> *To:* Zhang, Hong <[email protected]> >>>>> *Cc:* [email protected] <[email protected]> >>>>> *Subject:* Re: [petsc-users] How to activate the modified >>>>> Gram-Schmidt orthogonalization process in Fortran? >>>>> >>>>> Hi Hong, >>>>> >>>>> According to that very old thread, KSPGMRESSetOrthogonalization was >>>>> not implemented in Fortran. I did as you suggested and the compiler will >>>>> tell me >>>>> >>>>> undefined reference to `kspgmressetorthogonalization_' >>>>> >>>>> I think I will use the -ksp_gmres_modifiedgramschmidt method. Thank >>>>> you so much! >>>>> >>>>> On Thu, Sep 10, 2020 at 7:32 PM Zhang, Hong <[email protected]> >>>>> wrote: >>>>> >>>>> Zhuo, >>>>> Call >>>>> KSPSetType(ksp,KSPGMRES); >>>>> >>>>> KSPGMRESSetOrthogonalization(ksp,KSPGMRESModifiedGramSchmidtOrthogonalization); >>>>> Hong >>>>> >>>>> ------------------------------ >>>>> *From:* Zhuo Chen <[email protected]> >>>>> *Sent:* Thursday, September 10, 2020 8:17 PM >>>>> *To:* Zhang, Hong <[email protected]> >>>>> *Cc:* [email protected] <[email protected]> >>>>> *Subject:* Re: [petsc-users] How to activate the modified >>>>> Gram-Schmidt orthogonalization process in Fortran? >>>>> >>>>> Hi Hong, >>>>> >>>>> Thank you very much for your help. >>>>> >>>>> It seems that if I simply append -ksp_gmres_modifiedgramschmidt the >>>>> warning goes away. However >>>>> KSPGMRESSetOrthogonalization(ksp,KSPGMRESModifiedGramSchmidtOrthogonalization,ierr) >>>>> has another issue. >>>>> >>>>> Error: Symbol ‘kspgmresmodifiedgramschmidtorthogonalization’ at (1) >>>>> has no IMPLICIT type >>>>> >>>>> Is it because the argument is too long? I am using gcc 8.4.0 instead >>>>> of ifort >>>>> >>>>> On Thu, Sep 10, 2020 at 7:08 PM Zhang, Hong <[email protected]> >>>>> wrote: >>>>> >>>>> Zhuo, >>>>> Run your code with option '-ksp_gmres_modifiedgramschmidt'. For >>>>> example, >>>>> petsc/src/ksp/ksp/tutorials >>>>> mpiexec -n 2 ./ex2 -ksp_view -ksp_gmres_modifiedgramschmidt >>>>> KSP Object: 2 MPI processes >>>>> type: gmres >>>>> restart=30, using Modified Gram-Schmidt Orthogonalization >>>>> happy breakdown tolerance 1e-30 >>>>> maximum iterations=10000, initial guess is zero >>>>> tolerances: relative=0.000138889, absolute=1e-50, divergence=10000. >>>>> left preconditioning >>>>> using PRECONDITIONED norm type for convergence test >>>>> PC Object: 2 MPI processes >>>>> type: bjacobi >>>>> ... >>>>> >>>>> You can >>>>> call >>>>> KSPGMRESSetOrthogonalization(ksp,KSPGMRESModifiedGramSchmidtOrthogonalization) >>>>> in your program. >>>>> >>>>> Hong >>>>> >>>>> ------------------------------ >>>>> *From:* petsc-users <[email protected]> on behalf of >>>>> Zhuo Chen <[email protected]> >>>>> *Sent:* Thursday, September 10, 2020 7:52 PM >>>>> *To:* [email protected] <[email protected]> >>>>> *Subject:* [petsc-users] How to activate the modified Gram-Schmidt >>>>> orthogonalization process in Fortran? >>>>> >>>>> Dear Petsc users, >>>>> >>>>> I found an ancient thread discussing this problem. >>>>> >>>>> >>>>> https://lists.mcs.anl.gov/pipermail/petsc-users/2011-October/010607.html >>>>> >>>>> However, when I add >>>>> >>>>> call KSPSetType(ksp,KSPGMRES,ierr);CHKERRQ(ierr) >>>>> call >>>>> PetscOptionsSetValue(PETSC_NULL_OPTIONS,'-ksp_gmres_modifiedgramschmidt','1',ierr);CHKERRQ(ierr) >>>>> >>>>> the program will tell me >>>>> >>>>> WARNING! There are options you set that were not used! >>>>> WARNING! could be spelling mistake, etc! >>>>> There is one unused database option. It is: >>>>> Option left: name:-ksp_gmres_modifiedgramschmidt value: 1 >>>>> >>>>> I would like to know the most correct way to activate the modified >>>>> Gram-Schmidt orthogonalization process in Fortran. Thank you very much! >>>>> >>>>> Best regards. >>>>> >>>>> >>>>> >>>>> >>>>> -- >>>>> Zhuo Chen >>>>> Department of Physics >>>>> University of Alberta >>>>> Edmonton Alberta, Canada T6G 2E1 >>>>> http://www.pas.rochester.edu/~zchen25/ >>>>> >>>>> >>>>> >>>>> -- >>>>> Zhuo Chen >>>>> Department of Physics >>>>> University of Alberta >>>>> Edmonton Alberta, Canada T6G 2E1 >>>>> http://www.pas.rochester.edu/~zchen25/ >>>>> >>>>> >>>>> >>>>> -- >>>>> Zhuo Chen >>>>> Department of Physics >>>>> University of Alberta >>>>> Edmonton Alberta, Canada T6G 2E1 >>>>> http://www.pas.rochester.edu/~zchen25/ >>>>> >>>> >>>> >>>> -- >>>> Zhuo Chen >>>> Department of Physics >>>> University of Alberta >>>> Edmonton Alberta, Canada T6G 2E1 >>>> http://www.pas.rochester.edu/~zchen25/ >>>> >>> >>> >>> -- >>> What most experimenters take for granted before they begin their >>> experiments is infinitely more interesting than any results to which their >>> experiments lead. >>> -- Norbert Wiener >>> >>> https://www.cse.buffalo.edu/~knepley/ >>> <http://www.cse.buffalo.edu/~knepley/> >>> >> >> >> -- >> Zhuo Chen >> Department of Physics >> University of Alberta >> Edmonton Alberta, Canada T6G 2E1 >> http://www.pas.rochester.edu/~zchen25/ >> > > > -- > What most experimenters take for granted before they begin their > experiments is infinitely more interesting than any results to which their > experiments lead. > -- Norbert Wiener > > https://www.cse.buffalo.edu/~knepley/ > <http://www.cse.buffalo.edu/~knepley/> > -- Zhuo Chen Department of Physics University of Alberta Edmonton Alberta, Canada T6G 2E1 http://www.pas.rochester.edu/~zchen25/
