o
    h                     @   sT   U d Z ddlmZ ddlmZ ddlmZ daeej	 e
d< deej	 fdd	ZdS )
au  
Manages process groups for distributed compilation in TorchDynamo.

This module handles the initialization and management of process groups used for
distributed compilation. Key features:

- Lazy initialization of compilation process groups
- Only creates groups when distributed mode is enabled and available
- Integrates with compiler_collectives configuration setting
- Provides a single global process group for compilation coordination

The process group is created only when needed and if the distributed environment
is properly initialized, making it safe to import and use this module even in
non-distributed scenarios.
    )OptionalN   )config_COMPILE_PGreturnc                   C   s4   t jrt rt rtd u rtjjddatS d S )Npt2_compile_pg)pg_tag)r   enable_compiler_collectivesdistis_availableis_initializedr   distributed_c10d_new_group_with_tag r   r   m/var/www/html/construction_image-detection-poc/venv/lib/python3.10/site-packages/torch/_dynamo/distributed.pyget_compile_pg   s   r   )__doc__typingr   torch.distributeddistributedr
    r   r   ProcessGroup__annotations__r   r   r   r   r   <module>   s    