code: def test_tw_balanced_perf_host(self) -> None:
      self.topology = Topology(
          world_size=16, local_world_size=8, compute_device="cuda"
      )
      tables = [
          EmbeddingBagConfig(
              num_embeddings=64,
              embedding_dim=4 * (10 + i),
              name="table_" + str(i),
              feature_names=["feature_" + str(i)],
          )
          for i in range(4)
      ]
  
      self.model = TestSparseNN(tables=tables, weighted_tables=[])
      self.enumerator = EmbeddingEnumerator(
          topology=self.topology, batch_size=BATCH_SIZE
      )
      self.partitioner = GreedyPerfPartitioner()
      sharding_options = self.enumerator.enumerate(
          module=self.model, sharders=[TWRWSharder()]
      )
      for sharding_option in sharding_options:
          for shard in sharding_option.shards:
              shard.perf = Perf(
                  fwd_compute=40,
                  fwd_comms=30,
                  bwd_compute=20,
                  bwd_comms=10,
              )
              shard.storage = Storage(hbm=1000, ddr=1000)
          sharding_option.partition_by = PartitionByType.HOST.value
  
      candidate_topology = copy.deepcopy(self.topology)
      sharding_plan = self.partitioner.partition(
          proposal=sharding_options,
          storage_constraint=candidate_topology,
      )
      # pyre-ignore[16]
      solution_topology = self.partitioner._topology
  
      expected_ranks = {
          "table_0": [0, 1, 2, 3, 4, 5, 6, 7],
          "table_1": [8, 9, 10, 11, 12, 13, 14, 15],
          "table_2": [0, 1, 2, 3, 4, 5, 6, 7],
          "table_3": [8, 9, 10, 11, 12, 13, 14, 15],
      }
  
      ranks = {
          sharding_option.name: [
              shard.rank for shard in sharding_option.shards
          ]
          for sharding_option in sharding_plan
      }
      self.assertEqual(expected_ranks, ranks)
  
      for i in range(self.topology.world_size):
          self.assertEqual(
              solution_topology.devices[i].storage,
              # there are two shards allocated to each device
              self.topology.devices[i].storage - Storage(2000, 2000),
          )
          expected_perf = Perf(
              fwd_compute=80,
              fwd_comms=60,
              bwd_compute=40,
              bwd_comms=20,
          )
          self.assertEqual(
              solution_topology.devices[i].perf, expected_perf
          )
  
imports: import copy
  import unittest
  from typing import cast, List
  from unittest.mock import MagicMock
  from torch import nn
  from torchrec.distributed.embedding_types import EmbeddingComputeKernel
  from torchrec.distributed.embeddingbag import EmbeddingBagCollectionSharder
  from torchrec.distributed.planner.constants import BATCH_SIZE
  from torchrec.distributed.planner.enumerators import EmbeddingEnumerator
  from torchrec.distributed.planner.partitioners import GreedyPerfPartitioner, MemoryBalancedPartitioner, OrderedDeviceHardware
  from torchrec.distributed.planner.types import DeviceHardware, ParameterConstraints, PartitionByType, Perf, PlannerError, Shard, ShardingOption, Storage, Topology
  from torchrec.distributed.planner.utils import reset_shard_rank
  from torchrec.distributed.test_utils.test_model import TestSparseNN
  from torchrec.distributed.types import ModuleSharder, ShardingType
  from torchrec.modules.embedding_configs import EmbeddingBagConfig
label_desc: Use image node_id 5 for calling the TestGreedyPerfPartitioner obj's underlying member method code with example usage: obj.test_tw_balanced_perf_host() without return types