This section is for the impatient user who already has some basic familiarity with Haskell98 and GHC. We will list the steps to compile, run and analyse a parallel program. More detailed coverage of the individual steps is given in the section called Using GPH in Practice.
We assume that you want to compile the program stir.hswhich is included in the parfib directory of the GPH test programs (available from our FTP Server). We further assume that a recent version of the compiler is installed as gum-4.06 and that it is in your path, as well as the visualisation tools.
In the simplest case do something like
gum-4.06 -parallel -fvia-C -fglasgow-exts -o stir_mp stir.hs |
If you use strategies in your program (import Strategies) use -syslib concurrent. Don't worry about the `initialization discards `const'' warnings. A set of example programs including makefiles is shipped separately as gum-4.06-test-prgs.tgz.
Note that the top level file generated by the whole compilation is just a Perl wrapper (no, we didn't magically reduce the size of the binary by several orders of magnitude). The actual executable lives in the PVM bin dir. So, you can actually copy the binary to the local disks of the machines you'll run your program on, in order to reduce startup overhead.
First configure PVM. See the Dummies Guide to PVM in the GHC User's Guide. In short, you'll have to do something like
pvm add machine2 add machine3 add machine4 conf quit |
Or, if you keep the list of machines names in a file in the PVM_HOST_FILE environment variable just do
echo "conf" | pvm $PVM_HOST_FILE |
Now you can run the program with
./stir_mp +RTS -qP -qp4 -sstderr |
This runs your parallel program on 4 PEs (-qp4) generating a profile (-qP), which can be processed by the visualisation tools, and printing general statistics information about GC and threads generated to stderr (-sstderr).
After execution you will find 4 files with names like =...=stir_mp.???.gr in your dir. Here ... stands for the path to the executable and ??? is the PE number that generated the profile. To merge all of them do
grs2gr =*=stir_mp.???.gr > stir_mp.gr |
Now you can generate an activity profile via
gr2ps -O stir_mp.gr |
Use ghostview or another PostScript Level 2 viewer to look at it
ghostview -seascape stir_mp.ps |
The profiles are discussed in more detail in the GranSim User's Guide.
Here is an example of an activity profile of running the program above on a 16 PE Beowulf cluster: