Menu

Implementing: "A simple strategy for varying the restart parameter in GMRES(m)"

tario
2017-09-29
2017-09-29
  • tario

    tario - 2017-09-29

    Hello Karli,

    I tried to implement "A simple strategy for varying the restart parameter in GMRES(m)" by A. H. Baker, E. R. Jessup, Tz. V. Kolev, 2007.

    The idea is to minimise the number of Krylov spaces based on convergence to speed-up GMRES.

    I tried to wrap it around the code from line 512 to 633.

    Problems:

    1: I was not able to overwrite krylov_dim in line 516. Why is that?
    2: I am not sure, whether I calculate the convergence rate cr ( = cosine of the sequential angle ) correctly?

    Am I on the wrong track with my implementation approach?

    // Dynamically computes the krylov_dim for the next iteration based on current convergence rate --------
    unsigned int m_min = 3;
    unsigned int m_max = 30;
    unsigned int m_old = 30;
    unsigned int cr = 1;  /* convergence rate */
    unsigned int i = 0;  /* convergence rate */
    double max_cr = cos(8);  /* max conv. rate = cosine of 8 degrees ≈ .99 */
    double min_cr = cos(80);  /* min conv. rate = cosine of 80 degrees ≈ .175 */
    double res_old;
    unsigned int d = 3;  /* increment for adjusting */
    
    //
    // Dynamic GMRES
    //
    
    while ( tag.error() > tag.tolerance() )
    {
    /* calculate restart parameter mi */
    if (cr > max_cr || i == 0 ) /* first cycle or near stagnation */
    krylov_dim = m_max;
    else if ( cr < min_cr ) /* converging well */
    krylov_dim = m_min;
    else /* adjust */
    if ((m_old - d) >= m_min)
    krylov_dim = (m_old - d);
    else
    krylov_dim = m_max;
    
    // GMRES 512-633
    
    /* calculate convergence rate ( = cosine of the sequential angle) */
    
    i += i; 
    cr = std::fabs(res[k] / res_old);
    res_old = res[k];
    
    } // end while
    
     
  • Karl Rupp

    Karl Rupp - 2017-09-29

    Hi tario,

    ad 1): What do you mean? krylov_dim is a local variable, so you can definitely overwrite it with whatever value you prefer. Make sure that your temporary work arrays are appropriately sized, though (that is, making krylov_dim smaller is no problem, but making krylov_dim larger than the initial value requires a larger set of Krylov vectors).

    ad 2): cr looks alright. However, your cr_min and cr_max are likely to be wrong, because cos() takes radians instead of degrees.

    Note: i += i; looks suspicious.

    I'm curious: What are you expecting to gain from variable Krylov spaces?

    Best regards,
    Karli

     
  • tario

    tario - 2017-09-29

    Have a look at the attached paper

     

Log in to post a comment.