Compiling and executing simple MPI demo Fortran 77 program, fpi, using the PGI compilers

  1. Fortran 77 source code: fpi.f
  2. Makefile

Sample session trace

# Change to some directory visible from ALL nodes
vnfe1% cd ~/matt/work

# Copy the example directory
vnfe1% cp -r ~matt/examples/fpi-mpi-pgi .

# Change to your local copy of the examples directory
vnfe1% cd fpi-mpi-pgi

# Build the application
vnfe1% make

/usr/local/PGI/bin/mpif77 -I/usr/local/PGI/include -fast  -c fpi.f
Adding a symbolic link for mpif.h
/usr/local/PGI/bin/mpif77 -fast  -L/usr/local/PGI/lib fpi.o -o fpi
Adding a symbolic link for mpif.h
echo "Type 'run4' or 'run40' to run with 4 or 40 processors'"
Type 'run4' or 'run40' to run with 4 or 40 processors

# Run on 4 processors using vnrun

vnfe1% make run4

vnrun -n 4 fpi
Will execute 'ssh vn10 cd /d/vnfe1/home/matt/work/fpi-mpi-pgi; time mpirun -np 4 -machinefile mfile -n 4 fpi'
Will use the following machine file
vn11
vn12
vn13
 Process            1 of            4 is alive
FORTRAN STOP
 Process            3 of            4 is alive
 Process            2 of            4 is alive
FORTRAN STOP
FORTRAN STOP
 Process            0 of            4 is alive
  pi is approximately: 3.1415926539002380  Error is: 0.0000000003104450
FORTRAN STOP
0.195u 0.340s 0:01.53 34.6%     0+0k 0+0io 1pf+0w