code: def check_binary_elementwise_handler_with_int(
      rank, world_size, port, op, other_dim, model_cls
  ):
      disable_existing_loggers()
      launch(
          config={},
          rank=rank,
          world_size=world_size,
          host="localhost",
          port=port,
          backend="nccl",
      )
  
      physical_mesh_id = torch.arange(0, 4)
      mesh_shape = (2, 2)
      device_mesh = DeviceMesh(
          physical_mesh_id, mesh_shape, init_process_group=True
      )
      if model_cls == BEOpModelWithNodeConst:
          model = model_cls(op).cuda()
      else:
          model = model_cls(op, other_dim).cuda()
      x1 = torch.rand(4, 4).cuda()
      # the index of binary-elementwise node in computation graph
      node_index = 1
      # strategy number of binary-elementwise node
      strategy_number = 9
      # construct input args
      input_args = [x1]
      # construct meta arg names
      meta_arg_names = ["x1"]
      numerical_test_for_node_strategy(
          model=model,
          device_mesh=device_mesh,
          node_index=node_index,
          strategy_number=strategy_number,
          input_args=input_args,
          meta_arg_names=meta_arg_names,
      )
      tracer = ColoTracer(bias_addition_split=True)
      meta_args = {"x1": torch.rand(4, 4).to("meta")}
      graph = tracer.trace(model, meta_args=meta_args)
      gm = ColoGraphModule(model, graph)
      shape_prop_pass(gm, *meta_args.values())
  
      if model_cls == BEOpModelWithNodeConst:
          op_node = list(graph.nodes)[2]
      else:
          op_node = list(graph.nodes)[1]
      strategies_vector = StrategiesVector(op_node)
  
      # build handler
      handler = BinaryElementwiseHandler(
          node=op_node,
          device_mesh=device_mesh,
          strategies_vector=strategies_vector,
      )
  
      # check operation data mapping
      mapping = handler.get_operation_data_mapping()
  
      assert mapping["input"].name == "x1"
      assert mapping["input"].data.is_meta
      assert mapping["input"].data.shape == torch.Size([4, 4])
      assert mapping["input"].type == OperationDataType.ARG
      assert mapping["input"].logical_shape == torch.Size([4, 4])
  
      assert mapping["output"].name == str(op_node)
      assert mapping["output"].data.is_meta
      assert mapping["output"].data.shape == torch.Size([4, 4])
      assert mapping["output"].type == OperationDataType.OUTPUT
      assert mapping["output"].logical_shape == torch.Size([4, 4])
  
      strategies_vector = handler.register_strategy(
          compute_resharding_cost=False
      )
      strategy_name_list = [val.name for val in strategies_vector]
  
      # one strategy will be converted to different physical sharding spec
      assert len(strategy_name_list) == 9
  
      # check if the sharding strategy is correct
      assert (
          "[S0, S1] = [S0, S1] <binary-elementwise-op> [S0, S1]"
          in strategy_name_list
      )
      assert (
          "[S1, S0] = [S1, S0] <binary-elementwise-op> [S1, S0]"
          in strategy_name_list
      )
      assert (
          "[S01, R] = [S01, R] <binary-elementwise-op> [S01, R]"
          in strategy_name_list
      )
      assert (
          "[R, S01] = [R, S01] <binary-elementwise-op> [R, S01]"
          in strategy_name_list
      )
      assert (
          "[S0, R] = [S0, R] <binary-elementwise-op> [S0, R]"
          in strategy_name_list
      )
      assert (
          "[R, S0] = [R, S0] <binary-elementwise-op> [R, S0]"
          in strategy_name_list
      )
      assert (
          "[S1, R] = [S1, R] <binary-elementwise-op> [S1, R]"
          in strategy_name_list
      )
      assert (
          "[R, S1] = [R, S1] <binary-elementwise-op> [R, S1]"
          in strategy_name_list
      )
      assert (
          "[R, R] = [R, R] <binary-elementwise-op> [R, R]"
          in strategy_name_list
      )
  
      for strategy in strategies_vector:
          input_sharding_spec = strategy.get_sharding_spec_by_name("x1")
          output_sharding_spec = strategy.get_sharding_spec_by_name(
              str(op_node)
          )
  
          # make sure the sharding spec is the same for input and output
          assert (
              input_sharding_spec.sharding_sequence
              == output_sharding_spec.sharding_sequence
          )
  
imports: import pytest
  import torch
  import torch.nn
  from colossalai._analyzer.fx.graph_module import ColoGraphModule
  from colossalai._analyzer.fx.passes.shape_prop import shape_prop_pass
  from colossalai._analyzer.fx.tracer.tracer import ColoTracer
  from colossalai.auto_parallel.tensor_shard.node_handler import BinaryElementwiseHandler
  from colossalai.auto_parallel.tensor_shard.sharding_strategy import OperationData, OperationDataType, StrategiesVector
  from colossalai.device.device_mesh import DeviceMesh
  from colossalai.initialize import launch
  from colossalai.logging import disable_existing_loggers
  from colossalai.testing import parameterize, rerun_if_address_is_in_use, run_on_environment_flag, spawn
  from tests.test_auto_parallel.test_tensor_shard.test_node_handler.utils import numerical_test_for_node_strategy
label_desc: Use image node_id 2 for calling a global function with example usage: check_binary_elementwise_handler_with_int(rank, world_size, port, op, other_dim, model_cls) without return types