26

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.

Jackie
  • 1,071
  • 2
  • 12
  • 17
  • MPI: Message Passing Interface, a computer communications protocol for parallel computation. See http://en.wikipedia.org/wiki/Message_Passing_Interface – Thomas Matthews Feb 16 '10 at 19:21

7 Answers7

17

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 :-)

J Teller
  • 1,421
  • 1
  • 11
  • 14
  • 1
    +1 from me. One small issue, which might or might not be a problem: switches between Fortran, C, and C++ sample code. – stephan Feb 16 '10 at 18:31
  • I agree it could be a bit annoying, but I didn't find it to be a significant detriment to understanding when I was using the book. – J Teller Feb 16 '10 at 18:39
8

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.

Taylor Leese
  • 51,004
  • 28
  • 112
  • 141
7

LLNL has a pretty good one.

Jerry Coffin
  • 476,176
  • 80
  • 629
  • 1,111
6

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 deprecating 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.

Andrew Regan
  • 5,087
  • 6
  • 37
  • 73
Stan Graves
  • 6,795
  • 2
  • 18
  • 14
  • For those who intent to stick with C++ which are the alternatives to MPI? To my knowledge its the only way to split things across different machines. There is OpenMP and CUDA but that's another business - I'll say. – KcFnMi Aug 18 '18 at 06:13
6

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.

Edric
  • 23,676
  • 2
  • 38
  • 40
2

some get started manual may be found on LAM/MPI site

shuvalov
  • 4,713
  • 2
  • 20
  • 17
2

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.

Anycorn
  • 50,217
  • 42
  • 167
  • 261