1.1.12       What extra steps are needed to compile a model or processor using a FORTRAN compiler other than the Lahey F77 compiler used for the distribution executables?

The CALPUFF system and associated processors are FORTRAN 77 codes largely developed on the PC, and tested/debugged using the Lahey F77 FORTRAN compiler. Components of the system have been compiled for (and run on) a range of UNIX platforms as well, including Sun, HP, and Dec Alpha workstations.

FORTRAN compilers differ in the level of code evaluation (syntax rules, etc.) performed while compiling, and in how such evaluation checks are configured. One compiler may by default return a fatal error when compiling a code that passed another compiler without incident, or with a non-fatal warning message. Utilities provided by the platform also frequently differ, which can affect the calls that are used for processing system dates and times, for example.

Compiling a code using a 'new' compiler typically requires modifying non-conforming usages in the code (these are detected by the compiler), reconfiguring the compiler directives where appropriate to remove restrictions that do not affect the operation of the code, and substituting calls to system subroutines that make the executable platform-specific.

Compiler-Specific Statements

The CALPUFF system code has isolated compiler and platform-specific statements in just a few subroutines. These subroutines are placed at the end of the file, and contain statements for several popular compilers. Two processors also contain compiler-specific settings in the PARAMS include-file. The code, as distributed in the BETA-Test, is configured for the Lahey F77 FORTRAN compiler so that the alternate statements for other compilers are inactive (they appear as comments). If the COMPAQ DF90 compiler is used, the blocks identified for Lahey F77 should be commented, and the corresponding blocks for COMPAQ DF90 should be activated (de-commented).

Subroutines (or parameter files) that contain compiler-specific settings are:

CALMET -- datetm, undrflw, comline
CALPUFF -- datetm, undrflw, comline
CALPOST -- comline
POSTUTIL -- comline
CTGPROC -- params.ctg
TERREL -- params.trl



No changes are needed in other codes.

Compiler Configuration Examples

Optimization should generally be avoided, unless you can readily demonstrate that such optimizations have no effect on the results produced.

Lahey F77

Compile and link with the code in one file (e.g., CALMET.FOR) using the following options:

OPTION  DESCRIPTION                      OPTION  DESCRIPTION
/n0 - Standard FORTRAN 77 IMPLICIT       / L - Line-number traceback table
/n2 - Generate 387 constants and code    / P - Protect constant arguments
/n4 - No 80486 optimizations             / Q1 - Limit NDP stack entries
/n7 - Optimize inter-statement           /nQ2 - No protected-mode RPC
/ A2 - Allocatable array checking        /nQ3 - No real-mode RPC
/ B - Check array subscript Bounds       / R - Remember local variables
/nC - Ignore nonstandard usage           /nS - No SOLD file created
/nC1 - INTEGER constants 4 bytes         /nT - INTEGER*4, LOGICAL*4 default
/ D - DIRECT files without headers       /nV - Not VAX interpretation
/nH - No Hardcopy source listing         / W - Display Warning messages
/ I - Check subprogram Interfaces        /nX - No Xref listing
/nK - Generate 80x87 code                /nZ1 - Better SOLD debugging 


Lahey/Fujitsu LF95

Compile and link with the code in one file (e.g., CALMET.FOR) using the following options:

Options:

-nap            -c              -nchk           -nchkglobal     -dal 
-ndbl           -ndll           -nf95           -fix            -ng 
-nin            -ninfo          -li             -nlst           -nlong 
-maxfatals 50   -o0             -npause         -nprivate       -npca 
-nquad          -nsav           -nstaticlink    -stchk          -tp 
-trace          -ntrap          -w              -winconsole     -nwo 
-nxref          -zero 

If you do not have enough memory (causing the compiler to abort), try breaking the .FOR file into pieces, compiling each in turn to create a number of .OBJ files. Then link these .OBJ files to make the executable.

Compaq Digital FORTRAN

You will need to process the codes for CALMET, CALPUFF, CALPOST, and POSTUTIL in two files, since the subroutine comline requires different compiler directives. Cut the comline subroutine out of the FORTRAN file and save it as COMLINE.FOR. Using CALPUFF as an example, compile everything except comline with the command (enter on one command line):

df calpuff.for /compile_only /nologo /fpe:0 /fpscomp:general
                    /fpscomp:ioformat /fpscomp:logicals
                    /iface:nomixed_str_len_arg /iface:cref /optimize:0
                    /warn:nofileopt /traceback

Then compile comline (e.g. COMLINE.FOR) with the command (enter on one command line):

df comline.for /compile_only /nologo /fpe:0 /fpscomp:general
                      /fpscomp:ioformat /fpscomp:logicals /iface:cref
                      /optimize:0 /warn:nofileopt /traceback

Link the two .OBJ files with the command:

df calpuff.obj comline.obj

