MPI code compilation

  • Become user mary and un-tar the source codes from the examples above, ex.tar into a separate directory
    su - mary 
    mkdir MPI 
    cp ex.tar MPI; cd MPI
    tar -xvf ex.tar 
  • MPI code can be compiled with command mpicc
    mpicc -o ex3.x ex3.c

  • Create file called machines with list of hosts to run MPI on
    desktop01 slots=2
    node01    slots=2
  • Start MPI run
    mpiexec -n 4 -hostfile machines $HOME/MPI/ex3.x