
    Χg_                     0   d Z ddlZddlZddlZddlmZ g dZddlT eej        z  Zej                                         	 ddl	m
Z
mZmZmZm	Z	mZmZ ej        dk    sej        d	k    rd
ad
hZndadd
hZd Zd Zd ZdeddfdZdefdZ e             dS )a  torch.multiprocessing is a wrapper around the native :mod:`multiprocessing` module.

It registers custom reducers, that use shared memory to provide shared
views on the same data in different processes. Once the tensor/storage is moved
to shared_memory (see :func:`~torch.Tensor.share_memory_`), it will be possible
to send it to other processes without making any copies.

The API is 100% compatible with the original module - it's enough to change
``import multiprocessing`` to ``import torch.multiprocessing`` to have all the
tensors sent through the queues or shared via other mechanisms, moved to shared
memory.

Because of the similarity of APIs we do not document most of this package
contents, and we recommend referring to very good docs of the original module.
    N   )init_reductions)set_sharing_strategyget_sharing_strategyget_all_sharing_strategies)*)ENV_VAR_PARALLEL_STARTProcessContextProcessExitedExceptionProcessRaisedExceptionspawnSpawnContextstart_processesdarwinwin32file_systemfile_descriptorc                      | t           v sJ | adS )zSet the strategy for sharing CPU tensors.

    Args:
        new_strategy (str): Name of the selected strategy. Should be one of
            the values returned by :func:`get_all_sharing_strategies()`.
    N)_all_sharing_strategies_sharing_strategy)new_strategys    Z/var/www/html/ai-engine/env/lib/python3.11/site-packages/torch/multiprocessing/__init__.pyr   r   <   s"     22222$    c                      t           S )z4Return the current strategy for sharing CPU tensors.)r    r   r   r   r   H   s    r   c                      t           S )zAReturn a set of sharing strategies supported on a current system.)r   r   r   r   r   r   M   s    ""r   namereturnc                 D    t           j                            |            dS )zcSet the name of the current thread.

    Args:
        name (str): Name of the current thread.
    N)torch_C_set_thread_name)r   s    r   r"   r"   R   s      
Hd#####r   c                  >    t           j                                        S )z_Get the name of the current thread.

    Returns:
        str: Name of the current thread.
    )r    r!   _get_thread_namer   r   r   r$   r$   [   s     8$$&&&r   )__doc__multiprocessingsysr    
reductionsr   __all__r!   _multiprocessing_initr   r	   r
   r   r   r   r   platformr   r   r   r   r   strr"   r$   r   r   r   <module>r-      s        



  ' ' ' ' ' ' Y
X
X     ?" "
         F                  <8s|w66%,o)0-@	% 	% 	%  
# # #
$3 $4 $ $ $ $'# ' ' ' '      r   