code: def test_neighborhood_sampling_large_sg_graph(gpubenchmark):
      """
      Use a large SG graph and set input args accordingly to test/benchmark
      returning a large result.
      """
      resource_handle = ResourceHandle()
      graph_props = GraphProperties(
          is_symmetric=False, is_multigraph=False
      )
  
      # FIXME: this graph is just a line - consider a better graph that exercises
      # neighborhood sampling better/differently
      device_srcs = cp.arange(1e6, dtype=np.int32)
      device_dsts = cp.arange(1, 1e6 + 1, dtype=np.int32)
      device_weights = cp.asarray([1.0] * int(1e6), dtype=np.float32)
  
      # start_list == every vertex is intentionally excessive
      start_list = device_srcs
      fanout_vals = np.asarray([1, 2], dtype=np.int32)
  
      sg = SGGraph(
          resource_handle=resource_handle,
          graph_properties=graph_props,
          src_or_offset_array=device_srcs,
          dst_or_index_array=device_dsts,
          weight_array=device_weights,
          store_transposed=True,
          renumber=False,
          do_expensive_check=False,
      )
  
      # Ensure the only memory used after the algo call is for the result, so
      # take a snapshot here.
      # Assume GPU 0 will be used and the test has
      # exclusive access and nothing else can use its memory while the test is
      # running.
      gc.collect()
      device = cp.cuda.Device(0)
      free_memory_before = device.mem_info[0]
  
      result = gpubenchmark(
          uniform_neighbor_sample,
          resource_handle,
          sg,
          start_list,
          fanout_vals,
          with_replacement=True,
          do_expensive_check=False,
      )
  
      assert type(result) is tuple
      assert isinstance(result[0], cp.ndarray)
      assert isinstance(result[1], cp.ndarray)
      assert isinstance(result[2], cp.ndarray)
      # Crude check that the results are accessible
      assert result[0][0].dtype == np.int32
      assert result[1][0].dtype == np.int32
      assert result[2][0].dtype == np.float32
  
      # FIXME: this is to help debug a leak in uniform_neighbor_sample, remove
      # once leak is fixed
      free_before_cleanup = device.mem_info[0]
      print(f"{free_before_cleanup=}")
  
      result_bytes = (
          len(result[0]) + len(result[1]) + len(result[2])
      ) * (32 // 8)
  
      # Cleanup the result - this should leave the memory used equal to the
      # amount prior to running the algo.
      del result
      gc.collect()
  
      # FIXME: this is to help debug a leak in uniform_neighbor_sample, remove
      # once leak is fixed
      free_after_cleanup = device.mem_info[0]
      print(f"{free_after_cleanup=}")
      actual_delta = free_after_cleanup - free_before_cleanup
      expected_delta = free_memory_before - free_before_cleanup
      leak = expected_delta - actual_delta
      print(
          f"  {result_bytes=} {actual_delta=} {expected_delta=} {leak=}"
      )
      assert (
          free_memory_before == device.mem_info[0]
      ) or mem_leak_assert_disabled
  
file_path: cugraph/python/pylibcugraph/pylibcugraph/tests/test_uniform_neighbor_sample.py
imports: import gc
  import pytest
  import cupy
  import numpy
  import cudf
  from pylibcugraph import SGGraph, ResourceHandle, GraphProperties
  from pylibcugraph import uniform_neighbor_sample
label_desc: Use image node_id 4 for calling a global function with example usage: test_neighborhood_sampling_large_sg_graph(gpubenchmark) without return types