code: def test_record_stream_graph_negative():
      cycles_per_ms = _get_cycles_per_ms()
  
      g = rand_graph(10, 20, device=F.cpu())
      g.create_formats_()
      x = torch.ones(g.num_nodes(), 10).to(F.ctx())
      g1 = g.to(F.ctx())
      # this is necessary to initialize the cusparse handle
      result = OPS.copy_u_sum(g1, x)
      torch.cuda.current_stream().synchronize()
  
      stream = torch.cuda.Stream()
      results2 = torch.zeros_like(result)
  
      # Performs the computing in a background stream
      def perform_computing():
          with torch.cuda.stream(stream):
              g2 = g.to(F.ctx())
          torch.cuda.current_stream().wait_stream(stream)
          # omit record_stream will produce a wrong result
          # g2.record_stream(torch.cuda.current_stream())
          torch.cuda._sleep(
              int(50 * cycles_per_ms)
          )  # delay the computing
          results2.copy_(OPS.copy_u_sum(g2, x))
  
      perform_computing()
      with torch.cuda.stream(stream):
          # g3 will reuse g2's memory block, resulting a wrong result
          g3 = rand_graph(10, 20, device=F.ctx())
          g3.create_formats_()
      torch.cuda.current_stream().synchronize()
      assert not torch.equal(result, results2)
  
file_path: dgl/tests/python/pytorch/test_ffi-stream.py
imports: import unittest
  from statistics import mean
  import backend
  import dgl
  import dgl.ndarray
  import dgl.ops
  import numpy
  import torch
  from dgl import rand_graph
  from dgl._ffi.streams import _dgl_get_stream, to_dgl_stream_handle
  from dgl.utils import to_dgl_context
label_desc: Use image node_id 6 for calling a global function with example usage: test_record_stream_graph_negative() without return types