code: def test_amp_gpu_ddp_slurm_managed(tmpdir):
      """Make sure DDP + AMP work."""
      # simulate setting slurm flags
      model = AMPTestModel()
  
      # exp file to get meta
      logger = tutils.get_default_logger(tmpdir)
  
      # exp file to get weights
      checkpoint = tutils.init_checkpoint_callback(logger)
  
      # fit model
      trainer = Trainer(
          default_root_dir=tmpdir,
          max_epochs=1,
          accelerator="gpu",
          devices=[0],
          strategy="ddp_spawn",
          precision="16-mixed",
          callbacks=[checkpoint],
          logger=logger,
      )
      trainer.fit(model)
      assert isinstance(
          trainer.strategy.cluster_environment, SLURMEnvironment
      )
  
file_path: pytorch-lightning/tests/tests_pytorch/models/test_amp.py
imports: import os
  from unittest import mock
  import pytest
  import torch
  from lightning.fabric.plugins.environments import SLURMEnvironment
  from lightning.pytorch import Trainer
  from lightning.pytorch.demos.boring_classes import BoringModel, RandomDataset
  from torch.utils.data import DataLoader
  import tests_pytorch.helpers.utils
  from tests_pytorch.helpers.runif import RunIf
label_desc: Use image node_id 3 for calling a global function with example usage: test_amp_gpu_ddp_slurm_managed(tmpdir) without return types