In the message dated: Thu, 17 Apr 2014 11:21:59 -0400,
The pithy ruminations from VG on 
<[gridengine users] command for finding available nodes and associated memory w
ith those nodes> were:
=> Hi,
=> I am working on SGE. I want to find out the available nodes on my cluster

What version of SGE?

You can use "qhost" to list the nodes, including their resources (# of CPUs,
amount of memory, etc.).

=> and associated memory with each node so that I can submit my jobs

You can run something like:

------------------------ CUT HERE --------------------------------------------
#! /bin/bash
sgever=`qhost --help 2>&1 | sed -n -e "s/^S*GE *//p"`
case $sgever in
        8.1.6)
                memtot=8        # field for MEMTOT data from 'qhost', indexed 
at 1
                ;;
        6.2u5)
                memtot=5        # field for MEMTOT data from 'qhost', indexed 
at 1
                ;;
        *)
                printf "Unrecognized SGE version...do not know what field from 
qhost is used for MEMTOT" 1>&2
                exit 1
                ;;
esac

printf "Memory per node:\n"
while read line
do
        fields=($line)
        host=${fields[0]} ; host=${host//-/}    # remove "-" from $host so that 
it is not
                                                # later interpreted as 
arithmetic
        avail=${fields[1]}
        eval ${host}=$avail
done < <(qstat -r -F h_vmem | perl -i -p -e 'if ( $_ !~ /(@|hc:h_vmem)/ ) 
{s/.*\n//;} ;'  -e 's/.*@(\S*).*\n/$1\t/;' | sed -e 's/[\.    ].*=/ /'  -e 
"s/\.000*\([BKMG]\)/\1/" |sort -u )

while read line
do
        fields=($line)
        host=${fields[0]} ; hostkey=${host//-/}
        installed=${fields[1]}
        printf "${host}\tTotal memory: $installed\tAvailable: "
        eval echo \$${hostkey}
done < <(qhost | tr -s "[ \t]" " " | cut -d" " -f1,$memtot | grep '[BKMG]$' | 
sort -u)

printf "\nMemory use of running jobs:\n   Count\tMemory\n"
qstat -r -F h_vmem|sed -ne '/^######/,$ d' -e 
"s/.*h_vmem=\([0-9]*[BKMG]\).*/\th_vmem Request: \1/p" |sort |uniq -c | sort -nr

printf "\nMemory request of queued jobs:\n   Count\tMemory\n"
qstat -r -F h_vmem|sed -ne '1,/^######/ d' -e 
"s/.*h_vmem=\([0-9]*[BKMG]\).*/\th_vmem Request: \1/p" |sort |uniq -c | sort -nr
------------------------ CUT HERE --------------------------------------------



=> accordingly.

By "submit [my] jobs accordingly", if you mean submit your jobs with resource
requirements that don't exceed the amount of installed memory, that's a good
thing. If you mean submitting jobs directly to particular nodes on the basis
of available memory...that's usually best left to the scheduler. Your site may
have resource limits and queues configured to deal with the amount of memory
per node -- that's something to ask your local administrator.

Mark

=> 
=> What command should I use
=> 
=> Regards
=> Varun
=> 
_______________________________________________
users mailing list
[email protected]
https://gridengine.org/mailman/listinfo/users

Reply via email to