code: def test_set_cuda_device(set_device_mock, tmpdir):
      model = BoringModel()
      trainer = Trainer(
          default_root_dir=tmpdir,
          fast_dev_run=True,
          accelerator="gpu",
          devices=1,
          enable_checkpointing=False,
          enable_model_summary=False,
          enable_progress_bar=False,
      )
      trainer.fit(model)
      set_device_mock.assert_called_once()
  
file_path: pytorch-lightning/tests/tests_pytorch/accelerators/test_gpu.py
imports: from unittest import mock
  import pytest
  import torch
  from lightning.pytorch import Trainer
  from lightning.pytorch.accelerators import CUDAAccelerator
  from lightning.pytorch.accelerators.cuda import get_nvidia_gpu_stats
  from lightning.pytorch.demos.boring_classes import BoringModel
  from tests_pytorch.helpers.runif import RunIf
label_desc: Use image node_id 3 for calling a global function with example usage: test_set_cuda_device(set_device_mock, tmpdir) without return types