If you have several GPUs and you want the GPU to request your tasks, but the Grid Engine scheduler needs to process and select free GPUs, you can configure the RSMAP complex (resource map) (instead of INT). This allows you to specify the number as well as the names of GPUs on a specific host in the host configuration. You can also configure it as a HOST consumable, so that regardless of the slots of your request, the number of GPU devices requested with -l cuda = 2 for each host 2 (even if the received parallel job is 8 slots on different hosts).
qconf -mc
In the runtime host configuration, you can initialize your resources with identifiers / names (here simply GPU1 and GPU2).
qconf -me yourhost hostname yourhost load_scaling NONE complex_values gpu=2(GPU1 GPU2)
Then, when querying -l gpu = 1, the Univa Grid Engine scheduler will select GPU2 if GPU1 is already in use by another task. You can see the actual selection in qstat -j. The task receives the selected GPU by reading the environment variable $ SGE_HGR_gpu, which contains the selected id / name "GPU2" in this case. This can be used to access the right GPU without collisions.
If you have a multihomed host, you can even connect the GPU directly to some processor cores near the GPU (near the PCIe bus) to speed up the data exchange between the GPU and the CPU. This is possible by adding a layout topology to the execution host configuration.
qconf -me yourhost hostname yourhost load_scaling NONE complex_values gpu=2(GPU1:SCCCCScccc GPU2:SccccSCCCC)
Now that the UGE scheduler selects GPU2, it automatically binds the task to all 4 cores (C) of the second socket (S), so the task is not allowed to run on the first socket. It does not even require qsub param binding.
Additional configuration examples can be found at www.gridengine.eu .
Please note that all these functions are available only in the Univa Grid Engine (8.1.0 / 8.1.3 and higher), and not in SGE 6.2u5 and another version of the Grid Engine (for example, OGE, Sun Grid Engine, etc.) You can try downloading the 48-core free version from univa.com.