Cmaq Adjoint Code Repository

CMAQ CVS User-Guide

The code has three components at this point:

  • code package
  • repository of include files
  • repository of sourcecode files

1. Downloading the code package

  • Download a code package which contains everything BUT the source code repository (CCTM) and the folder of include files (ICL)
    • ssh to adjoint.colorado.edu
    • ex: ‘ssh ude.odaroloc.tniojda|tniojdaqamc#ude.odaroloc.tniojda|tniojdaqamc
    • cd /Users/Shared
    • copycmaq_adj_1.tar.gz to your local host:
    • While on adjoint.colorado.edu ‘scp cmaq_adj_1.tar.gz yourusername@yourlocalhost:~/’
    • While on local host ‘scp ude.odaroloc.tniojda|emanresu#ude.odaroloc.tniojda|emanresu:/Users/Shared/cmaq_adj_1.tar.gz ~/Desktop’
  • Unpack the code package on your local machine.
    • tarxzvf cmaq_adj_1.tar.gz
    • This package also contains a folder called "scripts", where we can place build scripts and share others.
    • Sergey's build script is in there. We can add to the package as necessary as things progress.

2. Downloadingthe include files

  • Add the following line to your .cshrc file:
    • setenv CVS_RSH ssh
  • Obtain a copy of the include files:
setenvCVSROOT :ext:username@adjoint.colorado.edu:/Volumes/Data/CVS/CMAQ_CVSrepos/ICL
  • cvs checkout ICL

3. Accessing the sourcecode files

  • Add the following line to your .cshrc file:
    • setenv CVS_RSH ssh
    • setenv M3MODEL $M3HOME/models(change for your specific folder)
    • setenv M3LIB $M3HOME/lib(change for your specific folder)
  • Set your local CVSROOT to point to the sourcecode repository:
setenvCVSROOT :ext:username@adjoint.colorado.edu:/Volumes/Data/CVS/CMAQ_CVSrepos/CCTM
  • cvs checkout CCTM

4. Building with the local sourcecode files

  • Check out the source code from the CVS repository to your local machine
    • cvs checkout CCTM
  • Check out the ICL folder from the CVS repository to your local machine
    • cvs -d :ext:ude.odaroloc.tniojda|emanresu#ude.odaroloc.tniojda|emanresu:/Volumes/Data/CVS/CMAQ_CVSrepos/ICL checkout ICL
    • Note:Omit the space between Data/ and CVS
  • Modify the bldit.adjoint script for your specific host and then run the bldit script.
    • cdcmaq_adj/scripts
    • Change the Adj_Home environment variable to match the location of the checked out CCTM directory
216c218
<setAdj_Home = /home/mturner/cvs_test/CCTM
 ...
>setAdj_Home = …
  • Select the modules desired for the build
  • Specify the full path to compilers
182,184c182,184
<set FC = ifort
set CC = icc
set CPLUS = C++
...
>set FC = /data/opt/intel/Compiler/11.1/073/bin/intel64/ifort
set CC = /data/opt/intel/Compiler/11.1/073/bin/intel64/icc
set CPLUS = /data/opt/intel/Compiler/11.1/073/bin/intel64/icpc
  • Specify the MPICH path
188c188
<set MPICH  = /data/opt/intel/impi/4.0.0.028
...
>set MPICH = …
  • Change the IOAPI, ICL_IOAPI, NETCDF variables to match the location of libraries/include files on your machine
205,207c205,207
    <set IOAPI  = "${M3LIB}/ioapi_3/ioapi/${BLD_OS}_x86_64ifort -lioapi"
    set ICL_IOAPI = ${M3LIB}/ioapi_3/ioapi/fixed_src
    set NETCDF = "/data/libraries/netcdf/parallel/lib -lnetcdf"
    ...
    >set IOAPI  = "… -lioapi"
    set ICL_IOAPI = …
    set NETCDF = "… -lnetcdf"

The bldit script will copy the relevant source code files from the CCTM directory (that was checked out from CVS) into a build directory. It will then also create a Makefile to compile the model. Unlike CMAQ, the bldit.adjoint script will not compile the model; you need to “make” within the BLD directory.

Note: All modifications to files will need to occur within the CCTM directory tree that was checked out from CVS. After modifications (or after a CVS update), the bldit script will need to be run again.

5. Working with files

After following the procedures above, you will have source code files both in your local CCTM folder and you local build folder. CVS only knows about the ones in the CCTM folder, which contains the CVSROOT file and repository information. Thus, to edit, develop, add, delete and check the status of files, you must work with the files within this CCTM directory tree, not the copies that are in your built directory. See Fig. 1.

5.1 Checking Status of Existing Files
Note: you will need to adjust the CVSROOT environmental variable depending on whether you are working on ICL files or sourcecode files.

  • To compare these local files to versions in the repository, you can use the diff and status commands.
    • To check the status of your local file: cvsstatusfile.f
    • To list all local files that are not up-to-date:
cvs status | grep Status | grep –v “to-date”
  • To compare your local version to the version that was in the repository at the time of checkout: (ex. hetchem.f):
    • cvs diff hetchem.f
  • To compare your local version to the version that is currently in the repository (which may have been updated sinced you lasted checked out):
    • cvsdiff –D “now”hetchem.f
  • To update your local version to match the repository version
    • cvs update htechem.f

5.2 Commiting Changes
After running update to make sure you have merged any repository updates with your own updates, you can commit your changes:

  • cvs commit hetchem.f

5.3 Adding Files
In order to add files to the repository, you need to cd tothe CCTM directory. This is necessary so that you can place the new file in the correct module folder.

To add a new file to a module, you first must tell CVS that you wish to add the file. You then need to commit the addition of the file. From within the modulefolder, do the following (ex. Adding hetchem_test.f to module aero5):

cd CCTM/aero/aero5/
    cvs add hetchem_test.f
      cvs commit
  • You can add multiple files at the same time by listing the files in the cvs add command:
    • Ex: cvs add file1.f file2.f file3.f
    • cvs commit

5.4 Deleting Files
To delete a file from the repository, you first need to remove the file from your local system (from the module directory within the CCTM checked out directory).

Once the file is removed from the local system, tell CVS that you want the file removed from the repository. Now commit the changes

  • Ex:
  • rm file1.f
  • cvs remove file1.f
  • cvs commit
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License