GAMESS-US compilation

August 7, 2009

The first post on this blog had to be about GAMESS-US. This was the first program I have ever used for electronic structure calculations back a long time ago. You can get the program here. The most recent version of GAMESS-US is at this date GAMESS VERSION = 12 JAN 2009 (R3). As nowadays most of the computers used for calculations have intel based CPUs, we will restrict the compilation to these systems using 64-bit Linux-type operation systems (x86_64).

There are several prerequisites for compiling GAMESS-US, a fortran compiler and csh (C-shell) are to be the most important. The very first thing one should do is compile a vanilla version. This will serve as a test of the compiler/operating system used. Also, this version is very helpful in diagnosing future problems with the BLAS library or compiler optimization used.

After obtaining the code and unpacking it you should first compile the program used to “activate” the source. This program works in a similar fashion to a preprocessor. We will be using the gfortran compiler in this example. The following code does that. The activation program is located in the tools directory, and it also needs to be activated. This means that every occurrence of “*UNX” in the code should be replaced by four (4) empty spaces. This is done with the sed one-liner. After the fortran code obtained is compiled into an executable named actvte.x

===== begin code
cd gamess/tools
sed "s/^*UNX/ /g" actvte.code > actvte.f
gfortran actvte.f -o actvte.x
cd ..
===== end code

Next we will compile de DDI library, this code is located in the ddi directory. In there, edit the compddi script and alter the TARGET to linux64. You may wish to alter more parameters which suit your setup (MPI, maximum number of nodes used, etc.).
./compddi
Building the Distributed Data Interface library
started at Fri Aug 7 17:37:33 WEST 2009


Compiling for machine type linux64,
using communication model sockets,
System V shared memory option set true,
with maxima of 8 processors/node and 64 nodes.


This compilation should produce the DDI library libddi.a
It should also produce the kick-off program ddikick.x


Compiling common object: soc_create.o
gcc -DLINUX -m64 -O3 -fstrict-aliasing -I./include -Dgetarg_=_gfortran_getarg_i4 -Diargc_=_gfortran_iargc -DDDI_SOC -DUSE_SYSV -DMAX_SMP_PROCS=8 -DMAX_NODES=64 -c ./src/soc_create.c -o ./obj/soc_create.o
unset echo
Finished compiling: soc_create.o


[...]


Compiling DDI kickoff program
gcc -DLINUX -m64 -O3 -fstrict-aliasing -I./include -Dgetarg_=_gfortran_getarg_i4 -Diargc_=_gfortran_iargc -o ddikick.x ./obj/ddikick.o -L./ -lddikick -lpthread
unset echo


Don't forget to move ddikick.x up one directory level,
by a 'mv ddikick.x ..' command.


DDI compilation ended successfully.
Fri Aug 7 17:37:38 WEST 2009
1.480u 0.644s 0:04.89 43.3% 0+0k 12776+29160io 53pf+0w

Afterwards do as the script recomends and move ddikick.x to the gamess directory.
After this we will need to edit the comp and compall scripts. The compall script (as its name implies) compiles all the source code needed for GAMESS-US and comp compiles (and activates if needed) a single source code file. You should have basic knowledge of editing files in Linux (use vi, gedit, emacs, nano, or other editor that feels confortable to you). First edit compall script and make the following alterations
===== before editing
set TARGET=ibm64
chdir /u1/mike/gamess

===== After editing
set TARGET=linux64
#chdir /u1/mike/gamess

In the comp script make the same modifications as in compall, and no more changes are necessary as gfortran is the default compiler
===== from comp script
if ($TARGET == linux64) then
#
# The only thing you need to change is the next line.
# Note: you must make the analogous choice in compddi and lked, as well.
# If you wish to use ifort in 64 bit mode, use only target=linux-ia64.
#
set FORTRAN=gfortran # choose from gfortran, pgf77, pathf90
=====

If you want to use other compiler your choices are Portland’s group compiler or Pathscale. If you want to use intel’s compiler you should choose another target. As you can see from the quoted bit above, the comp script is well documented. So reading the comments is a really good idea. Now we can compile it with ./compall and the result should be something like the following:

./compall
Fri Aug 7 17:19:13 WEST 2009
gcc -c -DLINUX64 -m64 source/zunix.c
unset echo
======================== blas ==============================
Fri Aug 7 17:19:14 WEST 2009
Copying source code, blas.src does not require activation.
gfortran -c -fdefault-integer-8 -O2 -std=legacy blas.f
unset echo
Fri Aug 7 17:19:15 WEST 2009
0.823u 0.071s 0:01.08 82.4% 0+0k 1232+408io 10pf+0w
======================== aldeci ==============================
Fri Aug 7 17:19:15 WEST 2009
setenv SRCIN source/aldeci.src
setenv CODEOUT aldeci.f
tools/actvte.x
ACTIVATING *I64 SOURCE CARDS
9489 CARDS READ, 30 CARDS ACTIVATED
unset echo
gfortran -c -fdefault-integer-8 -O2 -std=legacy aldeci.f
[...]

