Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
if ( -f /reg/g/psdm/etc/ana_env.csh ) source /reg/g/psdm/etc/ana_env.csh

Advanced setup

Environment variables

This paragraph is informational and you can skip it if you are not interested in the internals of this setup. Various procedures, scripts, etc. depend on a small number of the environment variables which define location of various parts of the software and the system. Here are the variables that have to be present in the user's shell environment:

  • SIT_ENV – defines the type of the SIT environment, can be default for regular setup or ana for analysis environment
  • SIT_ROOT – defines the location of the top directory for the PSDM software, usually /reg/g/psdm.
  • SIT_RELDIR – directory with regular PSDM release
  • SIT_RELEASE – the name of the software release to use, something like "current" or "ana-1.1.5"
  • SIT_ARCH – the name of the hardware/software architecture to use like x86_64-slc5-gcc41-opt
  • SIT_DATA – list of directories where the data files reside. These are not regular XTC data files, bur rather some additional data that software needs. Usually it includes "./data" and $SIT_RELDIR/$SIT_RELEASE/data (that is "data" directory in the releases) but can also be extended to include other locations.
  • SIT_REPOS – the locations of all "base" releases. Currently we only support single base release so this variable would look like $SIT_RELDIR/$SIT_RELEASE

Derived variables:

  • PATH – should be extended to include ./arch/$SIT_ARCH/bin and$SIT_RELDIR/$SIT_RELEASE/arch/$SIT_ARCH/bin
  • LD_LIBRARY_PATH – should be extended to include ./arch/$SIT_ARCH/lib and$SIT_RELDIR/$SIT_RELEASE/arch/$SIT_ARCH/lib
  • PYTHONPATH – should be extended to include ./arch/$SIT_ARCH/python and$SIT_RELDIR/$SIT_RELEASE/arch/$SIT_ARCH/python

All these variables could be set manually, but there is a single convenience script which can be sourced from the users' shell which does all the tedious work.

Setup scripts and their effect

Regular way to handle environment setup would be to use a special setup script which need to be sourced by user's shell. For convenience this can be included into a user's login script (.bashrc/.cshrc). The exact name of the script depends on the shell flavor and also on the type of the environment. For the data-management environment one needs to use:

No Format
(ba)sh: . /reg/g/psdm/etc/sit_env.sh
(t)csh: source /reg/g/psdm/etc/sit_env.csh

For analysis environment the commands are:

No Format
(ba)sh: . /reg/g/psdm/etc/ana_env.sh
(t)csh: source /reg/g/psdm/etc/ana_env.csh

By default script will use "current" as the release name (or "ana-current" for analysis environment), this can be changed if user's home directory contains file named SIT_RELEASE with the different release name in it.

Above scripts will define the alias sit_setup (sourcing the $SIT_ROOT/bin/sit_setup.{sh,csh}). This alias can be used to quickly change SIT_RELEASESIT_ARCH and all derived variables. To do that user calls sit_setup with zero or more parameters. Depending on the current working directory and parameters the script will change SIT_RELEASE:

  • if the first parameter to the script names a valid release (present in $SIT_RELDIR) then its name is used forSIT_RELEASE
  • otherwise, if it is run from the release directory where .sit_release file is present its content is used for the release name
  • otherwise if $HOME/SIT_RELEASE is present its content is used for the release name
  • otherwise "current" or "ana-current" is used as the release name depending on environment type

Remaining parameters (that is all parameters except first when first parameter is a release name) are used to build SIT_ARCHvalue. SIT_ARCH is an ordered sequence of 4 values separated by dashes:

  1. hardware architecture, such as i686, x86_64, sparc, etc.,
  2. operating system brief name, such as slc5, sol, winxp, etc.,
  3. compiler name and version, such as gcc43, cc58, msc8, etc.,
  4. debug/optimize/profile option, one of dbg, opt, prof.

The parameters to the sit_setup script can be used to specify one of the possible options for any of the four above items. If a parameter matches one of the possible options for the SIT_ARCH items, then that option used in place of the default one. The simple example is:

No Format
% sit_setup          # sets SIT_ARCH to x86_64-slc5-gcc41-opt

vs

No Format
% sit_setup dbg      # sets SIT_ARCH to x86_64-slc5-gcc41-dbg

vs

No Format
% sit_setup dbg slc4 # sets SIT_ARCH to x86_64-slc4-gcc41-dbg

The SIT_ARCH options which are not specified on the command line are given their default values which depend on a particular platform/OS/release combination.

Additionally sit_setup accepts keyword options which provide explicit values for different parts of the SIT_ARCH variable. This is useful when the script is used for setup of the completely new release, as in this case the script cannot always make a decision about such values as compiler name/version. The keyword options are:

  • -p processor – define processor type explicitly
  • -o os – define OS name explicitly
  • -c compiler – define compiler explicitly
  • -b build – define build type explicitly
  • -a name – define SIT_ARCH explicitly
  • -e env – overrides current value of SIT_ENV

The sit_setup script is executed on every logon and sets up the environment suitable for running PSDM software from the current production release. The script needs to be executed again if user wants to switch to a different release or to use different build option (debug vs optimized builds)Environment variables and setup scripts are documented on the separate Advanced Environment Setup page.

Obtaining Kerberos ticket

...