next up previous contents index
Next: 6 Execution of Parallel Up: ADAPTOR Users Guide Previous: 4 The Source-to-Source Translation   Contents   Index

Subsections


5 The Compiler Driver \fbox{adaptor}

ADAPTOR provides its own compiler driver called adaptor.

adaptor is composed of a compile step and a link step, the compile step consisting of cpp-step, fadapt-step and fortran-compilation-step. Each of the steps is invoked depending on the kind of input files, which is recognized by the suffix of the filenames as described below.

In compile step adaptor proceeds the input files one after the other, that means first the first input file is processed through all the processors needed, depending upon the suffix of the input file, f.e.:

first inputfile1.HPF is passed through cpp generating inputfile1.hpf;
then inputfile1.hpf is passed through fadapt generating inputfile1.f;
then inputfile1.f is passed through fc generating inputfile1.o

Hereafter the next input file is processed and so on until all the input files have been processed; input files for ld are just queued into a list of input files for the linker.

If no error occurred at any time in compile step and if adaptor is not called with command-line option -c the link step is invoked.

Only the link step is invoked if there are just input files with linker-suffixes.

gmdhpf exits (-1) if any error occurred and (0) else.

The names of the processors and their command line options are predefined. These predefinitions can be overridden by redefinitions in configuration files as described in section 3 below. The options given via adaptor command-line option -W... are added to the command-line options of the related processor valid after interpretation of the configuration files.

5.1 Dry Run

The option dryrun will show but not execute all the commands of the compile driver. It will also verify that the related libraries (HPF runtime system, message passing library, user libraries) are all available.

    adaptor -dryrun prime.hpf

submitting: rm -f prime_adp.f
submitting: /home/brandes/adaptor/bin/fadapt  -N prime.hpf
submitting: ifc -c -w -O -extend_source prime_adp.f -o prime.o
submitting: rm -f prime_adp.f
submitting: ifc -o a.out prime.o /home/brandes/adaptor/dalib/libadp_N.a \
            -L/home/brandes/mpich/lib -lmpich -lpmpich -lPEPCF90

5.2 Verbose and Help Information

Using the option -help gives a summary of all available options for the compiler driver.

    adaptor -help

The option -v for verbose shows all the commands executed by the compile driver.

    adaptor -v prime.hpf

/home/brandes/adaptor/bin/fadapt  -N prime.hpf
ifc -c -w -O -extend_source prime_adp.f -o prime.o
   program PRIME

85 Lines Compiled
rm -f prime_adp.f
ifc -o a.out prime.o /home/brandes/adaptor/dalib/libadp_N.a \
    -L/opt/mpich/lib -lmpich -lpmpich -lPEPCF90

5.3 The Settings of the Compiler Driver

The following command gives information about the compilers and linkers that will be used by the compile driver adaptor.

    adaptor -settings

The output of this command looks like this:

Default settings read in from following configuration files:
/home/brandes/adaptor/.adaptorrc

ADAPTOR Home Directory : /home/brandes/adaptor

ADAPTOR runtime system : -L/home/brandes/adaptor/dalib/

general settings for Fortran Preprocessor
     CPP           : /usr/bin/cpp
     CPP_FLAGS     : -P

general settings for fadapt
     FADAPT        : /home/brandes/adaptor/bin/fadapt
     FADAPT_FLAGS  :

general settings for target Fortran compiler
     FC            : ifc
     FC_EXTEND     : -extend_source (extended source format, 132 rel chars)
     FC_FREE       : -FR (free source format)
     FC_OPT        : -O (compiler optimization)
     FC_MP         : -auto (local vars on stack)
     FC_FLAGS      : -w

general settings for linker:
     LD            : ifc
     LD_FLAGS      : -lPEPCF90

current settings for driver: verbose = 0, dryrun = 0, keep = 0
     CPP_FLAGS        : -P
     FADAPT_FLAGS     : -N
     FC_FLAGS         : -w -O
     LD_FLAGS         : -lPEPCF90

On some machines it might be necessary to have different linkers for the parallel SPMD and the serial program. Therefore two different linkers LD and LD1 can be specified as well as specific options for these linkers.

Section 5.8 explains how these settings can be changed by configuration files.


5.4 Inputfiles for adaptor

5.4.0.1 cpp

Files suffixed by

.F, .FOR, .F90, .F9, .FCM, .HPF, .H90

