nekStab / LightKrylov

Lightweight implementation of Krylov subspace techniques in Fortran.
BSD 3-Clause "New" or "Revised" License
18 stars 0 forks source link

Add in-code documentation #8

Closed loiseaujc closed 8 months ago

loiseaujc commented 1 year ago

We need to document the critical subroutines. I suggest we follow what you've done (@ricardofrantz) for the GMRES, CG and BiCGSTAB solvers.

ricardofrantz commented 1 year ago

Hi JC, some recent updates to the documentation branch:

main function headers, improved some allocation to prevent compiler warnings, eliminated unused variables and started integration wth stdlib_error and stdlib_logging, currently applied only to the GMRES function as a pilot for understanding functionality.

Discussion Points:

Maybe the more useful are

  1. none_level (Verbosity=0): Suppresses all logging. Effective when no output is desired.
  2. error_level (Verbosity=1): Captures crucial error messages that could halt program execution.
  3. warning_level (Verbosity=2): potential issues that warrant attention but are not critical.
  4. information_level (Verbosity=3): Logs operational statuses without the intricate details.
  5. debug_level (Verbosity=4): Logs detailed messages.

I think this is too complicated, and we only need 3 categories: nothing, info and debug. verbosity 1 2 and 3 or 0 1 2.

Also for now we are returning info = -1 for error and info = 0 for success. How about:

Also, I am still randomly seeing this problem:

--------------------------------------------------
+ Starting SVD Singular Values ... (1/1)
--------------------------------------------------
      ... SVD Singular Values [FAILED]
      Message: Logical value mismatch
               expected 'T' but received 'F'
loiseaujc commented 1 year ago

Regarding the SVD error: it has to do with the precision which is too tight (1.0D-12). This isn't much of a problem. We only need a quick fix for the test (or there may be a more subtle bug in the implementation but I don't think so).

As for the logging: none_level, error_level are definitely needed. I am not sure about the warning_level or the debug_level. Which info would you output for the debug_level?

Regarding info, I agree that we could stick to the BLAS/LAPACK standard. We need to find a way though for Krylov methods to return information about the computation. I'm mostly thinking of the number of calls to matvec or the size of the computed Krylov subspace if the residual reaches our tolerance (remember that the whole Krylov subspace is pre-allocated ahead of time). Other pieces of information might also be useful in some cases, albeit I don't have a particular idea in mind yet.