message: Prevent horovod tests from locking up
  Summary:
  Make sure that the thread pool has at least two threads.
  Ref T29087
  Test Plan: All tests pass on centos 8
  Reviewers: hakons, #tensorflow, #framework_ip_review_-_any_oss_or_third-party_code_use_has_been_approved
  Maniphest Tasks: T29087
diff: import subprocess
  import sys
  import os
  +import multiprocessing
  +
  +
  +def get_num_threads(num_processes):
  + return min(2, multiprocessing.cpu_count() // int(num_processes))
  def main():
  @@ -39,6 +44,7 @@ def main():
  # The buildbot runs as root, so let's allow that.
  command = [
  "mpirun", "--allow-run-as-root", "--tag-output", "-x",
  + "TF_NUM_INTEROP_THREADS=" + str(get_num_threads(num_processes)), "-x",
  "LD_LIBRARY_PATH=" + ld_library_path, "-np", num_processes,
  sys.executable, test_file
  ]
  