
    <c!                         d dl Z d dlZd dlZd dlZd dlZd dlZd dlZd dlZd dl	Z	d dl
mZmZmZmZmZmZmZmZ ej                            ej        d          dd          Zdad Zd Ze j        	 	 	 d	d            ZdS )
    N)ObjectIDObjectNotAvailablePlasmaBufferPlasmaClientconnectPlasmaObjectExistsPlasmaObjectNotFoundPlasmaStoreFull
tensorflowplasma_op.soc                  B    dd l } |                     t                    ad S )Nr   )r   load_op_libraryTF_PLASMA_OP_PATHtf_plasma_op)tfs    .lib/python3.11/site-packages/pyarrow/plasma.pyload_plasma_tensorflow_opr   /   s&    %%&788LLL    c                     	 dd l } t          d| j        z              t          d           t          j                            t          j                            t                              }t          j                            |dd          }t          j                            |dd          }| j	        
                                }t          j        dk    rdd	g|z   }d
ddd|d|ddt          j                    z   g	}|d t          j                    D             z  }|g dz  }||z  }|| j	                                        z  }|dgz  }| j                                        r|dgz  }t          dt'          |          z              t)          j        |           |                     t.                    ad S # t2          $ r Y d S w xY w)Nr   zTensorFlow version: z!Compiling Plasma TensorFlow Op...r   zplasma_op.ccr   darwinz
-undefineddynamic_lookupzg++z
-std=c++17z-gz-sharedz-oz-DNDEBUGz-Ic                     g | ]}d |z   S )z-L ).0dirs     r   
<listcomp>z.build_plasma_tensorflow_op.<locals>.<listcomp>F   s    <<<ss
<<<r   )z-lplasmaz-larrow_pythonz-larrowz-fPICz-O2z-DGOOGLE_CUDAzRunning command )r   print__version__ospathdirnamerealpath__file__join	sysconfigget_compile_flagssysplatformpaget_includeget_library_dirsget_link_flagstestis_built_with_cudastr
subprocess
check_callr   r   r   ImportError)r   dir_pathcc_pathso_path	tf_cflagscmds         r   build_plasma_tensorflow_opr8   5   s   =$r~5666 	12227??27#3#3H#=#=>>',,x~FF',,x~FFL2244	<8##%'789DIlD)WWj$1A1A*AC<<b&9&;&;<<<<AAAAyr|**,,,w7%%'' 	%O$$C 3s88+,,,c"""))*;<<+    s   F: :
GGFc              #     K   t          j        dt                     |r|rt          d          t	          j        d          }	 t          j                            |d          }t          j                            t          j
        d         d          }t          j                            |          s+t          j                            t          j        dd          }|d	|d
t          |           g}	|r|	d|gz  }	|r|	dgz  }	||	d|gz  }	d}
d}|r3g d|	z   }	t          j        |	|
|          }t#          j        d           n`|r3ddg|	z   }	t          j        |	|
|          }t#          j        d           n+t          j        |	|
|          }t#          j        d           |                                }|t)          d|fz            ||fV  |                                |                                 t-          j        |           dS # |                                |                                 t-          j        |           w xY w)a  
    DEPRECATED: Start a plasma store process.

    .. deprecated:: 10.0.0
       Plasma is deprecated since Arrow 10.0.0. It will be removed
       in 12.0.0 or so.

    Parameters
    ----------
    plasma_store_memory : int
        Capacity of the plasma store in bytes.
    use_valgrind : bool
        True if the plasma store should be started inside of valgrind. If this
        is True, use_profiler must be False.
    use_profiler : bool
        True if the plasma store should be started inside a profiler. If this
        is True, use_valgrind must be False.
    plasma_directory : str
        Directory where plasma memory mapped files will be stored.
    use_hugepages : bool
        True if the plasma store should use huge pages.
    external_store : str
        External store to use for evicted objects.

    Yields
    -------
    plasma_store_name : str
        Name of the plasma store socket
    proc : subprocess.Popen
        Process ID of the plasma store process
    zLPlasma is deprecated since Arrow 10.0.0. It will be removed in 12.0.0 or so.z2Cannot use valgrind and profiler at the same time.ztest_plasma-)prefixzplasma.sockr   zplasma-store-serverbinz-sz-mz-dz-hNz-e)valgrindz--track-origins=yesz--leak-check=fullz--show-leak-kinds=allz!--leak-check-heuristics=stdstringz--error-exitcode=1)stdoutstderrg      ?r<   z--tool=callgrindg?z-plasma_store exited unexpectedly with code %d)warningswarnDeprecationWarning	Exceptiontempfilemkdtempr   r    r$   r)   __path__existsr'   r:   r/   r0   PopentimesleeppollRuntimeErrorkillshutilrmtree)plasma_store_memoryuse_valgrinduse_profilerplasma_directoryuse_hugepagesexternal_storetmpdirplasma_store_nameplasma_store_executablecommandstdout_filestderr_fileprocrcs                 r   start_plasma_storer]   R   s     H M	  
  N NLMMM^444F/GLL??"$',,KN1#3 #3w~~566 	:&(gll
E#8': ':#**0113  	0.//G 	vG%n--G 	- - -
 077G #GK+68 8 8DJsOOOO 	!#56@G#GK+68 8 8DJsOOOO#GK+68 8 8DJsOOOYY[[>  ),.5 1 2 2 2  %%%%99;;IIKKKf 99;;IIKKKfs   FH >I)FFNFN)
contextlibr   pyarrowr)   rM   r0   r'   rC   rH   r?   pyarrow._plasmar   r   r   r   r   r   r	   r
   r    r$   rE   r   r   r   r8   contextmanagerr]   r   r   r   <module>rb      sG  &     				          



   . . . . . . . . . . . . . . . . . . . . GLLQ~NN  9 9 9= = =: 8=<A&*[ [ [ [ [ [r   