Parallel and Distributed Programming (MPI Programming)

written by Taro L. Saito

C++ Source Codes

How To Build

  • In Windows, it requies Visual Studio C++ 2003 (or newer version):
    • Install MPICH2
    • Download Boost C++ Library and build it.
      • Here is a good explanation of the build steps probided by Inaba-kun
    • Add $(MPICH2_INSTALL_PATH)/include and $(BOOST_INSTALL_PATH)/include/boost_1_3X_X to Options -> Projects -> VC++ Directories -> Include files.
    • Add $(MPICH2_INSTALL_PATH)/lib and $(BOOST_INSTALL_PATH)/lib to Options -> Projects -> VC++ Directories -> Library files.
    • Perform Build.
  • In UNIX (including linux, MaxOSX):
   pdp > ./configure --with-boost=$(BOOST_INCLUDE_PATH) --with-antlr=$(ANTLR_C++_INCLUDE_PATH) --with-mpich2=$(MPICH2_INCLUDE_PATH)
   pdp > make 
  • I'm not well-experienced to write configure script, so there may be some flaws. If you have trobles to compile these files, contact and ask me.

MPICH2 Setup

  • The following command invokes MPICH2 daemons in several servers listed on $(HOSTNAME_LIST_FILE), whose lines contain host names accessible from the current machine using rsh or ssh without password authentication:
 > mpdboot -np $(NUM_PROCESS) -f $(HOSTNAME_LIST_FILE) 
 ...      
  • Then, test mpd daemons working correctly:
 > mpdtrace
 istbs000.i.u-tokyo.ac.jp
 istba002.i.u-tokyo.ac.jp
 ...

Running Programs

  • Replication Program
    • mpiexec
      • -n specifies number of processes to be spawned
      • -l option displays messages of each process prefixed with its process rank
 > mpiexec -n 10 -l Replication -d (the output folder of receiver processes) (file path)
 ( sending a file to the remote proceses)
  • N-Body Simulation Program
     > mpiexec -n 20 -l N-body -d -p (NUM_PARTICLES) -s (NUM_STEPS)  
    

MPI References

  • MPICH2 C++ API

MPI Implementations

Memorandums

Routing

Attachments