Skip to content

Commit f4d7f58

Browse files
committed
add omp_region_data property
1 parent c56c3f3 commit f4d7f58

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

pypop/prv.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,13 @@ def __getattr__(self, attr):
119119

120120
return super().__getattribute__(attr)
121121

122+
@property
123+
def omp_region_data(self):
124+
if self._omp_region_data is None:
125+
self.profile_openmp_regions(no_progress=True)
126+
127+
return self._omp_region_data
128+
122129
@staticmethod
123130
def _generate_binaryfile_name(prvfile):
124131
return prvfile + ".bincache"
@@ -566,12 +573,12 @@ def openmp_region_summary(self, by_location=False):
566573
else:
567574
fingerprint_key = "Region Function Fingerprint"
568575

569-
runtime = self.metadata.ns_elapsed
570-
nproc = len(set(self._omp_region_data["Rank"]))
576+
runtime = self.metadata.elapsed_seconds * 1e-9
577+
nproc = len(set(self.omp_region_data["Rank"]))
571578

572579
self.profile_openmp_regions()
573580

574-
summary = self._omp_region_data.groupby(fingerprint_key).agg(
581+
summary = self.omp_region_data.groupby(fingerprint_key).agg(
575582
**{
576583
"Instances": ("Maximum Computation Time", "count"),
577584
"Total Parallel Inefficiency Contribution": (
@@ -585,13 +592,13 @@ def openmp_region_summary(self, by_location=False):
585592
"Average Parallel Efficiency": (
586593
"Parallel Efficiency",
587594
lambda x: np.average(
588-
x, weights=self._omp_region_data.loc[x.index, "Region Length"]
595+
x, weights=self.omp_region_data.loc[x.index, "Region Length"]
589596
),
590597
),
591598
"Average Load Balance": (
592599
"Load Balance",
593600
lambda x: np.average(
594-
x, weights=self._omp_region_data.loc[x.index, "Region Length"],
601+
x, weights=self.omp_region_data.loc[x.index, "Region Length"],
595602
),
596603
),
597604
"Accumulated Region Time": ("Region Length", np.sum),

0 commit comments

Comments
 (0)