There are only a few modifications to be made to run our program on parallel processors. The driver is in the file tportpar.C. The reader should examine tportpar.C and compare it to tportseq.C. In the driver we initalize the MPI environment. The MPI (Message Passing Interface) sets up a virtual machine that can access one or more processors according to how it is configured.
#ifndef DAGH_NO_MPI
MPI_Init (&argc, &argv);
#endif
At the end of the driver we close the MPI environment. The virtual machine set up by MPI is turned off.
#ifndef DAGH_NO_MPI
DAGHMPI_Finalize();
#endif
The Makefile remains almost the same (a few name changes from tportseq
to tportpar), and so does the process to create the
executable code.
%make clean
%make tportpar
To run the code on parallel processors the following command works on our
machines:
%mpirun -np4 tportpar
The np4 indicates that the number of processors to be used is 4. On your system, you may need a different command to run MPI. Your system administrator can help you in this regard.