If you want to save the compilation log to a file use
./compall | tee compall.log
So if you don’t get any errors we can proceed to the linking stage to obtain a working executable of the program. Edit the lked script (responsible for the linking stage) and make the same alteration as in comp and compall. The lked script will try to locate and link using a BLAS library: intel’s MKL, Atlas, and AMD’s ACML in that order. You can also use the GOTO Blas but have to change the lked script.

./lked
Fri Aug 7 17:39:16 WEST 2009
GAMESS will be linked into the binary file gamess.00.x.
Linking to Intel Math Kernel Library version 10


The name of the linker on this machine is gfortran,
and the linker options are " ".


Object code list begins with gamess.o unport.o, followed by
BLAS code=" ", VECTOR code=" ", quiche="zunix.o",
followed by the standard GAMESS object code list,


aldeci.o algnci.o basccn.o basecp.o basext.o basg3l.o bashuz.o bashz2.o basn21.o basn31.o baspcn.o bassto.o ccaux.o ccddi.o ccqaux.o ccquad.o ccsdt.o ceeis.o chgpen.o cisgrd.o cosmo.o cphf.o cpmchf.o cprohf.o dccc.o dcgues.o dcint2.o dclib.o dcmp2.o dcscf.o dctran.o ddilib.o delocl.o demrpt.o dft.o dftaux.o dftdis.o dftfun.o dftgrd.o dftint.o dftxca.o dftxcb.o dftxcc.o dftxcd.o dftxce.o dgeev.o dgesvd.o dmulti.o drc.o ecp.o ecpder.o ecplib.o ecppot.o efchtr.o efdrvr.o efelec.o efgrd2.o efgrda.o efgrdb.o efgrdc.o efinp.o efinta.o efintb.o efpaul.o efpcm.o efpcov.o efpfmo.o eigen.o elglib.o elgloc.o elgscf.o eomcc.o ewald.o ffield.o fmo.o fmoesd.o fmogrd.o fmoint.o fmoio.o fmolib.o fmopbc.o fmoprp.o frfmt.o fsodci.o g3.o globop.o gmcpt.o gradex.o guess.o grd1.o grd2a.o grd2b.o grd2c.o gugdga.o gugdgb.o gugdm.o gugdm2.o gugdrt.o gugem.o gugsrt.o gvb.o hess.o hss1a.o hss1b.o hss2a.o hss2b.o inputa.o inputb.o inputc.o int1.o int2a.o int2b.o int2c.o int2d.o int2f.o int2g.o int2r.o int2s.o int2t.o int2u.o int2v.o int2w.o int2x.o iolib.o ivocas.o lagran.o local.o loccd.o locpol.o
mcpgrd.o mcpinp.o mcpint.o mcpl10.o mcpl20.o mcpl30.o mcpl40.o mcpl50.o mcpl60.o mcpl70.o mcpl80.o mccas.o mcjac.o mcqdpt.o mcqdwt.o mcqud.o mcscf.o mctwo.o mdefp.o mexing.o mm23.o morokm.o mp2.o mp2ddi.o mp2grd.o mp2gr2.o mp2ims.o mpcdat.o mpcgrd.o mpcint.o mpcmol.o mpcmsc.o mthlib.o nameio.o nmr.o ordint.o ormas1.o parley.o pcm.o pcmcav.o pcmcv2.o pcmder.o pcmdis.o pcmief.o pcmpol.o pcmvch.o prpel.o prplib.o prppop.o qeigen.o qfmm.o qmfm.o qrel.o raman.o rhfuhf.o rohfcc.o rxncrd.o ryspol.o scflib.o scfmi.o scrf.o sobrt.o soffac.o solib.o sozeff.o statpt.o surf.o svpchg.o svpinp.o svpleb.o symorb.o symslc.o tddft.o tddefp.o tddfun.o tddfxc.o tddgrd.o tddint.o tddxca.o tdhf.o tdx.o tdxio.o tdxitr.o tdxni.o tdxprp.o trans.o trfdm2.o trnstn.o trudge.o umpddi.o utddft.o vibanl.o vscf.o vvos.o zapddi.o zheev.o zmatrx.o


Choices for some optional plug-ins are
Using qmmm.o, Tinker/SIMOMM code is not linked.
Using vbdum.o, neither VB program is linked.
Using neostb.o, Nuclear Electron Orbital code is not linked.


Message passing libraries are ../ddi/libddi.a -lpthread
Other libraries to be searched are -L/opt/intel/mkl/10.0.2.018/lib/em64t -lmkl_intel_lp64 -lmkl_sequential -lmkl_core


Linker messages (if any) follow...


The linking of GAMESS to binary gamess.00.x was successful.
0.305u 0.155s 0:01.10 40.9% 0+0k 2512+43280io 0pf+0w

In this case the script detected the installed MKL library. So now you should have a working gamess executable named gamess.00.x

This is true in every area of science, but for quantum or computational chemists this “self-evident truth” applies to every beginner chemist arriving to these areas. The expertise necessary to make good use of the available tools is overwhelming. One should have some knowledge of compilation tools, UNIX-type operating systems, visualization tools, queueing systems and parallel execution of programs, and this is just really scratching the surface …

This blog serves to collect information in the compilation and usage of some of these tools, with emphasis on freely available ones.