## Setting Up A Global Consumable Resource in Grid Engine

Step 1: Configure the "global" complex
First create/modify a complex called "global" (the name is reserved, like the complexes which are managing resources on a per host/queue basis are called "host" and "queue"). This can be found by clicking the "Complexes Configuration" button in qmon.
Enter the following values for the complex (verilog is used in this example):

    #name   shortcut type value relop requestable consumable default
    #-------------------------------------------------------------
    verilog vl       INT  0     <=    YES         YES        0

The above says: there is a complex attribute called "verilog" with the shortcut name "vl" and it is of type integer. The "value" for consumable resources has no meaning here (therefore it is 0). This resource is requestable (YES), and it is consumable (YES).
The "default" field should be set to 0 (it is a default value for users who don't request anything, but for a global value it is not useful here).
When using qmon, do not forget to press the "Add" button to add the new complex definition to the table below before applying with the "Ok" button.
After the complex is configured, it can be viewed by running the following command at the prompt:

    % qconf -sc global

Step 2: Configure the "global" host
Since a global consumable resource is being created (all hosts have access to this resource), the pseudo host "global" must be configured.
Using qmon:
qmon -> Host Configuration -> Execution host
Select the "global" host and click on "Modify". Select the tab titled "Consumable/Fixed Attributes". It is correct that the "global" complex does not show in the window (the global host has it by default, just as a host has the "host" complex by default).
Now click on the "Name/Value" title bar on the right (above the trash bin icon). A window pops up and there will be the resource "verilog". Select OK and verilog will be added to the first column of the table. Now enter the number of licenses of verilog in the second column.
Press "Ok" and the new resource and number in the will appear in the "Consumables/Fixed Attributes" window. Click the "Done" button to close this window.

Step 3: View the consumable attribute
To view the attribute, type the following:

    % qstat -F verilog

       queuename   qtype   used/tot.   load_avg    arch             states
       ---------------------------------------------------------------------------
       balrog.q     BIC      0/4         0.45    solaris64    gc:verilog=10.000000
       ---------------------------------------------------------------------------
       bilbur.q     BIC      0/4         0.46     solaris     gc:verilog=10.000000
       ---------------------------------------------------------------------------
       dwain.q      BIC      0/4         0.82      irix6      gc:verilog=10.000000

See qstat(1) for the various meanings of "gc", etc. (Try "qstat -F" to see a long list of attributes associated with each queue).
"gc" means it is a (g)lobal (c)onsumable resource
Since it is global, all queues have inherited this value.

Step 4: Use the consumable attribute
The following submits a job, and requests the verilog resource:

    % qsub -l vl=1 myjob.sh

When the job is running, the effect can be seen by running qstat:

    % qstat -F vl

       queuename      qtype    used/tot.   load_avg    arch      states
       ----------------------------------------------------------------------------
       balrog.q        BIC       0/4         0.40    solaris64  gc:verilog=9.000000
       ----------------------------------------------------------------------------
       gloin.q2        BIC       0/4         0.02      osf4     gc:verilog=9.000000
       ----------------------------------------------------------------------------
       lis.q           BIC       0/4         0.35     glinux    gc:verilog=9.000000
       ----------------------------------------------------------------------------
       ori.q           BIC       1/4         0.15     glinux    gc:verilog=9.000000

         3026     0 sleeper.sh andy         t     11/02/1999 15:55:25 MASTER

To see which running job requested which resources:

    % qstat -F vl -r -s r

       queuename      qtype    used/tot.    load_avg    arch     states
       ----------------------------------------------------------------------------
       [...]
       ----------------------------------------------------------------------------
       ori.q           BIC       1/4          0.12      glinux  gc:verilog=9.000000

         3026     0 sleeper.sh andy         r     11/02/1999 15:55:25 MASTER
              Full jobname:     sleeper.sh
              Hard Resources:   verilog=1
              h_fsize=0 (default)