Building Large Projects

Lab Exercise
Prerequisites Overview Exercise Solution Cleanup

Prerequisites

You should be familiar with Makefiles, and complete the Getting Started , Cluster CoNTroller System, and Large Projects modules before starting this lab. A basic knowledge of scripting languages (PERL) is also useful.


Overview

MOIL is a Molecular Dynamics (MD) package written by Ron Elber and co-workers. MOIL is freely available and is a crossplatform application (UNIX/MS Windows). A set of MD tools can be compiled in different OS environments using a large number of Fortran77 compilers. All the tools may be built separately as well as all together using one generic Makefile. The source directory (moil.export) contains more than 400 Fortran77 files, a generic makefile (ser_make.mak) and a set of specific header Makefiles. In addition to all the Fortran77 source code, a directory (moil.test) with template cases are provided to check the correctness of installed tools. A minimal subset of this project (Proj03.tar) is provided as a lab exercise.


Exercise

Initial Setup

Copy the archive file Proj03.tar which contains all sources into a separate directory.

      copy H:\VWLabs\Large\Proj03.tar .

Unpack the archive using a command:

      tar -xvf Proj03.tar
and change the root project directory:
      cd Proj03

The project top directory contains a few subdirectories:

  
 Proj03 
     |
     +--- moil.export (makefile + subdirectories with sources)
     |                  
     +--- moil.mop    (databases with parameters)   
     |
     +--- moil.test   (few tests examples)


Compiling

Around 30 different tools can be built using the generic makefile "ser_make.mak" using one command:

      cd moil.export
      nmake -f ser_make.mak

The subdirectory "incdirmake" contains a few templates for specific compilers and OS:
    unix_dvf.mak
    unix_pgf.mak
    win_dvf.mak
    win_ifl.mak
    win_pgf.mak
    
To use one of these specific environments (unix*.mak with GNU make and win*.mak with MS nmake) a include line from "ser_make.mak" should be edited. For Compaq Visual Fortran 6.* with nmake this line should be:
     
    include "win_dvf.mak"   
     
To build one or two tools instead of all tools type the command:
      nmake -f ser_make.mak exe/conn.exe exe/dyna.exe

which will build only two applications "conn.exe" and "dyna.exe" in the directory "exe".

Cleaning all the objects files can be done easily with:

      nmake -f ser_make.mak clean

Running

The test run jobs are in the subdirectories of "moil_test":

    moil.test ------+----- ad_map
                    |
                    +----- dyna_small
                    |
                    +----- gram_water
                    
Before running all of these tests, 6 executables should be created (compiled):
        boat.exe
        ccrd.exe
        conn.exe
        dyna.exe
        energy.exe
        mini_pwl.exe
                    
All the jobs in the above mentioned subdirectories can be created using the Makefiles. For example
        cd ad_map
        nmake 
                    
The target results will be stored in the output_NT (or output_UNIX) subdirectory depending what OS is chosen to run the applications. The desired OS environment can be chosen by copying the specific include files into generic ones. For MS Windows "nmake":
        copy Win_MakeBot.inc MakeBot.inc
        copy Win_MakeTop.inc MakeTop.inc
                    
For UNIX "make":
        copy UNIX_MakeBot.inc MakeBot.inc
        copy UNIX_MakeTop.inc MakeTop.inc
                    
To check the correctness of the results, please compare the generic results from "output" directory with specific one - "output_NT":
    diff -r output output_NT
                    
Another option is to run all the jobs in all moil.test subdirectories with a PERL script:
    perl pmake.pl --m=nmake --t=all


Solution

Please check the structure of the  "ser_make.mak" Makefile to understand the details of the compilation and linking phases.


Cleanup

After you are done, you can remove the top directory Proj03 with all subdirectories and files:

        rmdir /S /Q Proj03