Compiling and executing simple MPI demo program, cpi, using the Intel compilers

  1. C source code: cpi.c
  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/cpi-mpi-intel .

# Change to your local copy of the examples directory
vnfe1% cd cpi-mpi-intel

# Build the application
vnfe1% make

/usr/local/intel/bin/mpicc -I/usr/local/intel/include -O3 -axK -tpp6 -c cpi.c
cpi.c(12) : (col. 1) remark: main has been targeted for automatic cpu dispatch.
/usr/local/intel/bin/mpicc -O3 -axK -tpp6 -O3 -axK -tpp6 -L/usr/local/intel/lib cpi.o -o cpi

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

Will execute 'ssh vn11 cd /d/vnfe1/home/matt/work/cpi-mpi-intel; time mpirun -np 4 -machinefile mfile -n 4 cpi'
Will use the following machine file
vn12
vn13ex
vn15
Process 0 on vn11.physics.ubc.ca
Using 16384 intervals
Process 1 on vn12.physics.ubc.ca
Process 2 on vn13.physics.ubc.ca
Process 3 on vn15.physics.ubc.ca
pi is approximately 3.1415926539002337, Error is 0.0000000003104406
wall clock time = 0.022182
0.338u 0.356s 0:01.92 35.4%     0+0k 0+0io 10pf+0w


# Run on 40 processors using vnrun
vnfe1% make run40


Will execute 'ssh vn11 cd /d/vnfe1/home/matt/work/cpi-mpi-intel; time mpirun -np 40 -machinefile mfile -n 40 cpi'
Will use the following machine file
vn12
vn13
vn15
vn17
vn18
 .
 .
 .
vn50
vn51
vn53
vn54
Process 0 on vn11.physics.ubc.ca
Using 16384 intervals
Process 1 on vn12.physics.ubc.ca
Process 2 on vn13.physics.ubc.ca
Process 3 on vn15.physics.ubc.ca
              .
              .
              .
Process 37 on vn51.physics.ubc.ca
Process 36 on vn50.physics.ubc.ca
Process 38 on vn53.physics.ubc.ca
pi is approximately 3.1415926539002337, Error is 0.0000000003104406
wall clock time = 0.191301
2.803u 3.023s 0:20.85 27.9%     0+0k 0+0io 0pf+0w