> This page is for version 10.
> For other versions, use one of these documentation indexes:
> - 11 (default): https://docs.nvidia.com/base-command-manager/product-manuals/11/llms.txt
> - 10: https://docs.nvidia.com/base-command-manager/product-manuals/10/llms.txt

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.nvidia.com/base-command-manager/product-manuals/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.nvidia.com/base-command-manager/product-manuals/_mcp/server.

# Altair Grid Engine

Altair Grid Engine (GE) is a workload management and job scheduling system. It is a further development by Univa of Sun Grid Engine (SGE). SGE was developed by Sun Microsystems before 2011, and was at one time open source. Univa Grid Engine (UGE) was a proprietary fork of it. After Univa was acquired by Altair, UGE engine is now called Altair Grid Engine (GE).

GE has both a graphical interface and command line tools for submitting, monitoring, modifying and deleting jobs.

GE uses *job scripts* to submit and execute jobs. Various settings can be put in the job script, such as number of processors, resource usage and application-specific variables.

The steps for running a job through GE are to:

* Create a job script

* Select the directives to use

* Add the scripts and applications and runtime parameters

* Submit it to the workload management system

## 6.1  Writing A Job Script

A binary cannot be submitted directly to GE—a job script is needed for that. A job script can contain various settings and variables to go with the application. A job script format looks like:

```bash
#!/bin/bash
#$ Script options  # Optional script directives
shell commands     # Optional shell commands
application        # Application itself
```

### 6.1.1  Directives

It is possible to specify options (‘directives’) to GE by using “`#$`” in the script. The difference in the meaning of lines that start with the “`#`” character in the job script file should be noted:

<table>
  <colgroup>
    <col />

    <col />
  </colgroup>

  <thead>
    <tr>
      <th>
        **Line Starts With**
      </th>

      <th>
        **Treated As**
      </th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        `#`
      </td>

      <td>
        Comment in shell and GE
      </td>
    </tr>

    <tr>
      <td>
        `#$`
      </td>

      <td>
        Comment in shell, directive in GE
      </td>
    </tr>

    <tr>
      <td>
        `# $`
      </td>

      <td>
        Comment in shell and GE
      </td>
    </tr>
  </tbody>
</table>

### 6.1.2  GE Environment Variables

Available environment variables for GE can be seen in the man page for `qsub`. Some of these are called pseudo environment variables:

```bash
$HOME - Home directory on execution machine
$USER - User ID of job owner
$JOB_ID - Current job ID
$JOB_NAME - Current job name; (like the -N option in qsub, qsh, qrsh, qlogin and qalter)
$HOSTNAME - Name of the execution host
$TASK_ID - Array job task index number
```

There are also about 30 environment variables begining with the prefix `SGE_`.

### 6.1.3  Job Script Options

Options can be set in the job script file using this line format for each option:

```bash
#$ {option} {parameter}
```

Available options and their descriptions can be seen with the output of `qsub -help`:

