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.
- 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:
|
sh, ksh, bash, zsh |
Add the following line to your .profile
shell login script file:
|
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.
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.
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".
# 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.
# This is a fragment of .cshrc.
:
# Altair Accelerator env vars are needed by batch scripts.
source /<install_path>/<version>/<platform>/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
% 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.
% 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.