Skip to content

Commit

Permalink
Conform to Python formatting
Browse files Browse the repository at this point in the history
Signed-off-by: coleramos425 <[email protected]>
  • Loading branch information
coleramos425 committed Aug 15, 2023
1 parent 4aa3384 commit dc849b2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/omniperf_analyze/omniperf_analyze.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@

archConfigs = {}


################################################
# Helper Functions
################################################
Expand Down
15 changes: 10 additions & 5 deletions src/utils/csv_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@


def kernel_name_shortener(workload_dir, level):

def shorten_file(df, level):
global cache

Expand All @@ -60,7 +59,9 @@ def shorten_file(df, level):

cmd = ["/opt/rocm/llvm/bin/llvm-cxxfilt", original_name]

proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
proc = subprocess.Popen(
cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE
)

demangled_name, e = proc.communicate()
demangled_name = str(demangled_name, "UTF-8").strip()
Expand All @@ -69,7 +70,9 @@ def shorten_file(df, level):
new_name = ""
matches = ""

names_and_args = re.compile(r"(?P<name>[( )A-Za-z0-9_]+)([ ,*<>()]+)(::)?")
names_and_args = re.compile(
r"(?P<name>[( )A-Za-z0-9_]+)([ ,*<>()]+)(::)?"
)

# works for name Kokkos::namespace::init_lock_array_kernel_threadid(int) [clone .kd]
if names_and_args.search(demangled_name):
Expand All @@ -95,7 +98,9 @@ def shorten_file(df, level):
# closing '>' is to be taken account by the while loop
if name[1].count(">") == 0:
if current_level < level:
if not (current_level == level - 1 and name[1].count("<") > 0):
if not (
current_level == level - 1 and name[1].count("<") > 0
):
new_name += name[1]
current_level += name[1].count("<")

Expand All @@ -117,7 +122,7 @@ def shorten_file(df, level):
df[columnName] = df[columnName].map(cache)

return df

# Only shorten if valid shortening level
if level < 5:
for fpath in glob.glob(workload_dir + "/*.csv"):
Expand Down

0 comments on commit dc849b2

Please sign in to comment.