Skip to content
Advertisement

Force lshosts command to return megabytes for “maxmem” and “maxswp” parameters

When I type “lshosts” I am given:

HOST_NAME      type    model    cpuf   ncpus maxmem maxswp server RESOURCES
server1        X86_64 Intel_EM  60.0    12   191.9G 159.7G    Yes ()
server2        X86_64 Intel_EM  60.0    12   191.9G 191.2G    Yes ()
server3        X86_64 Intel_EM  60.0    12   191.9G 191.2G    Yes ()

I am trying to return maxmem and maxswp as megabytes, not gigabytes when lshosts is called. I am trying to send Xilinx ISE jobs to my LSF, however the software expects integer, megabyte values for maxmem and maxswp. By doing debugging, it appears that the software grabs these parameters using the lshosts command.

I have already checked in my lsf.conf file that:

LSF_UNIT_FOR_LIMTS=MB

I have tried searching the IBM Knowledge Base, but to no avail.

Do you use a specific command to specify maxmem and maxswp units within the lsf.conf, lsf.shared, or other config files?

Or does LSF force return the most practical unit?

Any way to override this?

Advertisement

Answer

LSF_UNIT_FOR_LIMITS should work, if you completely drained the cluster of all running, pending, and finished jobs. According to the docs, MB is the default, so I’m surprised.

That said, you can use something like this to transform the results:

$ cat to_mb.awk
function to_mb(s) {
    e = index("KMG", substr(s, length(s)))
    m = substr(s, 0, length(s) - 1)
    return m * 10^((e-2) * 3)
}
{ print $1 " " to_mb($6) " " to_mb($7) }

$ lshosts | tail -n +2 | awk -f to_mb.awk
server1 191900 159700
server2 191900 191200
server3 191900 191200

The to_mb function should also handle ‘K’ or ‘M’ units, should those pop up.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement