How to compile a Modula-P Program

Use the following command to create the appropriate link to the compiler

alias pcomp ~crg/prism/bin/pcomp

Then use the compiler to generate an executable version of the simulation program for the type of machine that you require. In the case of this assignment the compiler flags should be

pcomp -Vt3 -i3 [file].src

NOTE: The .src extension is compulsory.

The compilation process is a two stage one. You will see the Modula-P compiler invoke the gcc compiler to compile the intermediate C code that pcomp generates

Executing your program

To execute an experiment on a machine with N processing elements and M memory modules you should invoke your executable in the following way.

[file].psm -pN -mM

You will then need to supply runtime input to the program in order to select an appropriate algorithm procedure and also to select the desired number of parallel procedures to be created.

Collecting Performance Data

To collect statistics about the time it takes for your program to run on the parallel architecture you need to include an import statement to include the statistics collection library at the start of your code.

IMPORT StatsLib:SL;

Around the sequential and parallel procedure calls in the main program section of your module you need to place statistics library commands that tell the statistics library to start and stop collecting stats about the execution of your program. You should be using the commands SL.Start(0); and SL.Finish();.

After the program has completed, if you have used the statistics library routines shown above in your program, you will get an output statistics file named [file].psm.stats.

The important data in this file is at the top, and I include a sample file for the RedSquare.src program below. The important entry is the first entry in the ALL line, this is the average CPU time taken by all the processors to complete the exection of your program.