Use Environment Variables

Applies To: Windows Compute Cluster Server 2003

Windows Compute Cluster ServerĀ 2003 uses a variety of environment variables and supports their use as aliases for recurring values or sets of values in Job Manager, the command-line interface (CLI), scripts, and batch files. For example:

job submit /stdout:\\hn\users\out\^%CCP_JOBID^% .txt myapp.exe

Note

When the environment variable is used in the context of a job submit command, it is necessary to use the escape character ^ before the character % to ensure that the variable is expanded at task run time. This is not required if the command appears in a script or batch file.

There are three types of environment variables used in Compute Cluster ServerĀ 2003:

  • Cluster-wide environment variables

  • Built-in task environment variables

  • Custom task environment variables

Cluster-wide environment variables

Cluster-wide environment variables are variables that are set by the administrative user and apply to all tasks running on the cluster.

There are two pre-existing cluster-wide environment variables. These are set during system deployment and are rarely changed manually or used in commands:

Environment Variable Definition

CCP_CLUSTER_NAME

The name of the cluster, which is the same name as the computer which serves as the head node.

CCP_MPI_NETMASK

The subnet mask for the interface to be used by the MPI process, if a separate Message Passing Interface (MPI) network exists. Example:

MPICH_NETMASK=172.30.0.0/255.255.0.0

To view clusterwide environment variables

  1. Open a Windows command prompt.

  2. Type:

    cluscfg listenvs

To create or change a clusterwide environment variable

  1. Open a Windows command prompt.

  2. Type:

    Cluscfg setenvs <variable>=<value>

    Where variable is the environment variable, and the value is appropriate for that variable.

    For example:

    Cluscfg setenvs mpich_netmask=172.30.0.0/255.255.0.0

Note

Built-in CCS environment variables begin with CCP. To avoid potential naming conflicts, do not start your variable names with CCP.

For more information about using this command, see Compute Cluster Server Command Line Interface Reference (https://go.microsoft.com/fwlink/?LinkID=64065).

Built-in task environment variables

Built-in task environment variables apply only to a task and are set automatically by the node manager of the compute node performing the task. This is the means by which the standard task options are communicated to the process or processes. Built-in task environment variables can be useful as aliases in commands because they are dynamic and contain information that is not necessarily known beforehand.

Built-in task environment variables

Environment Variable Definition

CCP_MPI_NETMASK

The network mask for the network interface that the Message Passing Interface (MPI) process uses.

CCP_JOBNAME

The name of the job to which the task belongs.

CCP_RUNTIME

The run time based on user-specified task or job run times. (Job run time overrides task run time.)

CCP_JOBID

The numeric ID of the job to which the task belongs. The Job Scheduler assigns this number when the job is created.

CCP_MPI_WORKDIR

The working directory for input, output, and standard error files to be used while the task runs. The default value is %USERPROFILE%.

CCP_RERUNNABLE

A flag indicating that a task can be rerun after a failure. The default value is true.

CCP_EXCLUSIVE

A flag indicating that the task has exclusive use of reserved nodes.

CCP_TASKCONTEXT

The context of the task used by MPI or other user applications to communicate with the cluster.

CCP_WORKDIR

The working directory for input, output, and standard error files to be used while the task runs. The default is %USERPROFILE%.

CCP_NODES

A list of nodes allocated to the task.

CCP_TASKID

The numeric ID of the task. The Job Scheduler assigns this number when the task is created.

CCP_CLUSTER_NAME

The name of the cluster, which is the same name as the computer which serves as the head node.

CCP_NUMCPUS

The number of resources assigned to the task.

CCP_STDIN

The redirect target for the stdin file.

CCP_STDOUT

The redirect target for the stdout file.

CCP_STDERR

The redirect target for the stderr file.

Custom task environment variables

Like built-in task environment variables, custom task environment variables apply only to a task but differ in that they are created by the user. Custom task environment variables are used to set values that are automatically read by the application. One of the most common examples is setting LM_License_File.

Note

Built-in CCS environment variables begin with CCP. To avoid potential naming conflicts, do not start your variable names with CCP.

To view or specify custom task environment variables

  1. On the Submit Job dialog, click the Tasks tab,

  2. Highlight a task and click Edit.

  3. On the Task Properties dialog, click the Environment tab.

  4. Highlight a task to view any environment variables that have been specified for that task.

    1. When viewing a task environment variable, if you want to remove or change a variable, highlight the variable and click Remove or Edit.
  5. To specify a new task environment variable, highlight the appropriate task and click Add.

  6. Input the environment variable and an appropriate value for that variable.

To specify a custom task environment variable using the command-line interface, use the command Job add with the task option /env:<variable>=<value>,

Where variable is the name of the custom task environment variable and value is appropriate for that variable.

For example:

Job new /numprocessors:20

Job add /id:<jobid> /license:lightning:1 /env: LM_License_File=1202@liccs mpiexec myapp.exe