# Algebraic Multigrid Code

I would like to understand more details about the implementation of Algebraic Multigrid Methods (AMG). I have been reading "A Multigrid Tutorial", which is quite good and explain all the details of the interpolation, coarse-grid operator and coarse grid selection for AMG. However, I think, there is nothing like playing around and reading a code.

So, I would like to ask if anyone knows any classical AMG "example code", like the geometric multigrid FORTRAN code available at the end of "Multigrid Methods" (SIAM) by S. F. McCormick. It is quite hard to get a high quality and production code like BoomerAMG to learn more about the method.

• Are you specifically interested in classical AMG (as opposed to *smoothed aggregation)? If so, please state this in the question. Feb 14 '12 at 0:04

BoomerAMG is a part of the Hypre package, which is dead simple to acquire. A much less complex code if you're starting out looking at these methods might be PyAMG.

• Yes, I had a look at PyAMG, which is a very nice code, but it has all this stuff about wrapping C/C++ code in Python, it implements different AMG methods other than the "classical" one, and so on. I was looking for something simpler, that people use for teaching. Feb 13 '12 at 14:05
• Unfortunately, the general experience with using and trying to contribute to AMG codes is that if you don't have a multitude of options you aren't able to solve anything approaching an interesting problem. Therefore, your typical AMG package will include a number of options for connectedness approximation, interpolator construction and smoothing that is certainly hard to parse by code reading. That being said, the classical AMG is dead simple, and implementing it yourself or having your students try to do this themselves (depending on their skill level) may be the way to go. Feb 13 '12 at 22:56

I highly recommend Alfio Borizi's introduction to algebraic multigrid method. There is a sample fortran 77 code in appendix A.

• I think he is asking about implementations, not more literature. Feb 13 '12 at 14:33
• @JackPoulson: It has an implementation in the appendix.
– Paul
Feb 13 '12 at 14:37
• Sorry, apparently I cannot read this morning. Upvoted. Feb 13 '12 at 14:55
• @Paul: I might be wrong, but I think this a geometric multigrid code for Poisson problem (which works for the nonlinear case as well). Feb 13 '12 at 19:38
• @BernardoM.R.: I just found this postscript file... It has lots of concrete examples of prolongation and restriction operators for model problems. It doesn't really have a full code though, but it may still be of some use to you.
– Paul
Feb 13 '12 at 23:34

There is also the ML package that's part of Trilinos. Its reputation is equally good as that of BoomerAMG/hypre.

A newer Trilinos package for AMG is called MueLu, I believe, and should also be available in the more recent releases.

All of these are open source.

• MueLu has not been released and last time I talked to him, Ray didn't expect a public release for another year or so. Note that ML and MueLu (to the extent that I have heard what is in it) are based on smoothed aggregation which is quite a different algorithm from classical AMG (on which BoomerAMG is based). Feb 14 '12 at 0:07

I've been working on this implementation for a little while. It's Python/Numpy/Scipy. It's not algebraic multigrid--you have to supply your own restriction operator. But if it's an education implementation in which you're interested, I would welcome some pull requests to add such capability.