Valentin Ananikov

Compiling GAMESS under Linux with g77/gcc



Table of Contents


i)GAMESS Sources

To obtain GAMESS sources contact to:
   Prof. Mike Schmidt
   mike@si.fi.ameslab.gov
   http://www.msg.ameslab.gov/GAMESS/GAMESS.html


ii)Preface

   You must have gcc version 2.2.7.3 and g77 version 0.5.21 (or later?) to compile GAMESS according to the procedure described below.
g77/gcc can be downloaded from : ftp://prep.ai.mit.edu/pub/gnu/ or ftp://sunsite.unc.edu/pub/gnu/

***note: g77 must be compiled with 'f77-install-ok' option.

***note: This procedure has been tested only with GAMESS version = 18 MAR 1997


iii) Linux Compilation

   1) Activate and compile source code activator as described in the "misc/readme.unix" file.

   2) Choose target=pcunix and set correct path to the GAMESS directory in the "compall", "comp" and "lked" files.

   3) Add '-fno-globals' option in order to compile the program and '-Wno-globals' option to suppress the appropriate warnings.

Change the the 'pcunix' section in the "comp" file:

if ($TARGET == pcunix) then
   if (($MODULE == zheev) || ($MODULE == sozeff)) then
       mv $MODULE.f $MODULE.junk
       sed -e s/DREAL/DBLE/g $MODULE.junk > $MODULE.f
       rm -f $MODULE.junk
   endif
   set OPT = '-O1'
   set echo
   f2c -w66 -a -Nn802 $MODULE.f
   gcc -c $OPT $MODULE.c
   rm -f $MODULE.c
   unset echo
endif

to:

if ($TARGET == pcunix) then
   if (($MODULE == zheev) || ($MODULE == sozeff)) then
       mv $MODULE.f $MODULE.junk
       sed -e s/DREAL/DBLE/g $MODULE.junk > $MODULE.f
       rm -f $MODULE.junk
   endif
   set echo
   f77 -O -c -fno-globals -Wno-globals $MODULE.f
   unset echo
endif

   4) Execute the compilation: compall >comp.log 2>comp2.log &
Inspect "comp2.log" file. It should not contain any warnings/errors (excepting a few warnings concerning soffac.f file).

   5) Change the the 'pcunix' section in the "lked" file:

if ($TARGET == pcunix) then
   set LDR='gcc'
   set LDOPTS=' '
   set LIBRARIES='-lf2c -lm'
   set BLAS='blas.o'
   set VECTOR=' '
   set QUICHE='zunix.o zpcunix.o'
endif

to:

if ($TARGET == pcunix) then
   set LDR='f77'
   set LDOPTS=' '
   set LIBRARIES='-lf2c -lm'
   set BLAS='blas.o'
   set VECTOR=' '
   set QUICHE='zunix.o zpcunix.o'
endif

   5) Execute the link script: lked

Now you should have an executable file in your GAMESS dir.
Congratulations!


iv) Improving the Performance

   Usually the performance of the code can be slightly improved using optimization options. The only "safe" option in the current version of g77 is '-malign-double'. It might increase the performance up to 10% for some type of calculations (see Benchmark section). To apply the option change f77 calling line in the "comp" file to:

f77 -O -c -fno-globals -Wno-globals -malign-double $MODULE.f

***note: the '-malign-double' option makes sense only with 486, 586, Pentium and PentiumPro CPU's.

***note: one should be careful using '-O2' optimization level. The resulting code is still executable, but contains too many I/O bugs.


v) Benchmarks

Some Selected Benchmarks
bench04.inp bench10.inp bench13.inp
CPU time/TOTAL time, s
standard compilation
59.7/64.0 45.8/47.0 236.8/239.0
CPU time/TOTAL time, s
with '-maling-double' option
57.2/61.0 45.9/47.0 210.6/213.0

***machine summary: Pentium 200MHz, 64Mb RAM, 2.5Gb IDE HD; under Linux;



(c) Valentin P. Ananikov

NMR Laboratory
N.D. Zelinsky Institute of Organic Chemistry
http://nmr1.ioc.ac.ru/Staff/AnanikovVP/