code: def cuda_sleep() -> Callable:
      # Warm-up CUDA.
      torch.empty(1, device="cuda")
  
      # From test/test_cuda.py in PyTorch.
      start = torch.cuda.Event(enable_timing=True)
      end = torch.cuda.Event(enable_timing=True)
      start.record()
      torch.cuda._sleep(1000000)
      end.record()
      end.synchronize()
      cycles_per_ms = 1000000 / start.elapsed_time(end)
  
      return functools.partial(
          cuda_sleep_impl, cycles_per_ms=cycles_per_ms
      )
  
file_path: fairscale/tests/nn/pipe_process/conftest.py
imports: import functools
  import os
  from typing import Any, Callable
  import pytest
  import torch
  from fairscale.nn.model_parallel import destroy_model_parallel
label_desc: Use image node_id 3 for calling a global function with example usage: cuda_sleep() and returns: functools