I'm learning MPI in order to use MPI with a model written in Fortran. What are some good resources (books, websites, etc.)? Introductory/beginner material, and detailed references would both be appreciated.
-
1$\begingroup$ I learned it while writing my own code(s). Using MPI is fairly straightforward. Having said that these days there are higher level tools both for numerical work (libraries/solvers such as PETSc/MUMPS etc.) and also for parallel IO (Parallel NetCDF and HDF5). $\endgroup$– staliCommented May 2, 2015 at 22:29
-
2$\begingroup$ The MPI reference manual (mpi-forum.org/docs) is probably the best source as it's complete, up to date, and detailed. There are also tutorials like computing.llnl.gov/tutorials/mpi It's very difficult to give an authoritative answer to a question like this. $\endgroup$– KirillCommented May 2, 2015 at 22:42
-
2$\begingroup$ A big +1 to computing.llnl.gov/tutorials/mpi and other material written by Blaise Barney. Those tutorials are well-written and focus on the most important parts of each API. They can, however, be a bit dated. For example, I don't think the MPI one has been updated for MPI-3 yet. $\endgroup$– Jeff HammondCommented May 4, 2015 at 0:45
3 Answers
The two books that come to mind are Using MPI and Using Advanced MPI by Gropp and Lusk. They were also released in a 3rd edition last year, so they are very up to date. As others have said, the reference manuals are open and available for free. It's nice to have the books to help you get started and the reference manuals to look up certain details.
First, you should make sure that you understand the fundamentals of parallel processing first. It's very hard to write good MPI code if you don't understand the principles of distributed computing. You might find Patterns for Parallel Programming useful, although there are plenty of other books on the topic of parallel programming.
Full disclosure: I work for one of the authors of "Patterns for Parallel Programming", but I have confirmed that none of the authors make enough money off of it to justify me recommending for any other reason than technical value.
Second, read well-written MPI applications (not necessarily Fortran ones - see the next point) for insight. It is often the case that the examples suitable for textbooks and tutorials gloss over some of the nuances that you will need to understand to be successful in your work. For example, every book I've seen on MPI covers the 2D heat equation solver using the Jacobi method, but absolutely no one should use Jacobi in the "real world".
Third, you may find that there is a lot of good MPI material written for C programmers, which means that you should not focus specifically on Fortran in your search for knowledge. And without trying to be a language bigot, I find that the MPI examples written by C programmers are - on average - better than those written by Fortran programmers. This is correlation (primarily with the authors' academic training), not causality.
Fourth, you will inevitably write an incorrect MPI program some day and need to debug it. OpenMPI's FAQ: Debugging applications in parallel is a great starting point for learning about that topic.
I would also like to recommend Using MPI. I used this book back at school to implement some CFD codes on a cluster. It's a very good reference and discusses using MPI with C, C++, and Fortran.
The book provides simple examples to help you get into the mindset of breaking your problem into one that can be distributed across different computers, in the event you're not too familiar with that sort of thinking.
If you are ever interested in taking your skills further and going into heterogeneous programming (CUDA, OpenCL), you could also check out a course on Coursera that goes over some pretty approaches and concepts.