Compiling and executing simple MPI demo C program, cpi, using the
PGI
compilers
- C source code: cpi.c
- 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-pgi .
#
Change to your local copy of the examples directory
vnfe1% cd
cpi-mpi-pgi
#
Build the application
vnfe1% make
/usr/local/PGI/bin/mpicc -fast -B -fast
-L/usr/local/PGI/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
with 4 or 40 processors'
#
Run on 4 processors using vnrun
vnfe1% make
run4
vnrun -n 4 cpi
Will execute 'ssh vn10 cd /d/vnfe1/home/matt/work/cpi-mpi-pgi; time
mpirun -np 4 -machinefile mfile -n 4 cpi'
Will use the following machine file
vn11
vn12
vn13
Process 0 on vn10.physics.ubc.ca: n=108
Using 16384 intervals
Process 2 on vn12.physics.ubc.ca: n=108
Process 3 on vn13.physics.ubc.ca: n=108
Process 1 on vn11.physics.ubc.ca: n=108
pi is approximately 3.1415926539002337, Error is 0.0000000003104406
wall clock time = 0.002082
0.209u 0.335s 0:01.87 28.3% 0+0k 0+0io 2pf+0w
#
Run on 40 processors using vnrun
vnfe1% make
run40
vnrun -n 40 cpi
Will execute 'ssh vn10 cd /d/vnfe1/home/matt/work/cpi-mpi-pgi; time
mpirun -np 40 -machinefile mfile -n 40 cpi'
Will use the following machine file
vn11
vn12
vn13
vn14
.
.
.
vn46
vn47
vn48
vn49
vn4
vn50
vn51
Process 0 on vn10.physics.ubc.ca: n=108
Using 16384 intervals
Process 1 on vn11.physics.ubc.ca: n=108
Process 2 on vn12.physics.ubc.ca: n=108
Process 3 on vn13.physics.ubc.ca: n=108
.
.
.
Process 22 on vn33.physics.ubc.ca: n=108
Process 35 on vn48.physics.ubc.ca: n=108
Process 33 on vn46.physics.ubc.ca: n=108
Process 30 on vn42.physics.ubc.ca: n=108
Process 32 on vn45.physics.ubc.ca: n=108
Process 36 on vn49.physics.ubc.ca: n=108
Process 37 on vn4.physics.ubc.ca: n=108
pi is approximately 3.1415926539002337, Error is 0.0000000003104406
wall clock time = 0.006400
1.080u 2.232s 0:17.89 18.5% 0+0k 0+0io 0pf+0w