Hi, I plan to use MPI for my C++ code. I have installed MPICH2 on my computers. But I do not know much about MPI and hope to find some materials to read. I hope you experts can recommend some good materails to me. Any advice will be appreciated.
Parallel Programming with MPI by Peter S. Pacheco is a good intro book. Note, the book uses C, but it should be an easy transition to using the C++ MPI bindings.
I'm assuming you already know how to program C++ pretty well and have a basic understanding of parallel programming (or at least know how you want to parallelize your code).
I would check out the book Using MPI first. Using MPI 2 is the follow on book that discusses using the new bits in MPi-2. Both books were written by the guys who wrote the MPI library and headed up the standardization effort. One nice thing about Using MPI is that it's available online so you can check it out w/o spending money :-)
hello
Mpich2 comes with a number of examples in C++/C. probably the most famous is cpi, which computes pi in parallel. Read through the program together with manuals/books other people suggested. This way you will see actual working code right away and can make your own modifications to play with things.
I would advise against using the MPI C++ bindings for any new development. The program itself can be in C++, but invest the extra effort to use the C interface to the MPI library.
The MPI Forum is depreciating the C++ bindings. So, future implementations of MPI will probably drop support for C++. In general, most implementations skimp on features when it comes to C++. The basics will work, but things like dynamic processes (i.e. spawn), the PMPI interfaces, and so on are less well supported.
The C and Fortran bindings are reasonably well supported by all the major implementations, and will continue to be supported into the foreseeable future.
As @semiuseless pointed out, the MPI forum is deprecating the C++ bindings. One of the reasons for that is that the boost MPI interface does a much better job.