class_docstr: Accelerator for NVIDIA CUDA devices.
class_docstr_tok: ["Accelerator","for","NVIDIA","CUDA","devices","."]
code: def set_nvidia_flags(local_rank: int) -> None:
      # set the correct cuda visible devices (using pci order)
      os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"
      all_gpu_ids = ",".join(str(x) for x in range(num_cuda_devices()))
      devices = os.getenv("CUDA_VISIBLE_DEVICES", all_gpu_ids)
      _log.info(
          f"LOCAL_RANK: {local_rank} - CUDA_VISIBLE_DEVICES: [{devices}]"
      )
  
imports: import logging
  import os
  import shutil
  import subprocess
  from typing import Any, Dict, List, Optional, Union
  import torch
  from typing_extensions import override
  import lightning.pytorch
  from lightning.fabric.accelerators import _AcceleratorRegistry
  from lightning.fabric.accelerators.cuda import _check_cuda_matmul_precision, _clear_cuda_memory, num_cuda_devices
  from lightning.fabric.utilities.device_parser import _parse_gpu_ids
  from lightning.fabric.utilities.types import _DEVICE
  from lightning.pytorch.accelerators.accelerator import Accelerator
  from lightning.pytorch.utilities.exceptions import MisconfigurationException
label_desc: Use image node_id 3 for calling the CUDAAccelerator obj's underlying member method code with example usage: obj.set_nvidia_flags(local_rank) without return types