Tonto | ||
---|---|---|
<< Previous | Next >> |
To get TONTO to work on any platform, or to understand how to change it to produce certain version for debugging or profiling, you need to decide what compile options to use on the Fortran compiler that you have. In general these changes are compiler specific, but there are usually compler options which correspond to each other across platforms.
In all cases, you should alter the Makefile variables FC, FOPTNS, FFLAGS, FPROF, FDEBUG, FFAST, FSUFFIX, PROGSUFFIX, MODSUFFIX, OBJSUFFIX, LIBS, and DEFS. For example, here are the values for the COMPAQ f95 compiler on the OSF1 operating system. These options can be found in the COMPAQ-f95-on-OSF1 file in the site_config directory.
FC = f95 FOPTNS = $(FFAST) FFLAGS := -cpp -module ./new_modules \ -I. -I./f90files -I./interfaces -I./modules -I./objects FPROF := -p -g3 -gen_feedback FDEBUG := -g -ladebug -check bounds -check format -check overflow \ -warn argument_checking -warn declarations -warn unused \ -warn truncated_source -error_limit 10 -std FFAST := -g0 -O4 -arch host -align dcommons -assume noaccuracy_sensitive \ -pipeline -unroll 8 -threads -speculate by_routine -transform_loops FSUFFIX := f90 LIBS := -lcxml DEFS := -DCOMPAQ -DUSE_ERROR_MANAGEMENT |
The meaning of each of these variables is now discussed.
The variable FC is set to the command for the Fortran95 compiler on your machine,
FC = f95 |
man -k fortran |
The FOPTNS variable is not set to have any specific compiler optionsr; instead, it is is set to be equal to one of three other variables, as shown by the three possibile the lines below:
FOPTNS = $(FFAST) FOPTNS = $(FDEBUG) FOPTNS = $(FFAST) $(FPROF) |
The complie options to set for the variables FFAST, FDEBUG and FPROF are described below.
The FFLAGS variable must be set to the basic option flags that are needed to compile TONTO which are common to all compilations.For example,
FFLAGS := -cpp -module ./new_modules \ -I. -I./f90files -I./interfaces -I./modules -I./objects |
To get TONTO to compile and work, Fortran compiler options must be found for the tasks described below, and they must replace or substitute for all the options to the right of the FFLAGS variable assignment in the example above.
All the module files from the compilation (they will usually be files which end in a .mod suffix) must be deposited in the module subdirectory, ./module. In the above example, this is achieved by the compiler flags:
-module ./module |
The compiler must know where Fortran95 files, module information files, and object files reside during intermediate stages of compilation. In the example above, this is given by (respectively) the options
-I./f90files -I./modules -I./objects |
The Fortran code must be preprocessed using the C preprocessor before being compiled by the Fortran compiler. In the example above this was achieved by the compiler option
-cpp |
-I. -I./interfaces |
The FFAST variable must be set to the options flags that are needed to compile TONTO with as high a degree of optimisation as is reasonably possible. For example,
FFAST := -g0 -O4 -arch host -align dcommons -assume noaccuracy_sensitive \ -pipeline -unroll 8 -threads -speculate by_routine -transform_loops |
Other options which may not appear on other compilers are:
The -arch host option, which produces code optimal for the particular COMPAQ chip the compiler is working on.
The -align dcommons option, which places variables on appropriate bit boundaries to allow faster memory access
The -assume noaccuracy_sensitive which allows mathematically equivalent transformations of the code to speed execuation.
The -pipeline option which allows a form of software pipelining to speed execution
The -unroll 8 option which separates loops into blocks of 8, to allow effeicient use of cache memory
The -threads which allows some form of parallelisation
The -speculate by_routine which allows the compiler to inline certain routines which it feels may enhance optimisation
The -transform_loops options which rearranges loop orders if it will lead to better memory access and hence better performance.
The FDEBUG variable must be set to the options flags that are needed to compile TONTO so that it works with a debugger and so that appropriate warnings are issued for unusual or non-conformant code. This is recommended for developers.
FDEBUG := -g -ladebug -check bounds -check format -check overflow \ -warn argument_checking -warn declarations -warn unused \ -warn truncated_source -error_limit 10 -std |
The options which may be compiler specific are:
The -ladebug option, which indicates that specific debugging information needed for the COMPAQ ladebug debugger is to be generated.
The -check bounds argument, which checks if array bounds have been exceeded. This may severely affect performance, but it is recommended fir developers
The -check format option which checks for formatting errors
The -check overflow option, which prints information on the type of incorrect operation that was attampted (e.g. divide-by-zero, or exponentiation of too large or too small an exponent)
The -warn argument_checking which informs if incorrect types are passed to certain subroutines. This should only be necessary for non TONTO code since argument checking is gauranteed by the Fortran 90 standard.
The -warn declarations and -warn unused which warns if there are incorrect declarations or any usused variables
The -warn truncated_source which warns if there are any lines which have been truncated with remaining characters. This is very useful for TONTO because sometimes the preprocessor can generate lines which are excessively long.
The -error_limit 10 option which limits the number of errors to a manageable number, 10.
The -std options which forces the compiler to accept only standard Fortran95 syntax
The FPROF variable is set to the compiler options needed to perform profiling tests on TONTO programs. That is, tests which examine the speed of execution of various routines in TONTO. Profiling tests are often done in conjunction with the highest levels of optimisation (it doesn't make sense to check the speed of an unoptimised program).
For the COMPAQ compiler, the following options are required
FPROF := -p -g3 -gen_feedback |
This is set to the suffix used to indicate a Fortran90 or Fortran95 program to your compiler. Typically, it will be
FSUFFIX := f90 |
It is important to note that on some systems, the type of suffix determines whether the C-preprocessor is executed.
This is set to the suffix used to indicate an executable program to your compiler. The default is
PROGSUFFIX := exe |
This is set to the suffix used for module information files by your compiler. It is by the makefile while building the program. The default is
MODSUFFIX := mod |
This is set to the suffix used for object files used by your compiler. The default is
OBJSUFFIX := o |
The LIBS variable is set so that the compiler can use the BLAS and LAPACK libraries. On the COMPAQ system these are bundled together in the libcxml library, which is included by the line
LIBS := -lcxml |
LIBS := -llapack -lblas |
LIBS := -L /usr/lib/gcc-lib/i386-redhat-linux/2.96 -lg2c -llapack -lblas |
This is to tell the Makefile whether the module names get converted to uppercase or lowercase when outputting module information files. The default is
MODCASE := -lc |
The DEFS variable is set to enable any machine specific commands in the fortran code, via the C-preprocessor. On the COMPAQ machine, we have
DEFS := -DCOMPAQ -DUSE_ERROR_MANAGEMENT |