def suggested_max_num_workers(local_world_size: int) -> int:
    """Suggests an upper bound of ``num_workers`` to use in a PyTorch :class:`~torch.utils.data.DataLoader` based on
    the number of CPU cores available on the system and the number of distributed processes in the current machine.

    Args:
        local_world_size: The number of distributed processes running on the current machine. Set this to the number
            of devices configured in Fabric/Trainer.

    """
    if local_world_size < 1:
        raise ValueError(f"`local_world_size` should be >= 1, got {local_world_size}.")
    cpu_count = _num_cpus_available()
    return max(1, cpu_count // local_world_size - 1)  # -1 to leave some resources for main process
Suggests an upper bound of ``num_workers`` to use in a PyTorch :class:`~torch.utils.data.DataLoader` based on
    the number of CPU cores available on the system and the number of distributed processes in the current machine.

    Args:
        local_world_size: The number of distributed processes running on the current machine. Set this to the number
            of devices configured in Fabric/Trainer.

    
src/lightning/fabric/utilities/data.py