code: def get_submesh_choices(num_hosts, num_devices_per_host, mode="new"):
      submesh_choices = []
      i = 1
      p = -1
      while i <= num_devices_per_host:
          i *= 2
          p += 1
      assert pow(2, p) == num_devices_per_host, (
          "Only supports the cases where num_devices_per_host is power of two, "
          f"while now num_devices_per_host = {num_devices_per_host}"
      )
      if mode == "alpa":
          for i in range(p + 1):
              submesh_choices.append((1, pow(2, i)))
          for i in range(2, num_hosts + 1):
              submesh_choices.append((i, num_devices_per_host))
      elif mode == "new":
          for i in range(p // 2 + 1):
              for j in range(i, p - i + 1):
                  submesh_choices.append((pow(2, i), pow(2, j)))
      return submesh_choices
  
imports: from math import pow
  import numpy
label_desc: Use image node_id 1 for calling a global function with example usage: get_submesh_choices(num_hosts, num_devices_per_host, mode) and returns: submesh_choices