CSE-700 Parallel Programming - Resources

[ Home | Schedule | Assignments | Resources ] gla@postech Sungwoo Park

Parallel/concurrent/distributed programming languages


Students can have access to a quad-core machine running Linux where MPI and OpenMP are both already installed. Email the instructor if you need an account.

MPI vs. OpenMP

  • Distributed memory model
  • Shared memory model
  • Message passing style
  • Directive based
  • Require more programming changes to go from serial to parallel version
  • Not much different from serial program
  • More flexible and expressive than OpenMP
  • Easier to program and debug than MPI
  • Performance is limited the communication network
  • Distributed memory computers are less expensive than large shared memory computers
  • Can still run the program as a serial code
  • Require a compiler for OpenMP
  • Mostly used for loop parallelization

The above table summarizes this web page and briefly compares MPI and OpenMP.

MPICH2 - Install on Linux

  • MPICH2 supports Windows platform! If you want to install MPICH2 on Windows, refer to the MPICH2 web page.
  • If your Linux distribution is Debian, FreeBSD, Slackware, or Fedora, MPICH2 provides binary files, however, they are not the lasted versions. We recommend installing MPICH2 using the source file.
  • Prerequisites: gcc, g++, Python 2.2 or later
  • Quick Install (If you want know more details, refer to README.txt in the tar file, mpich2-1.0.5.tar.gz)
  • Compile & Run (Don't forget user setting for MPI running; refer to the above quick install.)
    • mpicc (or mpicxx) -o example.out example.c
    • mpiexec -l -n <# of processes> example.out
      - You probably didn't have to give the full pathname of example.out.
      If not, use the full pathname: ex) mpiexec -l -n <# of processes> ~/example.out

OpenMP - Install on Linux

  • OpenMP supports a variety of Platforms using their compilers. We use gcc-4.2 which surprisingly incorporates OpenMP library (libgomp).
  • To install gcc-4.2, please refer to gcc install guide. If your distribution supports binary packages, feel free to install it and do not forget installing the libgomp package. In the case of Debian, the following commands end the job.
    • su (Input root's password)
    • apt-get install gcc-4.2
    • apt-get install libgomp1
  • Compile & Run
    • gcc-4.2 -o example.out example.c -fopenmp
    • ./example.out

Password-less SSH login

In order to use distributed computation in MPI programming, it is convenient to use password-less ssh login on the distributed nodes. In a master node, we make a authorized_key and distributes the key to slave nodes using the following:
  1. ssh-keygen -t rsa(Press enter 3 times)
  2. cd ~/.ssh
  3. cp id_rsa.pub authorized_keys
  4. scp ~/.ssh/authorized_keys user@host:~/.ssh/


[ Home | Schedule | Assignments | Resources ] gla@postech Sungwoo Park