code: def test__native_dist_model_warning_index_less_localrank(
      local_rank, world_size
  ):
      assert _NativeDistModel.create_from_context() is None
  
      dist.init_process_group(
          "nccl",
          "tcp://0.0.0.0:2222",
          world_size=world_size,
          rank=local_rank,
      )
      dist.barrier()
      # We deliberately incorrectly set cuda device to 0
      torch.cuda.set_device(0)
  
      model = _NativeDistModel.create_from_context()
      assert isinstance(
          model, _NativeDistModel
      ), f"{type(model)} vs _NativeDistModel"
  
      if local_rank == 1:
          with pytest.warns(
              UserWarning,
              match=r"Current device index is less than current local rank.",
          ):
              model.device()
  
      dist.destroy_process_group()
  
imports: import os
  import pytest
  import torch
  import torch.distributed
  from ignite.distributed.comp_models import has_native_dist_support
label_desc: Use image node_id 22 for calling a global function with example usage: test__native_dist_model_warning_index_less_localrank(local_rank, world_size) without return types