Configure an Environment
VOV includes a sophisticated subsystem to manage environments. In Accelerator, an environment is a named collection of environment variables and their values. Many tools expect certain environment variables to be set for correct operation, and the variable PATH is used by most UNIX shells to locate executable programs.
- ENV.start.tcl
- ENV.end.tcl
- ENV.doc
The 'start' script is used when entering the environment, the 'end' script is used when leaving the environment, and the 'doc' script contains a one-line summary of the environment's purpose.
- vel
- List available environments
- vesENV
- Switch to environment ENV
- vep
- Change prompt to show environment name
- veprestore
- Return to original prompt
Find and View Example Environment Scripts
It is interesting and instructive to examine some of the environment definitions which are shipped with VOV. One of the most important is the BASE environment.
The most common place for environment scripts is $VOVDIR/local/environments, but you can also specify additional directories where VOV will search. We will discuss this in more detail later in the lab.
% pushd $VOVDIR/local/environments
% view BASE.start.tcl
# --
# -- Completely reset the environment to bare bones.
# -- We assume that VOVDIR and VOVARCH are set.
# --
set VOVDIR $env(VOVDIR)
if { $::tcl_platform(platform) eq "windows" } {
#
# --
#
nt_preprocess_env
# set vovenv(debug) 1 set WINDIR $env(WINDIR)
setenv PATH "$WINDIR\\system32;$WINDIR"
set MKSDIR "c:/mksdemo"
if [file exists $MKSDIR] {
setenv ROOTDIR $MKSDIR
vovenv PATH ";" APPEND $MKSDIR/mksnt
}
#
# Depending on the installation, the binaries can be in
# different directories.
#
foreach b { bin bin-O bin-g bat local/bat } {
set p "$VOVDIR/$b"
#
# Eliminate double // as in w://bat
#
regsub -nocase {^([a-z])://} $p {\1:/} p
if [file exists $p] {
vovenv PATH ";" APPEND $p
}
}
set version [exec vovversion]
vovenv PATH ";" PREPEND c:/temp/vov/execache$version
# vovenv PATH ";" PREPEND c:/temp/vov/execache
} else {
#
# -- Unix BASE environment.
#
setenv PATH ""
foreach b { bin bin-O bin-g } {
if [file exists $VOVDIR/$b] {
vovenv PATH : APPEND $VOVDIR/$b
break
}
}
vovenv PATH : APPEND $VOVDIR/scripts
vovenv PATH : APPEND $VOVDIR/local/scripts
setenv MANPATH ""
foreach mp [list /usr/man /usr/share/man /usr/local/man /usr/openwin/man $VOVDIR/man] {
if [file isdirectory $mp] {
vovenv MANPATH : APPEND $mp
}
}
setenv LD_LIBRARY_PATH ""
foreach lp [list /lib /usr/lib /usr/local/lib /usr/openwin/lib $VOVDIR/lib] {
if [file isdirectory $lp] {
vovenv LD_LIBRARY_PATH : APPEND $lp
}
}
foreach xapp { /usr/openwin/lib/app-defaults /usr/lib/X11/app-defaults } {
if [file isdirectory $xapp ] {
vovenv XFILESEARCHPATH : APPEND "$xapp/%N"
}
}
foreach p {
/bin /usr/ucb /usr/bin /usr/local/bin
/usr/X11/bin
/usr/dt/bin
/usr/openwin/bin /usr/bin/X11
} {
if [file isdirectory $p] {
vovenv PATH : APPEND $p
}
}
}
The BASE environment includes just the regular system commands and VOV. This is an example of a complex environment setup script; most of the ones you will need to define will be much simpler.
% vep
% ves BASE
% printenv PATH
% veprestore
Add Additional Environment Directories
When you are testing and developing environments, or when you want to have project-specific ones which are not put in the system wide directory at $VOVDIR/local/environments, you can use the environment variable VOV_ENV_DIR to specify additional directories.
% setenv VOV_ENV_DIR ~/ncadmin/vnc-user-name.swd/environments
% pushd $VOV_ENV_DIR
Configuration Examples
In this example, you will create an enviroment which adds your personal bin directory to the path. You will put the definitions in your queue's environment directory.
Use Tcl for the environment scripts because it is more powerful than C-shell, and platform-independent.
Example 'start' script for JOHN environment
# add john bin directory to path
vovenv PATH : PREPEND /home/john/bin
This script adds the element /home/john/bin to the beginning of the PATH. There is also an APPEND operator which adds to the end of the PATH. If the exact element is already present in the path, it is left undisturbed. This avoids PATH overflow in C-shell.
Example 'end' script for JOHN environment
# remove john bin directory from path
vovenv PATH : DELETE /home/john/bin
This script removes the element /home/john/bin from the PATH.
Example 'doc' script for JOHN environment
prepend /home/john/bin to PATH
This file contains a one-line summary which is presented by the vel command.
Use the above examples to create similar files in your queue.
Compose Good Environment Scripts
- minimal
- A minimal environment only sets the variables needed to accomplish a specific purpose.
- composable
- A composable environment respects pre-existing values of variables, and adds to them, rather than overwriting them. For example, when modifying LM_LICENSE_FILE, use PREPEND and APPPEND rather than simply setting it. This allows you to use commands like ves BASE+CADENCE+NASSDA and have both Cadence and Nassda tools work.
- reversible
- A good environment definition uses the 'end' script to revert what it set in the 'start' script, so that the environment does not gradually become polluted with obsolete values.
Environments are Cached on the vovtasker
To provide very low job dispatch latency, Accelerator caches the
eight most-recently used environments in the vovtasker process.
This means that jobs which run in any of those environments may start immediately
without sourcing the environment definition script. It also means that if you change
an env-script, you must tell the vovtaskers by using the
vovtaskermgr
refresh
subcommand.
Summary
- Most environments are defined by scripts stored in $VOVDIR/local/environments
- Environment scripts are in Tcl or C-shell syntax
- You can use the VOV_ENV_DIR environment variable to specify additional directories to search for environment scripts.
- Environments are cached on the vovtasker, and refreshed
using
ncmgr reset -taskers
, ornc cmd vovtaskermgr refresh