Enable CLI Access on UNIX

This section explains how to set up a UNIX user's shell environment to have a proper context for the user to run installed Altair Accelerator programs from the command line. The programs that are run from the command line are called the CLI commands.

When a UNIX user logs into the system, a login script is executed which sets up their working environment. The default shell for the user determines what login script will run. A csh shell uses a .cshrc login script. A bash shell uses a .profile login script. The best way to set up a user's shell environment to run Altair Accelerator programs is to change the login script to properly set the user's working environment.

Altair Accelerator products require that the PATH environment variable be set to include the directories in the Altair Accelerator release which hold programs that will be run from the command line. Also, there are two environment variables that need to be set so that when an Altair Accelerator program is run, it will know where the release is installed and know what type machine it is running on. These two environment variables are VOVDIR and VOVARCH.

The Altair Accelerator product installation provides a helper file that can be sourced in order to set the needed environment variables to values that are appropriate for the local situation.

The intended use of the helper file is to have it sourced from a user's shell login script so that the user gets a proper environment without doing anything extra.

There is one helper file for each of the shell types that exist on UNIX. One helper script file is in the csh syntax and the other is in the shell syntax.
  • vovrc.csh
  • vovrc.sh

You can change each user's shell login script to source the file that is appropriate for the particular shell that they use.

Shell Instructions
C-shell, tcsh Add the following line to your .cshrc csh login script file:
source /<install_path>/<version>/<platform>/common/etc/vovrc.csh
sh, ksh, bash, zsh Add the following line to your .profile shell login script file:
. /<install_path>/<version>/<platform>/common/etc/vovrc.csh

Verify Access to Altair Accelerator Products

After making the changes to source the helper files, and then logging in, you can check that needed environment variables are set properly by looking at environment variables to note that the PATH value contains a reference to the folders in the release which hold programs, and to note that VOVDIR and VOVARCH are set. VOVDIR should contain the path to the installation. VOVARCH should contain the name that matches the machine type it is running on.

  1. At the command prompt, enter the following:
    % echo $PATH
    % echo $VOVDIR
    % echo $VOVARCH

Beyond just looking, you can try running a Altair Accelerator product program as a positive test that the context is set up properly. One program that is simple to run and is available with all Altair Accelerator products is vovarch. This program reports on the machine type on which it is running. A side effect is that it tests that needed environment variables are set properly. If the environment is valid, the program will run and report the correct machine type. If the environment is not valid, the program will not work.

  1. From the shell prompt, run the command vovarch.
    % vovarch
    You should get a response that is similar to one of the following, "linux64", or "macosx". This indicates the program was found, it ran, and it produced an expected output that matches your UNIX environment.

    You have successfully set up the environment and verified it is correct.

  2. If the response is Command not found, then the working environment does not have a VOVARCH setting for the programs in the Altair Accelerator products install area. If this is the case, review the steps to make sure the helper file from Altair Accelerator is being sourced correctly.
    % vovarch
    linux64
      ... or ...
    macosx
    or
    % vovarch
    vovarch: Command not found.

Enable Altair Accelerator for Non-Interactive Shells

It is possible to have the shell login script build a different working environment for interactive and non-interactive shells. The non-interactive environment is used when you run a batch script.

A common way this is done is to do an early exit from the login script file for non-interactive shells. For CSH, this can be done by testing for the existence of the shell variable "prompt".

Early exit from non-interactive shell login CSH script:
# This is a fragment of .cshrc.
    :
# Batch scripts can skip doing actions needed by interactive scripts.
if ( ! $?prompt ) then exit
    :
# Below are actions needed by interactive scripts.
    :

If this exit happens early in the script, before sourcing the Altair Accelerator helper file, then the environment variables will not be set for the non-interactive shell.

A batch script needs access to Altair Accelerator products. This means that the non-interactive shell needs to have the needed environment variables set.

You should place the code that sources the helper file from Altair Accelerator early in the shell login script, before any logic causes the script to differ between interactive and batch shells.

Source helper file before exit in login CSH script:
# This is a fragment of .cshrc.
    :
# Altair Accelerator env vars are needed by batch scripts.
source /<install_path>/<version>/<platform>/common/vovrc.csh
    :
# Batch scripts can skip doing actions needed by interactive scripts.
if ( ! $?prompt ) then exit
    :
# Below are actions needed by interactive scripts.
:

Enable the Shell to Communicate With a Running Product Server

If you need to issue commands that will communicate to a running product instance, the instance will need to be "enabled", which involves setting certain environment variables that point the commands to the location of the running vovserver.
% vovproject enable instance-name 

Some common instance names are "licmon" (for Monitor), "vnc" (for Accelerator), and "wx" (for Accelerator Plus). Instance names can be anything though since they are user-definable upon first start of each product.

Troubleshooting the UNIX Setup

An earlier section of this manual explained the importance of editing the .cshrc file so that batch shells would have the proper environment for running Altair Accelerator products.

The following is a command line to verify that the .cshrc file is set properly for batch shells. This runs the vovarch command within a batch context.
% csh -c vovarch

If this fails, the .cshrc file is not edited properly to enable access for batch shells. Review the details of the earlier topic on editing the .cshrc to enable access to batch shells.