GAMESS on Cygwin

Compiling GAMESS on a computer running Cygwin under MS Windows isn't too different from compiling on a UNIX/Linux machine. The main issue has always been what FORTRAN compiler to use--g77, or gfortran. Use gfortran if you use RUNTYP=TDHFX, as g77 will not work with those types of runs. However, since g77 is now considered defunct, I would only use g77 it not able to download and install the latest gfortran on a system.

With either, you should definitely download the latest version from the Cygwin site or gnu.org before compiling GAMESS. If internet connectivitiy is an issue with the machine you want to install GAMESS on, remember that you can download Cygwin's files on another computer using Cygwin's setup.exe, copy those files over to the other computer, and then choose the "install from local directory" option of setup.exe on that computer.

Using Cygwin and XP SP3 with all the patches (both updated as of 19 May 2008, gcc/g77 3.4.4 cygming special), I did not need to change the default optimization values to have all the example input files run successfully, with the exception of exam39:

 SEQOPN: ATTEMPT TO OPEN FILE  201 GREATER THAN MAXIMUM   99
 G77 HAS AN INTERNAL LIMIT OF 99 FILES, AND SO CANNOT EXECUTE RUNTYP=TDHFX

This is is g77 issue, and otherwise not a Cygwin/GAMESS issue.

If you use gfortran for the compile, be sure to set your path to

setenv PATH /usr/local/gfortran/bin:$PATH

or add that line (or a similar line with the right path for your system) to the top of the compall and compddi scripts so that the right gcc is chosen. The path to your gfortran's gcc needs to be in your $PATH before /usr/bin, which is where Cygwin's gcc is. Using gfortran 4.3.0 (25 minute compile), all the example input files ran successfully except for the parallel jobs exam08, exam22, and exam36. I ran all the examples on a single CPU system however, so this was to be expected.


A brief review

In the gamess/misc directory, there is a file called cygwin.info that you should read first. Ignore "Part 2: from a deliberately unnamed source" as that refers to an older version of GAMESS. In "Part 3: from a different unnamed source" the SYSV comment is mildly out of date, and is addressed below. "Part 4: from yet another different unnamed source, summer 2005" may need to be updated for current versions of Cygwin as far as running GAMESS jobs in parallel across multiple computers, however this important part is still valid:

   
Be warned that the data server gamess.00.x process stays resident
after killing the computational process with a ^C or kill command,
or if the program crashes (atoms too close together, atom not
covered in a basis set, etc.).  You can spot this by doing a ps
and looking for a gamess.$VERSION.x process with a PPID of 1:

  PID  PPID  PGID   WINPID  TTY  UID    STIME COMMAND
 3292     1  2612    3936   con 1004 14:58:16 /home/me/gamess/gamess.00.x

A few crashed jobs can very quickly fill up all of your computer's RAM with these useless processes. To kill this process and free up the RAM, use the kill command with the PID (kill 3292 in this case).


BLAS 2: Electric Boogaloo

Before installing GAMESS, it wouldn't hurt to download and install a BLAS library to one of these locations:

/usr/lib/libblas.a
/usr/local/bin/libblas-asci.a
/usr/local/lib/libatlas.a

The BLAS library available from the Cygwin download site is installed at /usr/lib/libblas.a. A combination of an older version of GAMESS and an older version of Cygwin's BLAS would not work, so please download the latest and greatest of each before proceeding. The lked script will look for files in the locations above and use them if present.

I have several versions of BLAS and ATLAS on my systems. One that works with g77 is at /usr/lib/libblas.a, and ones that work with gfortran are at /usr/lib/libblasGF.a, /usr/local/atlas/lib/libf77blas_gf.a, and /usr/local/atlas/lib/libatlas_gf.a. To use the right libraries with gfortran, I added

   if ($FORTRAN == gfortran) then
      set BLASLIBRARY="/usr/lib/libblasGF.a"
      set BLAS=' '
   endif

or

   if ($FORTRAN == gfortran) then
      set BLASLIBRARY="/usr/local/atlas/lib/libf77blas_gf.a /usr/local/atlas/lib/libatlas_gf.a"
      set BLAS=' '
   endif

