SUMMARYAlgebraic multigrid (AMG) is one of the most effective iterative methods for the solution of large, sparse linear systems obtained from the discretization of second-order scalar elliptic self-adjoint partial differential equations. It can also be used as a preconditioner for Krylov subspace methods. In this communication, we report on the design and development of a robust, effective and portable Fortran 95 implementation of the classical Ruge-Stüben AMG, which is available as package HSL MI20 within the HSL mathematical software library. The routine can be used as a 'black-box' preconditioner, but it also offers the user a range of options and parameters. Proper tuning of these parameters for a particular application can significantly enhance the performance of an AMG-preconditioned Krylov solver. This is illustrated using a number of examples arising in the unstructured finite element discretization of the diffusion, the convection-diffusion, and the Stokes equations, as well as transient thermal convection problems associated with the Boussinesq approximation of the Navier-Stokes equations in 3D.