Setting Up CMT and Using glastpack
Note:
The information on this page has been updated;
please see:
Using glastpack for Code Development.
Click on to return to start of page
Modify your .cshrc to include, in a section that always gets executed, the lines
setenv GLASTROOT /afs/slac.stanford.edu/g/glast source ${GLASTROOT}/ground/scripts/group.cshrc
Note that the above lines define the group default version of CMT. This is currently the v1r10p20011126 version of CMT. To use a more current version it is suggested that you add the following line BEFORE the above lines in your .cshrc file (the group.cshrc script will use the CMTVERSION environment variable, if defined, to set the CMT version) :
setenv CMTVERSION v1r9p20010927
You can set up your own path in two ways:
Define CMTPATH, either interactively, or in your .cshrc
Clear CMTPATH, and put a line CMTPATH=... into a file .cmtrc in your HOME folder. Currently the releases are put into the release area at /nfs/slac/g/glast/ground/releases.
CMT must be set up once per session. The simplest way to accomplish this is to add the following three lines to your .cshrc (or the equivalent to your shell's start-up file, e.g. .bashrc if you're running the bash shell, etc.):
setenv CMTCONFIG `sh ${BASE_OF_CMT}/CMT/v1r10p20011126/mgr/cmt_system.sh` source ${BASE_OF_CMT}/CMT/v1r10p20011126/mgr/setup.csh setenv CMTPATH /u/gl/tlindner/MyPackages
The first line sets up the CMT environment variable CMTCONFIG. You will need to replace ${BASE_OF_CMT} with whatever the path is to your installation of CMT.
The second line sets up some other CMT environment variables. Again replace ${BASE_OF_CMT}.
The third line specifies to CMT where to look for your packages. In this case CMT learns that the packages will be installed in /u/gl/tlindner/MyPackages. It is possible to specify more than one place where packages will be kept, by using the following format
setenv CMTPATH /u/gl/tlindner/MyPackages:/afs/slac/g/glast/ground/packages
Conceivably you might also want to reissue the "setenv CMTPATH ..." command during a session if, for example, you want to switch between an environment using only released packages and one which will preferentially pick up your development packages.
glastpack.pl - glast package management
Glastpack provides a facility for a developer to use "work areas" for development. A work area is simply a directory with a group of packages. These work areas are populated with the glastpack command.
It provides a functional recursive checkout. CMT does not look at the packages present in the CMTPATH before checkout, glastpack.pl does and will only retrieve packages it needs. This allows tiers of areas to be built.
Any wildcards in the requirements file for a package are resolved to the latest matching tag.
glastpack also tries to encapsulate the Unix commands necessary for setting the CMTPATH, doing runtime configuration, and launching builds.
Using glastpack on packages that do not specify a version number for a used package is dangerous; it is possible that CMT will select the wrong package
Each "work area" has it's own CMTPATH, allowing you to build tiers of areas.
Because the work area is always first in the path of directories CMT searches to find packages, packages here are used ahead of other areas. This enables you to have only the packages you are working with in the work area; files you don't need to edit and recompile can stay untouched in their own area.
tier | work area | CMTPATH | description |
---|---|---|---|
3 | Gleam_v1r1p3/ | Gleam_v1r0, GaudiSys_v9 | only those packages that have changed since v1r0 |
2 | Gleam_v1r0/ | GaudiSys_v9 | All packages in the Gleam application, excepting Gaudi |
1 | GaudiSys_v9/ | none | All packages in the Gaudi framework |
Inside your working directory you will find a file named "CMTPATH". This file has the syntax of the CMT .cmtrc file, and is managed via "add" and "remove" commands. Paths do NOT inherit; for example, if area A needs area B in it's CMTPATH, and B requires C, A must explicitly add B and C.
For an explanation of how Richard sets up and builds Gleam using glastpack click here.
Download the glastpack package from cvsweb. As of this writing, the latest version is glastpack v1r9.
Note that if you are working on a SLAC host, glastpack.pl is already installed in your path, located in the scripts directory.
Make sure the first line of glastpack.pl points at your sites copy of perl 5.6. At SLAC this perl is called /usr/local/bin/perl-new, and this is the default.
Copy glastpack.pl to a location in your path; or create an alias.
$ cp ~/glastpack.pl /usr/binor
$ alias glastpack.pl ~/glastpack.pl
$ glastpack.pl create dirname # creates the working area "dirname" $ cd dirname; glastpack.pl login # login to the working area $ glastpack.pl add /path/to/packages # add path to CMTPATH $ glastpack.pl remove /path/to/packages # remove path from CMTPATH $ glastpack.pl rco package version # recursive checkout of package, version $ glastpack.pl co package version # checkout package, version $ glastpack.pl build package version # compile package, version $ glastpack.pl run package executable # configure and run the executable from package
Check out GaudiSys v9r0p6 and Gleam v1r1p3 into separate work directories, compile Gleam against GaudiSys
$ mkdir /tmp/GLAST;cd /tmp/GLAST $ glastpack.pl create GaudiSys_v9r0p6 # create Gaudi work area
$ cd GaudiSys_v9r0p6; glastpack.pl login # login to GaudiSys area
$ glastpack.pl rco GaudiSys v9r0p6 # check out GaudiSys v9r0p5
$ glastpack.pl build GaudiSys v9r0p6 # build GaudiSys
$ cd /tmp/GLAST $ glastpack.pl create Gleam_v1r1p3 # create Gleam work area
$ cd Gleam_v1r1p3; glastpack.pl login # login to Gleam work area
$ glastpack.pl add /tmp/GLAST/GaudiSys_v9r0p6 # add GaudiSys to Gleam area's CMTPATH $ glastpack.pl rco Gleam v1r1p3 # check out Gleam against GaudiSys $ glastpack.pl build Gleam v1r1p3 # compile Gleam $ glastpack.pl run G4Generator G4Test.exe # run G4Test
Building and Running Gleam
See http://www-glast.slac.stanford.edu/software/core/build_system/glastpack.htm
for a description - it's in cvs.
To build Gleam v2r0 (already having GaudiSys available - if not,
build it this way) it was only 4 commands to do it all:
glastpack.pl create Gleam_v2r0
cd Gleam_v2r0; glastpack.pl login
- edit the CMTPATH file to append the path to my GaudiSys version (or
append it with glastpack.pl) -
glastpack.pl build Gleam v2r0
that's it.
then to run it:
glastpack.pl run Gleam Gleam.exe
Last Modified May 11, 2009
Back to Main Menu Previous Step Next Step