2

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?

markgz
  • 6,054
  • 1
  • 19
  • 41

2 Answers2

2

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.

bishop
  • 37,830
  • 11
  • 104
  • 139
  • I assumed 'LSF_UNIT_FOR_LIMITS' would have worked, however it seems ineffective. Cluster has been drained and restarted - still no change. From what I gather, servers with large amounts of RAM (96G and above) always show RAM in gigabytes, regardless of setting 'LSF_UNIT_FOR_LIMITS' for the sake of formatting. This is a nightmare for software that polls the 'lshosts' command for cluster info. The above function does work converting gigabytes to megabytes, however I'm trying to find a more expandable and robust solution. – Christopher Sousa Jul 06 '15 at 20:13
  • Well, you could always [modify the source and compile your own](https://github.com/openlava/openlava/blob/master/lsf/lstools/lshosts.c), but personally I consider this little tool to be quite robust and consistent with the UNIX philosophy. Of course, I'm biased. :) – bishop Jul 06 '15 at 23:19
  • Oh, and just one more note: reviewing the source code for `lshosts`, I notice that the tool itself is dumb and apparently no calculation: the final values seem to come from the server. That suggests to me you need to set `LSF_UNIT_FOR_LIMITS` on each of the bastion hosts, not the host running `lshosts`. – bishop Jul 06 '15 at 23:21
  • 1
    I'm marking this as the correct answer because it enough to fool software by creating an alias for the command `lshosts` which would invoke this awk script. Thanks for you excellent answer. – Christopher Sousa Jul 07 '15 at 16:24
1

If LSF_UNIT_FOR_LIMITS is defined in lsf.conf, lshosts will always print the output as a floating point number, and in some versions of LSF the parameter is defined as 'KB' in lsf.conf upon installation.

Try searching for any definitions of the parameter in lsf.conf and commenting them all out so that the parameter is left undefined, I think in that case it defaults to printing it out as an integer in megabytes.

(Don't ask me why it works this way)

Squirrel
  • 2,262
  • 2
  • 18
  • 29