Submitting binaries in Grid Engine 6

Grid Engine 6 supports the direct submission of binaries via qsub and qrsh via the new argument -b y|n. The default behavior assumes -b n, use -b y to directly invoke a binary executable.

workgroupcluster:~ www$ qrsh -b y /usr/bin/uptime
7:49 up 107 days, 35 mins, 0 users, load averages: 0.12 0.03 0.01
workgroupcluster:~ www$

Submitting binaries in Grid Engine 5.x

The command qsub(1) cannot be used to directly submit binary files as jobs. Although one could write a small wrapper script around binaries to submit them, there are two convenient techniques to submit binaries as jobs very simply without involving a separate script.

  1. Type the qsub command, along with any desired flags and options, then press return without specifying a job script. You will then see a secondary shell prompt. At this prompt, you can type in the name of the binary. You can then press return and continue to enter more binary or shell commands. When you are done specifying your job, press Control-D.

    % qsub -l arch=solaris64
    sleep 60
    <ctrl-D>
    your job 47427 ("STDIN") has been submitted
  2. Type the qsub command, along with any desired flags and options, then use the STDIN redirect construction << <MARKER>. Type in one or more lines containing any combination of binaries and shell commands at the secondary prompt as above. Then, on a line by itself, type the <MARKER> and press return.

    % qsub -N test << EOF
    ? sleep 60
    ? EOF
    your job 47428 ("test") has been submitted

Both techniques above take advantage of the fact that qsub uses the STDIN stream as a job script if you don't specify a script file as an argument.

For seamlessly integrating certain applications in your environment with a Grid Engine cluster, it might be necessary to write a custom wrapper script which does some setup work before running a job. The second technique from above can be embedded into such wrapper scripts.

Example: create wrapper for submitting a binary batch job from a SunRay to a back-end farm. To do this, it is necessary to modify the LD_PRELOAD variable to remove SunRay-specific entry.

#!/bin/ksh
# analyze.sh: run the analyze binary from a SunRay on a back-end cluster
# be sure to maintain all environment settings from the caller's shell
# except LD_PRELOAD, which must be modified to remove SunRay-specific entry.
# Usage: analyze.sh <other options>

extract_libc_ut () {
# modify library path to remove reference to libc_ut.so
# leave other entries in LD_PRELOAD untouched
LIST=$1
# first decompose list of libraries
i=0
while [ -n $LIST ]; do
        var[i]=${LIST%% *}
        LIST=${LIST#* }
        if [ "$LIST" = ${var[i]} ]
                then break
        fi
        let i=i+1
done
unset LIST
# now recompose list, without libc_ut.so
for lib in ${var[*]}; do
        if [ $lib != libc_ut.so ]
                then LIST="$LIST $lib"
        fi
done
echo $LIST
}

# Begin main

if [ X$LD_PRELOAD != X ]; then
LD_PRELOAD="`extract_libc_ut $LD_PRELOAD`"
fi

ARGS="$*"
# submit binary
qsub -V << END
/export/share/bin/analyze $ARGS
END

A generic binary submit wrapper script "qbsub" can be found at this link. It can be used as a "binary version" of qsub. The wrapper script allows the submitter to use the standard submission flags, and it also accounts for the flags specified in the qtask file (which is used by qtcsh when transparently submitting binaries to the system).

An example of usage of this script is:

qbsub -v DISPLAY netscape http://gridengine.sunsource.net

This runs the netscape binary while explicitly maintaining the DISPLAY environment variable. NOTE: you of course need to ensure that the binary matches the architecture on which it will eventually run. You could specify this, for example, by doing:

qbsub -l arch=glinux mylinuxbinary