<table>
  <thead>
    <tr>
      <th colspan="2">*Table  [6.1.3](#613-job-script-options): GE Job Script Options*</th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        **Option and parameter**
      </td>

      <td>
        **Description**
      </td>
    </tr>

    <tr>
      <td>
        `-a date_time`
      </td>

      <td>
        request a start time
      </td>
    </tr>

    <tr>
      <td>
        `-adds list_attr_name attr_key attr_value`
      </td>

      <td>
        add additional sublist parameter
      </td>
    </tr>

    <tr>
      <td>
        `-ac context_list`
      </td>

      <td>
        add context variables
      </td>
    </tr>

    <tr>
      <td>
        `-ar ar_id`
      </td>

      <td>
        bind job to advance reservation
      </td>
    </tr>

    <tr>
      <td>
        `-A account_string`
      </td>

      <td>
        account string in accounting record
      </td>
    </tr>

    <tr>
      <td>
        `-b y[es]|n[o]`
      </td>

      <td>
        handle command as binary
      </td>
    </tr>

    <tr>
      <td>
        `-binding [env|pe|set] exp|lin|str`
      </td>

      <td>
        binds job to processor cores
      </td>
    </tr>

    <tr>
      <td>
        `-c ckpt_selector`
      </td>

      <td>
        define type of checkpointing for job
      </td>
    </tr>

    <tr>
      <td>
        `-ckpt ckpt-name`
      </td>

      <td>
        request checkpoint method
      </td>
    </tr>

    <tr>
      <td>
        `-clear`
      </td>

      <td>
        skip previous definitions for job
      </td>
    </tr>

    <tr>
      <td>
        `-clearp attr_name`
      </td>

      <td>
        clear/delete a parameter
      </td>
    </tr>

    <tr>
      <td>
        `-clears list_attr_name attr_key`
      </td>

      <td>
        clear/delete sublist parameter
      </td>
    </tr>

    <tr>
      <td>
        `-cwd`
      </td>

      <td>
        use current working directory
      </td>
    </tr>

    <tr>
      <td>
        `-C directive_prefix`
      </td>

      <td>
        define command prefix for job script
      </td>
    </tr>

    <tr>
      <td>
        `-dc simple_context_list`
      </td>

      <td>
        delete context variable(s)
      </td>
    </tr>

    <tr>
      <td>
        `-dl date_time`
      </td>

      <td>
        request a deadline initiation time
      </td>
    </tr>

    <tr>
      <td>
        `-e path_list`
      </td>

      <td>
        specify standard error stream path(s)
      </td>
    </tr>

    <tr>
      <td>
        `-h`
      </td>

      <td>
        place user hold on job
      </td>
    </tr>

    <tr>
      <td>
        `-hard`
      </td>

      <td>
        consider following requests "hard"
      </td>
    </tr>

    <tr>
      <td>
        `-help`
      </td>

      <td>
        print this help
      </td>
    </tr>

    <tr>
      <td>
        `-hold_jid job_identifier_list`
      </td>

      <td>
        define jobnet interdependencies
      </td>
    </tr>

    <tr>
      <td>
        `-hold_jid_ad job_identifier_list`
      </td>

      <td>
        define jobnet array interdependencies
      </td>
    </tr>

    <tr>
      <td>
        `-i file_list`
      </td>

      <td>
        specify standard input stream file(s)
      </td>
    </tr>

    <tr>
      <td>
        `-j y[es]|n[o]`
      </td>

      <td>
        merge stdout and stderr stream of job
      </td>
    </tr>

    <tr>
      <td>
        `-jc jc_name`
      </td>

      <td>
        derive job from the specified job class
      </td>
    </tr>

    <tr>
      <td>
        `-js job_share`
      </td>

      <td>
        share tree or functional job share
      </td>
    </tr>

    <tr>
      <td>
        `-jsv jsv_url`
      </td>

      <td>
        job submission verification script to be used
      </td>
    </tr>

    <tr>
      <td>
        `-l resource_list`
      </td>

      <td>
        request the given resources
      </td>
    </tr>

    <tr>
      <td>
        `-m mail_options`
      </td>

      <td>
        define mail notification events
      </td>
    </tr>

    <tr>
      <td>
        `-mods list_attr_name attr_key attr_value`
      </td>

      <td>
        modify sublist parameter
      </td>
    </tr>

    <tr>
      <td>
        `-masterl resource_list`
      </td>

      <td>
        request the given resources for the master task of a parallel job
      </td>
    </tr>

    <tr>
      <td>
        `-masterq wc_queue_list`
      </td>

      <td>
        bind master task to queue(s)
      </td>
    </tr>

    <tr>
      <td>
        `-mbind mbind_string`
      </td>

      <td>
        specifies a memory binding strategy (lx-amd64 only)
      </td>
    </tr>

    <tr>
      <td>
        `-notify`
      </td>

      <td>
        notify job before killing/suspending it
      </td>
    </tr>

    <tr>
      <td>
        `-now y[es]|n[o]`
      </td>

      <td>
        start job immediately or not at all
      </td>
    </tr>

    <tr>
      <td>
        `-M mail_list`
      </td>

      <td>
        notify these e-mail addresses
      </td>
    </tr>

    <tr>
      <td>
        `-N name`
      </td>

      <td>
        specify job name
      </td>
    </tr>

    <tr>
      <td>
        `-o path_list`
      </td>

      <td>
        specify standard output stream path(s)
      </td>
    </tr>

    <tr>
      <td>
        `-P project_name`
      </td>

      <td>
        set job’s project
      </td>
    </tr>

    <tr>
      <td>
        `-p priority`
      </td>

      <td>
        define job’s relative priority
      </td>
    </tr>

    <tr>
      <td>
        `-par pe-allocation-rule`
      </td>

      <td>
        request overwriting pe allocation rule
      </td>
    </tr>

    <tr>
      <td>
        `-pe pe-name slot_range`
      </td>

      <td>
        request slot range for parallel jobs
      </td>
    </tr>

    <tr>
      <td>
        `-pty y[es]|n[o]`
      </td>

      <td>
        start job in a pty
      </td>
    </tr>

    <tr>
      <td>
        `-q wc_queue_list`
      </td>

      <td>
        bind job to queue(s)
      </td>
    </tr>

    <tr>
      <td>
        `-R y[es]|n[o]`
      </td>

      <td>
        reservation desired
      </td>
    </tr>

    <tr>
      <td>
        `-r y[es]|n[o]`
      </td>

      <td>
        define job as (not) restartable
      </td>
    </tr>

    <tr>
      <td>
        `-rou reporting variable list`
      </td>

      <td>
        write online usage of job to the reporting database
      </td>
    </tr>

    <tr>
      <td>
        `-rdi y[es]|n[o]`
      </td>

      <td>
        request dispatching information
      </td>
    </tr>

    <tr>
      <td>
        `-sc context_list`
      </td>

      <td>
        set job context (replaces old context)
      </td>
    </tr>

    <tr>
      <td>
        `-shell y[es]|n[o]`
      </td>

      <td>
        start command with or without wrapping <loginshell> -c
      </td>
    </tr>

    <tr>
      <td>
        `-si session_id`
      </td>

      <td>
        execute GE requests as part of the specified session
      </td>
    </tr>

    <tr>
      <td>
        `-soft`
      </td>

      <td>
        consider following requests as soft
      </td>
    </tr>

    <tr>
      <td>
        `-sync sync_options`
      </td>

      <td>
        define sync notification events
      </td>
    </tr>

    <tr>
      <td>
        `-S path_list`
      </td>

      <td>
        command interpreter to be used
      </td>
    </tr>

    <tr>
      <td>
        `-t task_id_range`
      </td>

      <td>
        create a job-array with these tasks
      </td>
    </tr>

    <tr>
      <td>
        `-tc max_running_tasks`
      </td>

      <td>
        throttle the number of concurrent tasks
      </td>
    </tr>

    <tr>
      <td>
        `-tcon y[es]|n[o]`
      </td>

      <td>
        run all tasks concurrently
      </td>
    </tr>

    <tr>
      <td>
        `-terse`
      </td>

      <td>
        tersed output, print only the job-id
      </td>
    </tr>

    <tr>
      <td>
        `-umask mask`
      </td>

      <td>
        set umask of the job
      </td>
    </tr>

    <tr>
      <td>
        `-v variable_list`
      </td>

      <td>
        export these environment variables
      </td>
    </tr>

    <tr>
      <td>
        `-verify`
      </td>

      <td>
        do not submit, just verify
      </td>
    </tr>

    <tr>
      <td>
        `-V`
      </td>

      <td>
        export all environment variables
      </td>
    </tr>

    <tr>
      <td>
        `-w e|w|n|v|p`
      </td>

      <td>
        verify mode (error\
      </td>
    </tr>

    <tr>
      <td>
        `-wd working_directory`
      </td>

      <td>
        use working_directory
      </td>
    </tr>

    <tr>
      <td>
        `-xdv docker_volumes`
      </td>

      <td>
        specify docker volume(s)
      </td>
    </tr>

    <tr>
      <td>
        `-xd docker_options`
      </td>

      <td>
        specify docker run options
      </td>
    </tr>

    <tr>
      <td>
        `-xd --help`
      </td>

      <td>
        show a list of available docker run options
      </td>
    </tr>

    <tr>
      <td>
        `-xd_run_as_image_user y[es]|n[o]`
      </td>

      <td>
        start autostart Docker job as the user defined in the Docker image
      </td>
    </tr>

    <tr>
      <td>
        `-@ file`
      </td>

      <td>
        read commandline input from file
      </td>
    </tr>
  </tbody>
</table>

More detail on these options and their use is found in the man page for `qsub`.

### 6.1.4  The Executable Line

In a job script, the executable line is launched with the job launcher command after the directives lines have been dealt with, and after any other shell commands have been carried out to set up the execution environment.

#### 6.1.4.1  Using `mpirun` In The Executable Line

The `mpirun` job-launcher command is used for executables compiled with MPI libraries. Executables that have not been compiled with MPI libraries, or which are launched without any specified number of nodes, run on a single free node chosen by the workload manager.

The executable line to run a program `myprog` that has been compiled with MPI libraries is run by placing the job-launcher command `mpirun` before it as follows:

```bash
[fred@basecm10 ~]$ mpirun myprog
```

### 6.1.5  Job Script Examples

Some job script examples are given in this section. Each job script can use a number of variables and directives.

#### 6.1.5.1  Single Node Example Script

An example script for GE:

```bash
[fred@basecm10 ~]$ cat application
#!/bin/sh
# Give the job a name
#$ -N sleep
# Use this interpreter
#$ -S /bin/sh
# Make sure that the .e and .o file arrive in the
# working directory
#$ -cwd
#Merge the standard out and standard error to one file
#$ -j y
sleep 60
echo Now it is: `date`
```

#### 6.1.5.2  Parallel Example Script

For parallel jobs the `-pe` (parallel environment) option must be assigned to the script. Depending on the interconnect, there may be a choice between a number of parallel environments such as MPICH (Ethernet) or MVAPICH2 (InfiniBand).

```bash
#!/bin/sh
#
# Your job name
#$ -N My_Job
#
# Use current working directory
#$ -cwd
#
# Join stdout and stderr
#$ -j y
#
# pe (Parallel environment) request. Set your number of requested slots here.
# qconf -spl shows current PE list
#$ -pe mpich2 2
#
# Run job through bash shell
#$ -S /bin/bash

# If modules are needed, source modules environment:
. /etc/profile.d/modules.sh

# Add any modules you might require:

module add gcc openmpi/gcc/64/1.10.7

# The following output will show in the output file. Used for debugging.

echo "Got $NSLOTS processors."
echo "Machines:"
cat machines

# Use MPIRUN to run the application. application must be compiled with right MPI library.
# That is openmpi here, compiled with:
# mpicc hello.c -o hello
mpirun ./hello
```

The number of available slots can be set by the administrator to an arbitrary value. However, it is typically set so that it matches the number of cores in the cluster, for efficiency reasons. More slots can be set than cores, but most administrators prefer not to do that.

In a job script, the user can request slots from the available slots. Requesting multiple slots therefore typically means requesting multiple cores. In the case of an environment that is not set up as a parallel environment, the request for slots is done with the `-np` option. For jobs that run in a parallel environment, the `-pe` option is used. Mixed jobs, running in both non-MPI and parallel environments are also possible if the administrator has allowed it in the complex attribute slots settings.

Whether the request is granted is decided by the workload manager policy set by the administrator. If the request exceeds the number of available slots, then the request is not granted.

If the administrator has configured the cluster to use cloud computing with Auto Scale (`cm-scale`) ([Chapter 8 of the *Administrator Manual*)](/admin/cm-scale), then the total number of slots available to a cluster changes over time automatically, as nodes are started up and stopped dynamically.

## 6.2  Submitting A Job

The GE module `uge` must be loaded first so that UGE commands can be accessed:

```bash
fred@basecm10 ~]$ module add shared uge
```

With GE a job can be submitted with `qsub`. The `qsub` command has the following syntax:

```bash
  qsub [ options ] [ jobscript | -- [ jobscript args ]]
```

After completion (either successful or not), output is put in the user’s current directory, appended with the job number which is assigned by GE to the job nmae.

For example, for a jobscript with the job option `#$ -N myapp`, the job name is set to `myapp`. When the job completes, then by default there is an error and there is an output file. The names they take are of the form:

```bash
myapp.e<job ID>
myapp.o<job ID>
```

If the `-j y` job script option is set, then the error file is combined with the output file into a single `.o` \<*`job ID`*> file.

### 6.2.1  Submitting To A Specific Queue

Some clusters have specific queues for jobs which run are configured to house a certain type of job: long and short duration jobs, high resource jobs, or a queue for a specific type of node.

To see which queues are available on the cluster the `qstat` command can be used:

```bash
    fred@basecm10 ~]$ qstat -g c
    CLUSTER QUEUE   CQLOAD   USED    RES  AVAIL  TOTAL aoACDS  cdsuE
    -----------------------------------------------------------------
    long.q          0.01      0      0    144    288      0    144
    default.q       0.01      0      0    144    288      0    144
```

The job is then submitted, for example to the `long.q` queue:

```bash
    fred@basecm10 ~]$ qsub -q long.q sleeper.sh
```

### 6.2.2  Queue Assignment Required For Auto Scale (`cm-scale`)

If `cm-scale` is used with GE, then jobs must be assigned to a queue by default, or `cm-scale` ignores the job. If the cluster administrator has not configured GE to assign a queue to jobs by default, then the user can assign a queue to the job with the `-q` option in order to have `cm-scale` consider the job.

## 6.3  Monitoring A Job

The job status can be viewed with `qstat`. In this example the `sleeper.sh` script has been submitted. Using `qstat` without options will only display a list of jobs, with no queue status options:

```bash
    fred@basecm10 ~]$ qstat
    job-ID  prior   name   user  state submit/start at      queue jclass   slots ja-task-ID
    ---------------------------------------------------------------------------------------
        80  0.55500 myapp  fred  r     03/12/2020 23:02:20  all.q@node003  2
        81  0.55500 myapp  fred  qw    03/12/2020 23:02:06  2
        82  0.55500 myapp  fred  qw    03/12/2020 23:02:07  2
        83  0.55500 myapp  fred  qw    03/12/2020 23:02:07  2
```

More details are visible when using the `-f` (for full) option. Some of the details that can be seen are:

* The queue-type `qtype`, which can take a state of Batch (B), Interactive (I), or Parallel (P).

* The `resv/used/tot` column is the count of reserved/used/total free slots in the queue.

* The `states` column is the state of the queue.

```bash
fred@basecm10 ~]$ qstat -f
queuename                      qtype resv/used/tot. np_load  arch          states
---------------------------------------------------------------------------------
all.q@node001.cm.cluster       BIP   0/1/1          0.01     lx-amd64
        88 0.55500 myapp      fred         r     03/12/2020 23:11:35     1
---------------------------------------------------------------------------------
all.q@node002.cm.cluster       BIP   0/0/1          0.01     lx-amd64
---------------------------------------------------------------------------------
all.q@node003.cm.cluster       BIP   0/1/1          0.00     lx-amd64
        88 0.55500 myapp      fred         r     03/12/2020 23:11:35     1

###############################################################################
 - PENDING JOBS - PENDING JOBS - PENDING JOBS - PENDING JOBS - PENDING JOBS
###############################################################################
        89 0.55500 myapp      fred         qw    03/12/2020 23:10:56     2
        90 0.55500 myapp      fred         qw    03/12/2020 23:10:56     2
        91 0.55500 myapp      fred         qw    03/12/2020 23:10:56     2
```

The man page for `qstat` gives details on the job states and the queue states.

By default the `qstat` command shows only jobs belonging to the current user, i.e. the command is executed with the option `-u $user`. To see jobs from other users too, the following format is used:

```bash
fred@basecm10 ~]$ qstat -u "*"
```

## 6.4  Deleting A Job

A job can be deleted in GE with the following command

```bash
fred@basecm10 ~]$ qdel <jobid>
```

The job-id is the number assigned by GE when the job is submitted using `qsub`. Only jobs belonging to the logged-in user can be deleted. Using `qdel` will delete a user’s job regardless of whether the job is running or in the queue.