GNU g77, Intel Fortran, Open Watcom Compiler Installation

 

Home | Installation | Control Streams | Bootstrap | Randomization Test | Visual Predictive Check | Autocovariate | Files | References

 

Last Updated: 3 April 2012

Changes to NONMEM (g77, Intel Fortran, OpenWatcom)

The following changes should be made to the distributed NONMEM source code in addition to those recommended by the NONMEM Project Group:

BLKDAT.for

g77 and Intel Fortran (ivf) compilers

 line 26: Change 'con' to 'CONOUT$'.

The g77 and ivf compilers do not recognize 'con' as the DOS console output device. They require the special name 'CONOUT$'.

OpenWatcom (wc) compiler

 line 26: Change 'con' to 'nul'.

The OpenWatcom compiler cannot write to the screen to show intermediate NONMEM output.

FLU.for

g77 compiler:

 line 11:  Change "COMMITQQ(I)" to "FLUSH(I)"

This change reflects a difference in dialect for the function which flushes a file output buffer.

ivf compiler:

Change line 11 from:

      CALL COMMITQQ(I)
to:

      USE IFLPORT
      LOGICAL J
      J = COMMITQQ(I)
 

You will need to use the /4Yportlib option with the ivl compile/linker when you use IFLPORT.

 

wc compiler:

 

Change line 11 from:

      CALL COMMITQQ(I)
to

      INCLUDE 'FSUBLIB.FI'
      INTEGER ISTAT
      ISTAT=FLUSHUNIT(I)
 

Compilation Options

Suggested g77 compilation options are:

-fno-backslash
     Specify that `\' is not to be specially interpreted in character and Hollerith constants a la C and many
     UNIX Fortran compilers
This option is always recommended when using g77 on DOS based systems because it allows the standard DOS path delimiter "\" to be used when specifying file locations.

-O    Minimal optimization
or
-O1   More aggressive optimization

-malign-double
     (Intel x86 architecture only.) Noticeably improves performance of g77 programs making heavy use of
     REAL(KIND=2) (DOUBLE PRECISION) data on some systems. In particular, systems using Pentium,
     Pentium Pro, 586, and 686 implementations of the i386 architecture execute programs faster when
     REAL(KIND=2) (DOUBLE PRECISION) data are aligned on 64-bit boundaries in memory. This option can, at
     least, make benchmark results more consistent across various system configurations, versions of the program,
     and data sets

e.g. you might set F77OPT as follows in wfnauto.bat :

Conservative:
set F77OPT=-fno-backslash -O

Aggressive:
set F77OPT=-fno-backslash -malign-double -O1
 

Suggested ivf compilation options are:

set F77OPT=/nologo /w /nbs /4Yportlib /Gs /Ob1gyti /Qprec_div

/nologo - avoids an overwhelming number of version messages
/nbs - "no backslash", prevents "\" from being interpreted as as
escape sequence
/w - avoids numerous F95 warnings
/4Yportlib - required for modification to flu.for for buffer flushing
/Gs - disables stack checking
/Ob1gyti - related to inlining of functions
/Qprec_div - disables floating point division-to-multiplication
optimization resulting in more accurate division results

[Options recommended by Bill Bachmann (Globomax) in email to nmusers 24 Jan 2003]

Suggested wc compilation options are:

set f77OPT=-tr -ox -6 -fp6

-tr includes trace information to help debugging

-ox full optimization

-6 and -fp6 CPU target optimized for Pentium Pro

Compiler Warnings

The g77 compiler will give warning messages as follows when compiling NONMEM. These messages can be safely ignored.


../src511/CN.for: In subroutine `cn':
..
/src511/CN.for:92: warning:
60 CALL SCALE (S,NV,OPSC)
^
Reference to unimplemented intrinsic `SCALE' at (^) (assumed EXTERNAL)
../src511/CN1.for: In subroutine `cn1':
..
/src511/CN1.for:134: warning:
65 CALL SCALE (S,NV,OPSC)
^
Reference to unimplemented intrinsic `SCALE' at (^) (assumed EXTERNAL)
../src511/GETETA.for: In subroutine `geteta':
..
/src511/GETETA.for:45: warning:
1 ' SUBJECT DATA')
^
Missing comma in FORMAT statement at (^)
../src511/INITL.for: In subroutine `initl':
..
/src511/INITL.for:535: warning:
1 ' PRIOR')
^
Missing comma in FORMAT statement at (^)
../src511/RESCL.for: In subroutine `rescl':
..
/src511/RESCL.for:48: warning:
CALL SCALE (S,N,1)
^
Reference to unimplemented intrinsic `SCALE' at (^) (assumed EXTERNAL)
 

g77 Software

The GNU g77 compiler can be downloaded from the web and used without payment of any license fee. g77 is part of a larger collection of software primarily orientated around the gcc C compiler. The full distribution for use under Windows (9x,ME,NT,2000,XP) can be found at:

http://sourceforge.net/projects/mingw/

Note that you will get a lot of stuff you do not need if you simply want to run g77 as a compiler for NONMEM.

I have created what seems to be more or less the minimum set of files you will need to use g77 with NONMEM.
You can obtain this from the wfn project at SourceForge.  Download the g77-nm package. This is a zip file which you should extract into a suitable directory e.g. c:\g77.

You must include c:\g77\bin in your PATH and set LIBRARY_PATH to g77\lib before running g77
e.g. add these lines to a DOS batch command file and run it in the DOS window you plan to use for NONMEM. Change c:\g77 to reflect the directory you extracted this package into.  Note that this is done automatically when using WFN.

  set PATH=c:\g77\bin;%path%
  set LIBRARY_PATH=c:\g77\lib

Installation Qualification

You can initially qualify your g77 or ivf installation as follows.
Change to the directory you extracted g77-nm into. It contains a Fortran file testcon.for.

      PROGRAM TESTCON
      OPEN(29,FILE='CONOUT$')
      WRITE(29,100)
100   FORMAT ('1USING con DEVICE')
      END

Then give the following command:

   g77 testcon.for

This will compile and link an executable with the name a.exe.

A similar step can be used with the ivf compiler (but you will have to create the testcon.for file yourself).

 Compile testcon.for with this command:

   ifl /exe:a.exe testcon.for

 

Then give the command:

  a

This executes a.exe. You should see output as shown below IO


1USING con DEVICE
 

This output indicates that your g77 or ivf compiler is probably installed properly for use with NONMEM.

Acknowledgement

        William J. Bachman, Ph.D.
        Senior Scientist
        GloboMax LLC
        7250 Parkway Drive, Suite 430
        Hanover, MD 21076
        Telephone: (410) 782-2212
        FAX: (410) 712-0737
     bachmanw@globomax.com

for suggesting how to obtain and use g77 for NONMEM. Bill also says "I would like to greatfully acknowledge ... Alison Boeckmann for being the proverbial NONMEM and FORTRAN font of knowledge!"
 

Home | Installation | Control Streams | Bootstrap | Randomization Test | Visual Predictive Check | Autocovariate | Files | References