
    çg@
                         d dl Z d dlZd dlZddlmZmZmZ ddlmZ d Z	d Z
d Zd Zd	 Zed
k    r e             dS dS )    N   )startfinalize_select_backend)set_command_linec            	         t          j        ddt           j                  } |                     ddt          d           |                     dd	t          d
d dg           |                     ddt          ddddg           |                     ddt          dddg           |                     ddt          dd d dg           |                                 \  }}||fS )NzBThe proton command utility for profiling scripts and pytest tests.z
    proton [options] script.py [script_args] [script_options]
    proton [options] pytest [pytest_args] [script_options]
    python -m triton.profiler.proton [options] script.py [script_args] [script_options]
)descriptionusageformatter_classz-nz--namezName of the profiling session)typehelpz-bz	--backendzProfiling backendcupti)r   r   defaultchoicesz-cz	--contextzProfiling contextshadowpythonz-dz--datazProfiling datatreez-kz--hookzProfiling hooktriton)argparseArgumentParserRawTextHelpFormatteradd_argumentstrparse_known_args)parserargstarget_argss      R/var/www/html/ai-engine/env/lib/python3.11/site-packages/triton/profiler/proton.pyparse_argumentsr      s   $X a 24 4 4F hS7VWWW
k:MW[fmenooo
k:MW_!)8 4  6 6 6
hS7GQWbhaijjj
hS7GQU`dfn_oppp//11D+    c                 H    t           j                            |           dk    S )Npytest)ospathbasename)scripts    r   	is_pytestr'      s    7F##x//r    c                    t           j                            |           }ddd|dt          t          j        t          i}t          j        }| g|z   t          _        	 t          |d          5 }t          |	                                |d          }d d d            n# 1 swxY w Y   t          ||           n)# t          $ r}t          d|            Y d }~nd }~ww xY w|t          _        d S # |t          _        w xY w)N__name____main____file____builtins__rbexecz.An error occurred while executing the script: )r#   r$   abspathr,   sysr)   argvopencompilereadr.   	Exceptionprint)r&   r   script_pathclean_globalsoriginal_argvfilecodees           r   execute_as_mainr=      sF   '//&))K 	JKc	M HMx$CH!+t$$ 	=499;;V<<D	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	=T=!!!! D D DBqBBCCCCCCCCD !=    sT   B7 +$BB7 BB7 "B#B7 6C. 7
CCC. CC. .C<c                    | j         r| j         nt                      }t          | j        | j        | j        || j                   t                       |d         }t          |          dk    r
|dd          ng }t          |          rdd l
}|                    |           nt          ||           t                       d S )N)contextdatabackendhookr   r   )rA   r   r   namer?   r@   rB   r   lenr'   r"   mainr=   r   )r   r   rA   r&   script_argsr"   s         r   run_profilingrG   5   s    "lAdll0A0AG	$)T\	7QUQZ[[[[ ^F%(%5%5%9%9+abb//rK -K    ,,,JJJJJr    c                  H    t                      \  } }t          | |           d S )N)r   rG   )r   r   s     r   rE   rE   H   s(    '))D+$$$$$$r    r*   )r   r0   r#   profiler   r   r   flagsr   r   r'   r=   rG   rE   r)    r    r   <module>rL      s     



 				 5 5 5 5 5 5 5 5 5 5 # # # # # #  "0 0 0! ! !0  &% % %
 zDFFFFF r    