Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/feelpp/benchmarking/reframe/regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,13 @@ def setPerfVars(self):
self.scalability_handler.getCustomPerformanceVariables(self.perf_variables)
)

@run_after('performance')
def restore_string_values(self):
for key, values in self._perfvalues.items():
val = values[0]
if isinstance(val, float) and hasattr(val, 'payload'):
values[0] = val.payload

@run_before("cleanup")
def removeDirectories(self):
if self.app_reader.config.scalability and self.app_reader.config.scalability.clean_directory:
Expand Down
29 changes: 27 additions & 2 deletions src/feelpp/benchmarking/reframe/scalability.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,26 @@
import reframe.utility.sanity as sn
import os, re,json
import os, re,json, numbers
from feelpp.benchmarking.reframe.config.configReader import TemplateProcessor


class StringNumber(float):
def __new__(cls, value):
obj = float.__new__(cls, float('nan'))
obj.payload = value
return obj
def __init__(self, value): self.value = value
def __repr__(self): return str(self.value)
def __str__(self): return str(self.value)
def __float__(self): return str(self.value)
def __int__(self): return str(self.value)
def __add__(self, other): return self.value + other
def __radd__(self, other): return other + self.value
def __eq__(self, value): return self.value == value
def __le__(self, other): return self.value
def __lt__(self, other): return self.value
def __ge__(self, other): return self.value
def __gt__(self, other): return self.value

class Extractor:
def __init__(self,filepath,stage_name, units):
self.filepath = filepath
Expand All @@ -17,7 +35,14 @@ def _getPerfVars(self,columns,vars):
perfvar_name = f"{self.stage_name}_{col}" if self.stage_name else col
if nb_rows > 1:
perfvar_name = f"{perfvar_name}_{line}"
perf_variables[perfvar_name] = sn.make_performance_function(vars[line][i],unit=self.units.get(col,self.units["*"]))

val = vars[line][i]
unit = self.units.get(col, self.units["*"])

if isinstance(val.evaluate(), str):
val = sn.defer(StringNumber(val.evaluate()))

perf_variables[perfvar_name] = sn.make_performance_function(val,unit=unit)

return perf_variables

Expand Down