[Openmp-commits] [PATCH] D143702: [NFC] Convert openmp/runtime/tools/summarizeStats.py to python 3 syntax

serge via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Mon Feb 13 08:45:24 PST 2023


serge-sans-paille added a comment.

Some extra call to `list` are correct wrt py2/py3 compat but are actually not needed, let's not introduce them at all.



================
Comment at: openmp/runtime/tools/summarizeStats.py:175
+    data[[k for k in list(data.keys()) if k != countField]] /= factor
 
 
----------------
I think this `list` call here is actually not needed.


================
Comment at: openmp/runtime/tools/summarizeStats.py:195
     tmp_log = data * 0
-    for key in data.keys():
+    for key in list(data.keys()):
         if data[key] >= 1:
----------------
same here


================
Comment at: openmp/runtime/tools/summarizeStats.py:209
     ax.set_xticks(index + width * n / 2)
-    ax.set_xticklabels(tmp[s]['Total'].keys(), rotation=50, horizontalalignment='right')
+    ax.set_xticklabels(list(tmp[s]['Total'].keys()), rotation=50, horizontalalignment='right')
     plt.xlabel("OMP Constructs")
----------------
here I'm unsure.


================
Comment at: openmp/runtime/tools/summarizeStats.py:217
     stats = {}
-    for key in data.keys():
+    for key in list(data.keys()):
         if key == 'OMP_worker_thread_life':
----------------
not needed


================
Comment at: openmp/runtime/tools/summarizeStats.py:230
     nonCompKeys = {}
-    for key in data.keys():
+    for key in list(data.keys()):
         if key in ('OMP_critical', 'OMP_single', 'OMP_serial',
----------------
not neeed


================
Comment at: openmp/runtime/tools/summarizeStats.py:306
                 numThreads = tmp[s]['SampleCount']['Total_OMP_parallel']
-                for key in data.keys():
+                for key in list(data.keys()):
                     if key[0:5] == 'Total':
----------------
not needed


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D143702/new/

https://reviews.llvm.org/D143702



More information about the Openmp-commits mailing list