
    Vpf
                        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edk    r ed            ej	        d          Z
 ej        d          Ze                    ded	           e                    d
dd           e                    dedd           e                                Zej                            ej                                      d          d          Zej                            ej                            ej                  d          d          Zej                            ej                            ej                  d          d          Z ee
e          sJ e
dddddddej         dej         gZ ede d            ej        eej        ej                  Z e !                                  ej"        d          Z# e$ej         dd          5 Z% e$e e d d          5 Z& e j'        e&          Z(e(D ]dZ)e)d!         Z* e+e)d"                   Z,e#-                    e*          Z.e.2e%/                    d#e.0                    d$           d%e,d&z   d'           e	 ddd           n# 1 swxY w Y   ddd           n# 1 swxY w Y   d(e d)e d*Z1 ej2        e1d+,           dS dS )-    N__main__zScript to convert NVIDIA Nsys Profiles to the .pbtxt format. This format is readable by XLA's Profile Guided Latency Estimator. Usage: pgo_nsys_converter.py --profile_path <path the nsys profile> --pgle_output_path <path to output .pbtxt>nsysz9Tool to convert NVIDIA Nsys Profiles to the .pbtxt format)descriptionz--profile_pathzpath to nsys profile)typehelpz--post_processzApost process pbtxt to get minimum cost value for each instruction
store_true)r   actionz--pgle_output_pathzoutput directoryz)/opt/paxml/workspace/lhs_pbtxt/temp.pbtxt)r   r   default. statsz--force-overwritetruez--force-exportz--reportnvtxkernsumz-oz,
    ******Starting stats command******
    )stdoutstderrzhlo_op=(.*)#w)newlinez.pbtxt_nvtxkernsum.csvz
NVTX RangezAvg (ns)zcosts { name: "   z" cost_us: g     @@z }
zrm z/*.sqlite; rm z/*.csvT)shell)3csvresysargparseosshutil
subprocess__name__printwhich	nsys_pathArgumentParserparseradd_argumentstr
parse_argsargspathbasenamepgle_output_path	partitionpgle_filenamejoinsplitpgle_folderprofile_pathprofile_folder
isinstancestats_commandPopenr   r   procwaitcompilethunk_reopen	protofilecsvfile
DictReaderreaderrownamefloattime_nssearchmwritegroupclean_commandcall     \/var/www/html/nettyfy-visnx/env/lib/python3.11/site-packages/jax/tools/pgo_nsys_converter.py<module>rJ      sF   


 				 



  				     z%  	y  z  z  zfl6"")"8"/jkkk&&S7MNNN&-p  zF  G  G  G*;M  XC  D  D  D					$'""4#899CCCHHK-RW]]4+@AA!DbII+7<<d.? @ @ CRHH.	Is	#	####g':FDTV\^hjw  }A  }N  zP  RV  [_  [p  Xr  s-% 		 	 	    
	-
3:	N	N	N$))+++RZ''(tt$&R888 _I4;EEEErRRR _V](( 	_ 	_C\"$E#j/**'ood##!]OO]qwwqzz]]gPVFV]]]^^^	__ _ _ _ _ _ _ _ _ _ _ _ _ _ __ _ _ _ _ _ _ _ _ _ _ _ _ _ _ JIIkIII-*/-t,,,,,,O s7   ,J?A8J8JJ	JJ	JJ"J