will always be preprocessed by the cpp preprocessor. The file generated by the preprocessor will have the same name but with lowercase suffix and is considered for further HPF and Fortran compilation.

Attention: Please prevent cpp from producing "line control information used in the next step of the C-Compiler"; it would disturb fadapt. E.g. for Solaris use cpp-option -P (is predefined).

5.4.0.2 fadapt

Files suffixed by

.hpf., .h90 [.FCM, .HPF, .H90]
.f, .for, .f9, .f90 [.F, .FOR, .F9, .F90]

will be passed to the HPF source-to-source translation fadapt unless the flag -nohpf is used to suppress this HPF compilation. For files with the uppercase suffix the output of the preprocessor is passed to fadapt.

The output file of the source-to-source translation will have the same name as the input file but with the suffix _adp.f and is then passed to the Fortran compilation. If the HPF compilation phase is skipped, the input file will be copied to a file with the corresponding name.

5.4.0.3 Fortran compilation

Files suffixed by

.hpf., .h90 [.FCM, .HPF, .H90]
.f, .for, .f9, .f90 [.F, .FOR, .F9, .F90]
.e, .r, .s, .S, .il or .tcov

are considered to be input files for the native Fortran compiler. Depending on the suffix the input files are treated by the preprocessor or the HPF source-to-source translation fadapt before.

For each of the files the native fortran compiler chosen by the user (see section 3) is invoked, generating an input file for ld or ld1 if no error occurred, its name being the same as the input file for fc but with suffix .o.

5.4.0.4 Linking

Files suffixed by

.o or .a
are considered to be input files for a native linker.

If the compile step has been completed without errors and if the link step is not cancelled by the user (option -c at adaptor call), all the generated object files and explicitly mentioned ld input files are linked together. Usually, the link step of the native Fortran compiler is invoked, but the user can also select other linkers (see section 3). The linker generates an executable named ./a.out - if the user does not choose another name calling adaptor with option -o <outfile name>.

By default, adaptor will invoke the linker LD in order to generate an SPMD program. Just call adaptor with the option -1 if you intend to generate a serial executable, and it will be done invoking linker LD1.


5.5 Intermediate Files

Intermediate files are generated by adaptor in the same directory as the input file. Unless the user specifies -keep when invoking adaptor, they are removed as soon as they are no longer needed. E.g., let file1.HPF be an input file and no error occured at compilation time:

5.6 General Options

With the option -nohpf the fadapt step is disabled. The input file will be copied directly to the output file that would be generated by the fadapt step.

With the option -c the link step is disabled. The input files will only be compiled but not linked.

    adaptor -c prime.hpf

With the option -o <outfile> it is possible to chose the name for the final executable.

    adaptor -o prime prime.o

5.7 Passing Options to Compiler and Linker

Certain options of the compiler driver adaptor are passed to corresponding compilation phases:

The adaptor flag -W enables the user to pass options to the different phases of the compilation:

-Wcpp"options" will pass options to the preprocessor:

    adaptor -Wcpp"<cpp_options>" prime.HPF

-Wa"options" wil pass options to fadapt:

    adaptor -Wa"<fadapt_options>" prime.hpf

-Wf"options" will to pass options to the Fortran compiler. This might be very useful to take full advantage of the best optimizations that the compiler provides.

    adaptor -Wf"<fc_options>" prime.hpf

-Wl"options" will to pass options to the linker:

    adaptor -Wl"<ld_options>" prime.hpf
    adaptor -dryrun -Wl"-L/home/blas/lib -lblas3" <file>.hpf


5.8 Configuration File for adaptor

The configuration files for adaptor may be used to reset the predefined names of and options for the invoked preprocessor, fadapt, fortran-compiler and linker as well as the names of the DALIB and the message passing libraries used for linking.

Figure 3 shows all the possible definitions within configuration file. Right-hand of the '=' the default values are shown, which may be overridden by redefinition in the installation configuration file $PHOME/.adaptorrc or in your own configuration files $HOME and ./.adaptorrc.

Figure 3: Example of adaptor configureation file .adaptorrc.
\begin{figure}{\footnotesize\begin{verbatim}Libraries used for MPI parallelis...
...=-w
...


next up previous contents index
Next: 6 Execution of Parallel Up: ADAPTOR Users Guide Previous: 4 The Source-to-Source Translation   Contents   Index
Thomas Brandes 2004-03-19