NCSA Home
Contact Us | Intranet | Search

Managing Your Environment (SoftEnv)

SoftEnv is a system designed to make it easier for users to define what applications they want to use, and it allows administrators to make applications available to users. Its commands are independent of the user's shell, so both tcsh and bash users can use the same commands to change the environment.

SoftEnv uses a file called .soft created in your home directory. In this file, the desired user environment is described using a set of keywords. These keywords are read by SoftEnv when you log in and are expanded into a set of environment variables. SoftEnv uses a database managed by the system administrators to decide how to build your environment. Details are available on the An introduction to the SoftEnv system and how to use it page.

Note: You may be accustomed to the use of shell startup files (.cshrc, .bashrc, etc.) to set your environment on other Unix systems. SoftEnv is an alternative to this, and with a few exceptions (outlined below), we recommend using the .soft file to set up your environment.

Useful SoftEnv Commands

  • To list the available SoftEnv keywords, type softenv.

    This command lists the SoftEnv keywords available along with a short description.

  • To see what environment changes are made by a particular keyword, use the soft-dbq command.

    For example, for keyword +totalview on the Xeon cluster, tungsten:
    [tund ~]$ soft-dbq +totalview
    
    This is all the information associated with
    the key or macro +totalview.
    
    -------------------------------------------
    
    Name: +totalview
    Description: Totalview Debugger from Etnus
    Flags: none
    Groups: none
    Exists on: linux-rh9-ia32 
    
    -------------------------------------------
    
    On the linux-rh9-ia32 architecture,
    the following will be done to the environment:
    
      The following environment changes will be made:
        MANPATH = ${MANPATH}:/usr/apps/tools/toolworks/totalview/man
        PATH = ${PATH}:/usr/apps/tools/toolworks/totalview/bin
        TOTALVIEW = /usr/apps/tools/toolworks/totalview/bin/totalview
        TOTALVIEW_HOME = /usr/apps/tools/toolworks/totalview
        TVDSVRLAUNCHCMD = ssh
    
    -------------------------------------------
    
    Note: Use "-a `/bin/whatami`" with the soft-dbq command to limit the output to information for the NCSA TG IA-64 cluster (mercury). The following is example output for running soft-dbq to find out what the keyword +intel-compilers does on mercury:

    [tg-login2 ~]$ soft-dbq -a `/bin/whatami` +intel-compilers
    
    This is all the information associated with
    the key or macro +intel-compilers.
    
    -------------------------------------------
    
    Name: +intel-compilers
    Description: Default Intel Compilers
    Flags: none
    Groups: none
    Exists on: linux-debian_unstable-ia32 linux-sles8-ia32 linux-sles8-ia64 
    
    -------------------------------------------
    
    On the linux-sles8-ia64 architecture,
    the following will be done to the environment:
    
      The following environment changes will be made:
        INTEL_HOME = /opt/intel/compiler80
        LD_LIBRARY_PATH = ${LD_LIBRARY_PATH}:/opt/intel/compiler80/lib
        MANPATH = ${MANPATH}:/opt/intel/compiler80/man:/opt/intel/idb73/man
        NLSPATH = /opt/intel/compiler80/lib/%N
        PATH = ${PATH}:/opt/intel/compiler80/bin:/opt/intel/idb73/bin
    
    -------------------------------------------
    
    
  • To see the environment created by a particular macro, also use the soft-dbq command.
    [tund ~]$ soft-dbq @default
    
    This is all the information associated with
    the key or macro @default.
    
    -------------------------------------------
    
    Name: @default
    Description: The recommended and complete path settings for tungsten.
    Flags: none
    Groups: none
    Exists on: linux-rh9-ia32 
    
    -------------------------------------------
    
      @default contains the following
      keywords and macros:
    
      @tun-1.1
    
    -------------------------------------------
    
    [tund ~]$ soft-dbq @tun-1.1
    
    This is all the information associated with
    the key or macro @tun-1.1.
    
    -------------------------------------------
    
    Name: @tun-1.1
    Description: Tungsten Software Stack v1.1
    Flags: useful
    Groups: none
    Exists on: linux-rh9-ia32 
    
    -------------------------------------------
    
      @tun-1.1 contains the following
      keywords and macros:
    
      +krb5 +champion-pro-2.1.0-1tgm2 +system +tun-environment-1.0 +lsf @grid +gm 
    +softenv +intel-c-9.0.026-r1 +intel-mkl +pgi60 +afs +local_adm +dot_last
    
    -------------------------------------------
    
    
  • To set/reset the environment in the current shell to what is specified in the .soft file, type resoft.

    The resoft command immediately applies changes in the .soft file to the current environment. It also removes changes you've previously made to the environment via the "soft add" or "soft delete" commands.

  • If you need to reset your .soft file to the system default, remove your .soft file and log out. When you log back in, a new .soft file will be created for you.

  • To temporarily change your environment to prepend particular software in the current shell only, use the soft add command. (i.e., any added software will take precedence over everything else in your environment.)

    For example, the command:

       soft add +intel-compilers71
    

    will change your environment in the current shell to access the Intel version 7.1 compilers.

    This command can be added to your batch script in order to change your environment for a single job.

    The following illustrates the change on the SGI Altix, cobalt:

    [co-login1 ~]$ which ecc
    /usr/local/intel/9.0.033/bin/ecc
    [co-login1 ~]$ soft add +intel-compilers71
    [co-login1 ~]$ which ecc
    /usr/local/intel/7.1.044/compiler70/ia64/bin/ecc
    

  • To temporarily change your environment to append particular software in the current shell only, use the soft append command. i.e., any added software will be at the end of your $PATH, etc.

  • To undo the changes made by a soft add or soft append command, use the soft delete or resoft commands.

    Example: To go back to the default, run

      soft delete +intel-compilers71
    
    [co-login1 ~]$ which ecc
    /usr/local/intel/7.1.044/compiler70/ia64/bin/ecc
    [co-login1 ~]$ soft delete +intel-compilers71
    [co-login1 ~]$ which ecc
    /usr/local/intel/9.0.033/bin/ecc
    

    Note: Only use resoft if you want to completely return to the environment as defined in your .soft file. Use the soft delete command to undo a single soft add (or soft append on SGI Altix cobalt) command.

  • To include particular software in the environment for all new shells, you must edit your $HOME/.soft file.

    For example, to change your environment to use the Intel version 7.1 compilers, add the line +intel-compilers71 to the beginning of your .soft file. The following illustrates the changes:

    #
    # This is the .soft file.
    # It is used to customize your environment by setting up environment
    # variables such as PATH and MANPATH.
    # To learn what can be in this file, use 'man softenv'.
    #
    #
    +intel-compilers71
    @default
    

    Note: Order is important. If you put the Intel 7.1 compiler keyword at the end of your .soft file, the changes will be appended instead of prepended meaning that the default Intel compilers will be first in your path instead of version 7.1.

  • To permanently set an environment variable that is not set in a SoftEnv keyword, add a SoftEnv assignment statement to your .soft file.
    For example, to set an environment variable called NEWVAR:
    #
    # This is the .soft file.
    # It is used to customize your environment by setting up environment
    # variables such as PATH and MANPATH.
    # To learn what can be in this file, use 'man softenv'.
    #
    #
    @default
    NEWVAR = "value"
    

    Note that this is equivalent to the following shell commands:

      csh: setenv NEWVAR "value"
      bash: export NEWVAR="value"

  • To permanently add a directory to the end of a path variable (i.e. PATH, MANPATH, etc) that can not be added by using a SoftEnv keyword, use a "+=" SoftEnv statement at the end of your .soft file.
    For example, to add ${HOME}/last to the end of your path:
    #
    # This is the .soft file.
    # It is used to customize your environment by setting up environment
    # variables such as PATH and MANPATH.
    # To learn what can be in this file, use 'man softenv'.
    #
    #
    @default
    PATH += ${HOME}/last
    

    Note that this is equivalent to the shell commands:

      csh: setenv PATH ${PATH}:${HOME}/last
      bash: export PATH=${PATH}:${HOME}/last

  • To permanently add a directory to the front of a path variable (i.e. PATH, MANPATH, etc) that can not be added by using a SoftEnv keyword, use a "+=" SoftEnv statement at the beginning of your .soft file.
    For example, to add ${HOME}/first to the beginning of your path:
    #
    # This is the .soft file.
    # It is used to customize your environment by setting up environment
    # variables such as PATH and MANPATH.
    # To learn what can be in this file, use 'man softenv'.
    #
    #
    PATH += ${HOME}/first
    @default
    

    Note that this is equivalent to the shell commands:

      csh: setenv PATH ${HOME}/first:${PATH}
      bash: export PATH=${HOME}/first:${PATH}

Exceptions to setting your environment in SoftEnv

The following are examples that will have to go in your shell-dependent startup file (${HOME}/.cshrc or ${HOME}/.bashrc).

  • setting aliases
  • any environments set via the use of shell programming