code: def check_comm(size, rank, prev_rank, next_rank, logger):
      dtype = torch.float32
      device = get_current_device()
      tensor_shape = (BATCH_SIZE, SEQ_LENGTH, HIDDEN_SIZE)
      grad_shape = (BATCH_SIZE, SEQ_LENGTH, HIDDEN_SIZE)
      tensor = torch.randn(tensor_shape, dtype=dtype, device=device)
      dist.all_reduce(tensor)
      grad = torch.randn(grad_shape, dtype=dtype, device=device)
      dist.all_reduce(grad)
      check_forward(tensor, rank, logger)
      check_backward(grad, rank, logger)
      check_forward_backward(tensor, grad, rank, logger)
  
file_path: ColossalAI/tests/test_legacy/test_trainer/test_pipeline/test_p2p.py
imports: import pytest
  import torch
  import torch.distributed
  from colossalai.legacy.communication import recv_backward, recv_forward, send_backward, send_backward_recv_forward, send_forward, send_forward_recv_backward
  from colossalai.legacy.context.parallel_mode import ParallelMode
  from colossalai.legacy.core import global_context
  from colossalai.legacy.initialize import launch
  from colossalai.logging import get_dist_logger
  from colossalai.testing import rerun_if_address_is_in_use, spawn
  from colossalai.utils import get_current_device
label_desc: Use image node_id 5 for calling a global function with example usage: check_comm(size, rank, prev_rank, next_rank, logger) without return types