class_docstr: LSF Utilities
class_docstr_tok: ["LSF","Utilities"]
docstr: Returns the number of hardware threads.
docstr_tok: ["Returns","the","number","of","hardware","threads","."]
code: def get_num_threads():
      """Returns the number of hardware threads."""
      lscpu_cmd = get_remote_command(
          LSFUtils._LSCPU_CMD, host=LSFUtils.get_compute_hosts()[0]
      )
      output = io.StringIO()
      exit_code = safe_shell_exec.execute(
          lscpu_cmd, stdout=output, stderr=output
      )
      if exit_code != 0:
          raise RuntimeError(
              "{cmd} failed with exit code {exit_code}".format(
                  cmd=lscpu_cmd, exit_code=exit_code
              )
          )
      return int(
          yaml.safe_load(output.getvalue())[LSFUtils._THREAD_KEY]
      )
  
file_path: horovod/horovod/runner/util/lsf.py
imports: import io
  import os
  import yaml
  from horovod.common.util import _cache
  from horovod.runner.common.util import safe_shell_exec
  from horovod.runner.util.remote import get_remote_command
label_desc: Use image node_id 7 for calling the LSFUtils obj's underlying member method code with example usage: obj.get_num_threads() and returns: int