code: def test_profileit_cuda(get_dataset):
      warnings.filterwarnings(
          "ignore", ".*arguments of DataFrame.drop.*"
      )
  
      dataset = get_dataset(name="Cora")
      data = dataset[0].cuda()
      model = GraphSAGE(
          dataset.num_features,
          hidden_channels=64,
          num_layers=3,
          out_channels=dataset.num_classes,
      ).cuda()
      optimizer = torch.optim.Adam(model.parameters(), lr=0.01)
  
      @profileit("cuda")
      def train(model, x, edge_index, y):
          model.train()
          optimizer.zero_grad()
          out = model(x, edge_index)
          loss = F.cross_entropy(out, y)
          loss.backward()
          return float(loss)
  
      stats_list = []
      for epoch in range(5):
          _, stats = train(model, data.x, data.edge_index, data.y)
          assert stats.time > 0
          assert stats.max_allocated_gpu > 0
          assert stats.max_reserved_gpu > 0
          assert stats.max_active_gpu > 0
          assert stats.nvidia_smi_free_cuda > 0
          assert stats.nvidia_smi_used_cuda > 0
  
          if epoch >= 2:  # Warm-up
              stats_list.append(stats)
  
      stats_summary = get_stats_summary(stats_list)
      assert stats_summary.time_mean > 0
      assert stats_summary.time_std > 0
      assert stats_summary.max_allocated_gpu > 0
      assert stats_summary.max_reserved_gpu > 0
      assert stats_summary.max_active_gpu > 0
      assert stats_summary.min_nvidia_smi_free_cuda > 0
      assert stats_summary.max_nvidia_smi_used_cuda > 0
  
file_path: pytorch_geometric/test/profile/test_profile.py
imports: import os
  import os.path
  import warnings
  import pytest
  import torch
  import torch.nn.functional
  from torch_geometric.nn import GraphSAGE
  from torch_geometric.profile import get_stats_summary, profileit, rename_profile_file, timeit
  from torch_geometric.profile.profile import torch_profile, xpu_profile
  from torch_geometric.testing import onlyCUDA, onlyLinux, onlyOnline, onlyXPU, withCUDA, withPackage
label_desc: Use image node_id 2 for calling a global function with example usage: test_profileit_cuda(get_dataset) and returns: float