This chapter describes how to use pghpf to control the translation process for a program written in High Performance Fortran (HPF). The pghpf command is called the compilation driver. The compilation driver controls several phases of compilation: HPF compiling, Fortran 77 preprocessing and compiling, assembling and linking (linking includes the correct pghpf runtime routines for the target communications protocol). Since pghpf runs on a variety of host systems and generates output for several target systems, the commands that allow you to run (execute) a program will vary from system to system.
Figure 1-1 Stages of the pghpf driver
For more information on the Fortran 77 compiler, the assembler and linker, refer to the documentation listed in the Preface or to the appropriate manuals supplied with your system.
The following examples show several driver options that should be available on most systems. The command-lines and output may differ on your system. You can compile the HPF program hello.hpf using the default pghpf driver options.
By default, the executable output is placed in the file a.out. You can use the -o option to specify the output file.
$ pghpf hello.hpf
To see the command lines that pghpf will run, without actually executing them, use the driver's -dryrun option. For example:
$ pghpf -o hello hello.hpf
$ pghpf -dryrun -o hello hello.hpf
/usr/pgi/arch/bin/pghpfc hello.hpf -output hello.f
-stdinc /usr/pgi/arch/include:/usr/include -def sun
-def arch -def unix -inform warn -terse 1 /usr/pgi/arch/bin/pgftn hello.f -x 124 0x400 -inform warn -terse 2 -astype 1 -opt 1 -fn hello.hpf
-asm /usr/tmp/pghpfAAAa14451 /usr/bin/as -Q -o hello.o /usr/tmp/pghpfAAAa14451 Unlinking /usr/tmp/pghpfAAAa14451 /usr/bin/ld -dc -dp -e start -X -L/usr/pgi/arch/lib -L/usr/lib -o hello /usr/lib/crt0.o /usr/pgi/arch/lib/hpfmain_rpm.o hello.o -lhpfrtl -lhpf_rpm -lm -lpgc -lc Unlinking hello.o
pghpf [options] filename [...]Where:
Several options provide for optimization of the HPF program. These compiler command line options, -O1, and -O2, provide varying levels of optimization to the HPF code, and also set optimization flags for the Fortran 77 node compiler. For details on the optimization transformations applied, refer to the Release Notes supplied with the pghpf Software.
Any input files not needed for a particular phase of processing are not processed. For example, if on the command line you use an assembly-language file (filename.s) and the -S option to stop before the assembly phase, the compiler takes no action on the assembly- language file. Processing stops after compilation and the assembler does not run (in this case compilation must have been completed in a previous pass which created the .s file). Refer to the following section, "Output Files," for a description of the -S option.
In addition to specifying primary input files, files with extensions indicating an HPF source file on the command line, you can insert text from include files using the INCLUDE statement or the preprocessor #include directive from within HPF source files (includes and preprocessing is only available if you use a .F extension or the -Mpreprocess command line argument).
When linking a program object file with a library, the linker extracts only those objects from the library that the program needs. The pghpf driver includes several libraries by default. For more information about libraries, refer to Chapter 4, PGHPF Libraries.
If you use one of the options: -Mftn, -F, -S or -c, the compiler produces a file containing the output of the last phase that completes for each input file, as specified by the option supplied. The output file will be a Fortran 77 file with pghpf runtime library calls, an HPF preprocessed source file, an assembly-language file or an unlinked object file respectively. Similarly, the -E option does not produce a file, but displays the preprocessed HPF source file on the standard output. Using any of these options, the -o option is valid only if you specify a single input file. If no errors occur during processing, you can use the files created by these options as input to a future invocation of pghpf. Table 1-1 lists the stop after options and the output files that pghpf creates when you use these options.
If you specify multiple input files or do not specify an object filename, the compiler uses the input filenames to derive corresponding default output filenames of the following form, where filename is the input filename without its extension:
Table 1-1 Stop after Options and Outputs
Option    Stop after              Output from pghpf             
                                                                
-F        preprocessing           preprocessed file - .f        
                                                                
-Mftn     HPF compilation         Fortran 77 file               
                                                                
-S        compilation             assembly-language file - s.   
                                                                
-c        assembly                unlinked object file - .o     
                                                                
none      linking                 executable files a.out        
                                                                
When running pghpf you can save the intermediate Fortran 77 file generated from the first stage of pghpf using the -Mkeepftn option. This option continues the compilation after HPF compiling, but does not remove the intermediate Fortran 77 file.
Note
Unless you specify otherwise, the destination directory for any output file
is the current working directory.  If the file exists in the destination
directory, the compiler overwrites it.