to lked, right above the "if ($BLAS == 'blas.o') then" line. Also note below where I show a line you need to add to the comp script if you have a BLAS library in a location other than the libblas.a, libblas-asci.a, or libatlas.a locations listed at the top of this section.


Let the GAMESS begin!

The following assumes you run GAMESS from the /tmp directory. Change all the instances of /tmp/gamess as appropriate for your system.

% gunzip -c gamess-current.tar.gz | tar -xvf -
% cd gamess/tools
% cp actvte.code actvte.f
% vi actvte.f
  :g/^*UNX/ s//    /g          (that's four blank spaces)
  ZZ
% g77 -O3 -s actvte.f -o actvte.x      (or gfortran instead of g77)
% cd ../ddi
% vi compddi
change
          set TARGET = ibm64
to
          set TARGET = linux32
and
         set SYSV = true
to
         set SYSV = false
adjust
         set MAXCPUS  = 8
         set MAXNODES = 64

as needed, and under "if($TARGET == linux32) then" change

     set FORTRAN=g77       # choose from g77, gfortran, ifort, pgf77, f2c
to
     set FORTRAN=gfortran  # choose from g77, gfortran, ifort, pgf77, f2c
and
     set CC = 'gcc'
to
     set CC = '/usr/local/gfortran/bin/gcc'     (or your gfortran's gcc location)

% ./compddi

and after that finishes, copy the ddikick.x executable to the main GAMESS directory:

% cp ddikick.x ..
% cd ..
% vi comp 
change
 set TARGET=ibm64
 chdir /u1/mike/gamess
to
 set TARGET=linux32
 chdir /tmp/gamess
and under
 if ($TARGET == linux32) then
change
    set FORTRAN=g77       # choose from g77, gfortran, ifort, pgf77, f2c

to the FORTRAN compiler of your choice. If you have a BLAS library somewhere aside from

if (($TARGET == linux32) && (-e /usr/lib/libblas.a))            set BLAS3=true
if (($TARGET == linux32) && (-e /usr/local/bin/libblas-asci.a)) set BLAS3=true
if (($TARGET == linux32) && (-e /usr/local/lib/libatlas.a))     set BLAS3=true

then you'll need to add a line such as

if (($TARGET == linux32) && (-e /usr/local/atlas/lib/libatlas_gf.a)) set BLAS3=true

to comp right below the three lines I listed above.

% vi compall
change
 set TARGET=ibm64
 chdir /u1/mike/gamess
to
 set TARGET=linux32
 chdir /tmp/gamess
and, if using gfortran,
 set CCOMP=cc
to
 set CCOMP=gcc              (or /usr/local/gfortran/bin/gcc)

as the default gfortran install does not have a binary or link called cc. 

% vi lked
change
 set TARGET=ibm64
 chdir /u1/mike/gamess
to
 set TARGET=linux32
 chdir /tmp/gamess
and under
 if ($TARGET == linux32) then
change
   set FORTRAN=g77       # choose from g77, gfortran, ifort, pgf77, f2c
as match what you set in comp.

% vi rungms
change
 set SCR=/scr/$USER
to something appropriate for your system.  I generally use
 set SCR=~/scr

as I only have 1 or 2 hard disks on each system. With a system that has an external USB disk f: that may or may not be present, I also add

 if (-e f:/cygwin/home/$USER/scr) then
  set SCR=f:/cygwin/home/$USER/scr
 endif

As a matter of personal preferences, I also change the

 df -k $SCR
to
 df -h $SCR

and comment out

 limit stacksize 8192

You need to change

 setenv ERICFMT ~mike/gamess/ericfmt.dat
 setenv MCPPATH ~mike/gamess/mcpdata
 setenv  MAKEFP ~$USER/scr/$JOB.efp
 setenv IRCDATA ~$USER/scr/$JOB.irc
 setenv   INPUT $SCR/$JOB.F05
 setenv   PUNCH ~$USER/scr/$JOB.dat
 setenv   SIMEN ~$USER/scr/$JOB.simen
 setenv  SIMCOR ~$USER/scr/$JOB.simcor

to the values appropriate for your system. I comment out the "set echo" right above these lines as well.

Below the

   set os=`uname`

add

   if ($os == CYGWIN_NT-5.1) set GMSPATH=/tmp/gamess

or replace CYGWIN_NT-5.1 with what the uname command returns on your system (e.g. Windows 2000 returns CYGWIN_NT-5.0).

Under

   if ($DDI_VER == new) then
I changed
      ddikick.x $JOB $GMSPATH gamess.$VERNO.x $SCR $NCPUS $HOSTLIST < /dev/null
to
      $GMSPATH/ddikick.x $JOB $GMSPATH gamess.$VERNO.x $SCR $NCPUS $HOSTLIST < /dev/null

just to make sure the right ddikick.x is being run (having several versions of GAMESS on my computers).

% vi runall

change

 chdir /u1/mike/gamess
to
 chdir /tmp/gamess

Now you're ready to compile:

% ./compall >&! log.compall &

and I like to follow the progress by tailing the log file:

% tail -f log.compall

When the compiling is done (27 minutes using g77 on an Intel Mobile Pentium 4 HT 3.056GHz system), create the GAMESS executable:

% ./lked >&! log.lked

and take a look at log.lked to make sure the executable has what you desire in it.

Use runall and then checktst to check for errors,

% ./runall           (16 minutes on a MP4HT 3.056GHz system)

The first time you do this, the Windows firewall may produce a pair of of pop-ups asking "Do you want to keep blocking this program" for "Name: ddikick" and "Name: gamess.00". Personally, I'd click Unblock both times! If you are logged in remotely and recompile a new version of GAMESS, such as gamess.01.x, and try to run it, the program will freeze up while waiting for you to click Unblock. You'll have to run over to the computer and unblock the new GAMESS, or, if you telecommute, convince someone in the office to do so... Once all the test input files have been run, it is time to check their output:

% cd tools/checktst
% vi checktst  
and change
 set GMSPATH=~/gamess
to
 set GMSPATH=/tmp/gamess

% ./checktst  

and hope everything turns out ok. If a job crashes, I can almost always fix the problem by lowering the default compiler options, e.g. g77's

   set OPT = '-O2'
   if ($MODULE == ormas1) set OPT='-O2 -fno-move-all-movables' # RH9, g77 3.3
   if ($MODULE == zheev)  set OPT='-O0'  # defensive compiling

to something less in one or two of the modules. I find out which module needs a lower optimization setting by trial and error after narrowing down the possible modules by looking at where the job crashed.


Running GAMESS in parallel using Cygwin - older edition

The following worked in 2003, so it probably won't work now!

To run GAMESS in parallel on a cluster of Cygwin machines, you need to install g77, gcc, xinetd, inetutils, and TCP wrappers in addition to the default install options presented when using setup.exe.

Then you need to turn on inetd and rsh to allow the computers to talk to each other. In the example below, four computers with IP numbers 1.2.3.21, 1.2.3.22, 1.2.3.23, 1.2.3.24 that all have an account named "user" are set up to allow rshing in. The hosts.allow file is set up to allow every computer with an IP number starting with 1.2.3 in. This needs to be done on every machine in the cluster:

% cygrunsrv --install inetd --path /usr/sbin/inetd --args -d
% vi /etc/hosts.allow
in.rshd: 1.2.3.

% vi ~/.rhosts
1.2.3.21 user
1.2.3.22 user
1.2.3.23 user
1.2.3.24 user

% vi /etc/xinetd.d/rsh

and change

        disable                 = yes

to

        disable                 = no

% net start inetd

Note that opening inetd and rsh may introduce security problems. Ask your local Cygwin security guru for advice, or port GAMESS to use SSH instead of rsh.

I log into Cygwin remotely using OpenSSH. To enable OpenSSH on Cygwin:

% cp /usr/share/doc/initscripts-0.9/sshd /etc/rc.d/init.d/sshd    (if /etc/rc.d/init.d/sshd doesn't exist)
% mkdir /var/empty    (not required in 2008)
% mkdir /var/lock
% mkdir /var/lock/subsys
% touch /etc/sshd_config
% vi /etc/passwd
sshd:unused_by_nt/2000/xp:1006:513:U-computer1\sshd,S-1-5-21-2495073255-1974565712-2106517767-1006:/var/empty:/dev/null

and then modify you hosts.allow file to accept connections from the machine(s) you desire. In the example below, every computer with an IP number starting with 1.2.3 is allowed in:

% vi /etc/hosts.allow
sshd: 1.2.3.

% ssh-host-config   (required in 2008, not in 2003)
% cygrunsrv --install sshd --path /usr/sbin/sshd --args -D
% /etc/rc.d/init.d/sshd start

To use rsh or ssh,

% passwd

to give the default account a password. Note that this also adds the password to the account on the MS Win side of the computer, so don't do this on an account other people use (on a general-purpose computer, for example)--create a new account to download and run Cygwin in, and password-protect that. Also, you may wish to provide your own sshd_config file instead of just creating an empty file with the touch command.

Finally, /etc/hosts on each computer has to contain the name and IP # of every computer being used in the cluster:

1.2.3.21 computer1
1.2.3.22 computer2
1.2.3.23 computer3
1.2.3.24 computer4
1.2.3.25 computer5
1.2.3.26 computer6

Using a crown ether 6-31G(d,p) energy run to compare a Pentium IV 2.0 GHz cluster (CPU introduced in August 2001) to a 64 CPU Pentium III 933 MHz cluster (CPU May 2000), and to an ancient 16 CPU SGI Origin 2000 R10000 250 MHz (CPU Feb. 1998), with wall-clock times listed below in minutes,

CPUs   R10k 250 MHz | PIII 933 MHz | PIV 2.0 GHz  | PIV 2.66 GHz | PIV 3.056 GHz
----  --------------|--------------|---------------|--------------|---------------
  1    77.4         |  40.4        | 22.0         | 16.0         | 11.5
  2    39.9 (1.94x) |  22.7 (1.78x)| 12.1 (1.82x) |
  3                 |              |  8.8 (2.50x) |
  4    21.1 (3.67x) |  13.3 (3.04x)|  7.0 (3.14x) |
  5                 |              |  6.5 (3.38x) |
  6    15.3 (5.06x) |  10.4 (3.88x)|  6.3 (3.49x) |
  7                 |              |  5.6 (3.93x) |
  8    12.4 (6.25x) |  8.8 (4.59x) |  5.1 (4.31x) |
  9    11.4 (6.79x) |              |  4.6 (4.78x) |
 16                 |  6.7 (6.03x) |              |
 32                 |  5.7 (7.09x) |              |

Interconnects for the PIII and PIV systems were 100Base-TX.


General comments about running GAMESS on a Windows computer:

1. Use the Windows Task Manager to set the priority of your GAMESS job to low if you intend to use the computer for anything else. GAMESS, with all the I/O and CPU time it uses, will almost certainly cause your machine to become very, very slow otherwise. Setting the priority to low allows me to run ArgusLab, Firefox, the GIMP, MDL ISIS/Draw, RasWin, SETI@Home (in "Run based on preferences" mode), TeXnicCenter, Thunderbird, Stellarium, WordPerfect, and other programs without too much of a decrease in performance with the exception of when GAMESS is reading/writing the two-electron integrals.

2. If you use the boot disk as $SCR, and then use the machine for anything else, prepare to experience a new level of slowness. Upgrading to a bigger and faster hard disk certainly helps--I went from an 80 GB to a 250 GB internal just for this reason. Setting $SCR to be an external disk helps considerably, though if it is a USB connection expect your run times to increase as you deal with USB latency and bandwidth. Consider adding an IEEE-1394 Firewire disk instead.

3. For heavily-used machines, it wouldn't hurt to add a cron job that looks for GAMESS jobs with a PPID of 1 (see the note above) a few times an hour, and kills them.

4. I've run this setup on a cluster of XP/Cygwin machines, and it was definitely worth the time it took to install Cygwin and GAMESS. It is pretty easy to turn a room full of desktops usually running little more than a web browser and a word processor all day into a supercomputing cluster. The room I am in now, a typical office space, has 16 machines with Intel Core2 Duo E6300 1.86 GHz CPUs, all of which are sitting around doing absolutely nothing. 11 GFLOPS is a terrible thing to waste.


Comments, questions, concerns?

Try the GAMESS forum or de.alt.comp.cygwin+co or gmane.os.cygwin.


Last updated: Thu Jul 3 21:02:33 EDT 2008

Valid HTML 4.01 Strict

1