#!/bin/sh
#

THIS_VERSION="NQS2"

check_version () {

    if test x"$QSUB_BASENAME" = "xqsub"; then
	qwait="$BATCH_BIN_PATH/qwait"
	if test -f "$qwait" ; then
	    echo "NQS2"
	fi
    fi

}

set_version () {

    QSUB_BASENAME="qsub"
    if [ -z "$QCONF" ];then QCONF="$BATCH_BIN_PATH/qstat"; fi
    if [ -z "$BL1" ];then BL1="PBS -l elapstim_req=CF_TIME"; fi
    if [ -z "$BL2" ];then BL2="PBS -l cpunum_job=CF_NCPU"; fi
    if [ -z "$BL3" ];then BL3="PBS -b CF_NODE"; fi
    if [ -z "$BL4" ];then BL4="PBS -N CF_BENCH"; fi
    if [ -z "$BL5" ];then BL5="PBS -q CF_PE"; fi
    if [ -z "$BL6" ];then BL6="PBS -T mpisx"; fi

}

get_properties () {
    NODEFILE="NONE"
}

patch_submission () {
    JSUB="$QSUB"
}

find_queue () {

    generic_qname="parallel multi mpi mpp mpich lam para par batch default"
    IFS="
"
    stat=`$QCONF -Q -r`
    for i in $stat; do
	IFS=" "
	for j in $generic_qname; do
	    if test x"$QUEUE" = "x"; then 
		check=`echo $i | grep $j`
		if test $? -eq 0; then
		    QUEUE=`echo $i | sed "s/.*\(\W*$j\W*\) *.*/\1/"`
		fi
	    fi
	done
    done       
    if test x"$QUEUE" = "x"; then
	echo "ERROR: Can't find routing QUEUE"
	exit 1
    fi

}

