Menu

GMRES + AMG amg_coarse_problem_too_large_exception

tario
2017-09-07
2017-09-07
  • tario

    tario - 2017-09-07

    Hello Karli,

    I need to bring the pressure residuals down. CG fails completely with initial residuals e′-340, GMRES or bicgstab with block preconditioner work but residuals are too high. So maybe AMG can help.

    My case has n = 40800 with nnz = 203000 so it's not a large case.

    After hours of trial and error, I keep getting the following error:

    terminate called after throwing an instance of 'viennacl::linalg::amg_coarse_problem_too_large_exception'
      what():  No further coarsening possible (1050 coarse points). Consider changing the strong connection threshold or increasing the coarsening cutoff.
    

    Setup is:

    // AMG PRECONDITIONER SETUP --------------------------------------------------
    
        viennacl::context host_ctx(viennacl::MAIN_MEMORY);
        // viennacl::context target_ctx(viennacl::CUDA_MEMORY);
    
        viennacl::linalg::amg_tag amg_tag_direct;
        amg_tag_direct.set_coarsening_method(viennacl::linalg::AMG_COARSENING_METHOD_ONEPASS); // classic option: AMG_COARSENING_METHOD_ONEPASS
                                                   //             AMG_COARSENING_METHOD_MIS2_AGGREGATION
        amg_tag_direct.set_interpolation_method(viennacl::linalg::AMG_INTERPOLATION_METHOD_SMOOTHED_AGGREGATION ); // other options: AMG_INTERPOLATION_METHOD_DIRECT 
        amg_tag_direct.set_strong_connection_threshold(0.25);                              // AMG_INTERPOLATION_METHOD_AGGREGATION
        amg_tag_direct.set_coarse_levels(0);                               
        amg_tag_direct.set_coarsening_cutoff (100);                           
        amg_tag_direct.set_jacobi_weight(0.67); // 0.67-1.0
        amg_tag_direct.set_presmooth_steps(1);
        amg_tag_direct.set_postsmooth_steps(1);
        amg_tag_direct.set_setup_context(host_ctx);    // run setup on host
        amg_tag_direct.set_target_context(host_ctx); // run solver cycles on GPU device would be target_ctx
    
        viennacl::linalg::amg_tag my_amg_tag;
        // customize my_amg_tag here if needed
        viennacl::linalg::amg_precond<viennacl::compressed_matrix<ScalarType> > my_amg(vcl_matrix, my_amg_tag);
        my_amg.setup();
    
    // -------------------------------------------------------------------------------
    
        // Solve the linear system
        vcl_psi  = solve(vcl_matrix,
                          vcl_source,
                          gmres, // was viennacl::linalg::gmres_tag(),
                          my_amg); // was vcl_ilut or vcl_block_ilu0 my_amg
    

    Which parameters help to reduce the size of the AMG coarsening setup?

    T.

     
  • Karl Rupp

    Karl Rupp - 2017-09-07

    Hi Tario,

    are your pressure equations singular? If so, it's essential to project out the nullspace, for which ViennaCL currently does not have an interface.
    As for AMG: Have you tried adjusting the strong connection threshold? You may also want to use viennacl::linalg::AMG_INTERPOLATION_METHOD_DIRECT for the interpolation, as smoothed aggreggation results in denser problems on the coarse grid.

    Best regards,
    Karli

     
  • tario

    tario - 2017-09-07

    are your pressure equations singular?

    Well, looking at "expert comments" it's not but it's symmetric & tricky:

    The best information I have at hand is:

    "... To go back to the pressure equation, keeping in mind what said above (matrix theory elaborating on the mathematical definition on the term "singular"), you cannot say the matrix originating from its discretization is singular, since it is actually admit inverse (you indirectly determine it by solving the linear system itself).

    The matrix of the linear system originating from the discretization of the pressure Poisson equation in standard form is tridiagonal or, more generally, block tridiagonal. There are specific algorithms for the solution of this kind of matrix (Thomas algorithm and its block version for example), which are very effective due to their low computational cost (Thomas algorithm costs O(n), while Gauss method costs O(n^3), for example). ..."

    Have you tried adjusting the strong connection threshold?

    Yes, lower and higher but I have no idea what the applicable range +/- is.

     

Log in to post a comment.