diff --git a/cmssw-pr-test-config b/cmssw-pr-test-config index 8daa8912936..bacdfe3026a 100755 --- a/cmssw-pr-test-config +++ b/cmssw-pr-test-config @@ -16,7 +16,7 @@ elif [ "$CMSSW_MAJOR" -ge 13 ] ; then else PR_TEST_MATRIX_EXTRAS_GPU=11634.586,11634.587 fi -PR_TEST_MATRIX_EXTRAS_PROFILING=29834.21,12634.21 +PR_TEST_MATRIX_EXTRAS_PROFILING=29834.21,13034.21 PR_TEST_MATRIX_EXTRAS_HIGH_STATS=35034.0 PR_TEST_MATRIX_EXTRAS_NANO=all MATRIX_OPTION_PROFILING="" diff --git a/comparisons/resources-diff.py b/comparisons/resources-diff.py index 27dcd0becc0..7d57c597968 100755 --- a/comparisons/resources-diff.py +++ b/comparisons/resources-diff.py @@ -5,83 +5,120 @@ import os -def diff_from(metrics, data, dest, res): - # ratio = 0.0 - # if not dest["events"] == 0: - # ratio = data["events"]/dest["events"] - # data["events"] = ratio * dest["events"] +def diff_from(metrics, data, data_total, dest, dest_total, res): for metric in metrics: dmetric = dest[metric] - data[metric] dkey = "%s_diff" % metric res[dkey] = dmetric pdmetric = 0.0 - if not data[metric] == 0.0: - pdmetric = 100 * dmetric / data[metric] + pdmetric = 100 * dmetric pdkey = "%s_pdiff" % metric res[pdkey] = pdmetric - - -# data[metric] = ratio * dest[metric] + fkey = "%s_frac" % metric + fdest = 100 * dest[metric] / dest_total[metric] + dest[fkey] = fdest + fdata = 100 * data[metric] / data_total[metric] + data[fkey] = fdata + dfmetric = fdest - fdata + dfkey = "%s_frac_diff" % metric + res[dfkey] = dfmetric + pdfmetric = 0.0 + pdfmetric = 100 * dfmetric + dkpkey = "%s_frac_pdiff" % metric + res[dkpkey] = pdfmetric if len(sys.argv) == 1: print( - """Usage: resources-diff.py FILE1 FILE2 + """Usage: resources-diff.py IB_FILE PR_FILE Diff the content of two "resources.json" files and print the result to standard output.""" ) sys.exit(1) with open(sys.argv[1]) as f: - output = json.load(f) + ibdata = json.load(f) -metrics = [label for resource in output["resources"] for label in resource] +metrics = [label for resource in ibdata["resources"] for label in resource] -datamap = {module["type"] + "|" + module["label"]: module for module in output["modules"]} +datamapib = {module["type"] + "|" + module["label"]: module for module in ibdata["modules"]} + +datacumulsib = {} +for module in ibdata["modules"]: + datacumul = datacumulsib.get(module["type"]) + if datacumul: + datacumul["count"] += 1 + for metric in metrics: + datacumul[metric] += module[metric] + else: + datacumul = {} + datacumul["count"] = 1 + for metric in metrics: + datacumul[metric] = module[metric] + datacumulsib[module["type"]] = datacumul +# print(datacumulsib) with open(sys.argv[2]) as f: - input = json.load(f) -if output["resources"] != input["resources"]: + prdata = json.load(f) +if ibdata["resources"] != prdata["resources"]: print("Error: input files describe different metrics") sys.exit(1) -datamap2 = {module["type"] + "|" + module["label"]: module for module in input["modules"]} +datamappr = {module["type"] + "|" + module["label"]: module for module in prdata["modules"]} -if output["total"]["label"] != input["total"]["label"]: +datacumulspr = {} +for module in prdata["modules"]: + datacumul = datacumulspr.get(module["type"]) + if datacumul: + datacumul["count"] += 1 + for metric in metrics: + datacumul[metric] += module[metric] + else: + datacumul = {} + datacumul["count"] = 1 + for metric in metrics: + datacumul[metric] = module[metric] + datacumulspr[module["type"]] = datacumul +# print(datacumulspr) + +if ibdata["total"]["label"] != prdata["total"]["label"]: print("Warning: input files describe different process names") + results = {} results["resources"] = [] -for resource in input["resources"]: +for resource in prdata["resources"]: for k, v in resource.items(): dkey = "%s_diff" % k - pdkey = "%s_pdiff" % k + results["resources"].append({k: "%s" % v}) results["resources"].append({dkey: "%s diff" % v}) - results["resources"].append({pdkey: "%s percentage diff" % v}) -results["total"] = {} -results["total"]["label"] = input["total"]["label"] -results["total"]["events"] = input["total"]["events"] -results["total"]["type"] = input["total"]["type"] -results["modules"] = [] -diff_from(metrics, input["total"], output["total"], results["total"]) +results["total"] = {} +results["total"]["type"] = prdata["total"]["type"] +results["total"]["label"] = prdata["total"]["label"] +results["total"]["events"] = prdata["total"]["events"] +diff_from( + metrics, prdata["total"], prdata["total"], ibdata["total"], ibdata["total"], results["total"] +) -for module in input["modules"]: +results["modules"] = [] +for module in prdata["modules"]: key = module["type"] + "|" + module["label"] result = {} result["type"] = module["type"] result["label"] = module["label"] result["events"] = module["events"] - if key in datamap: - diff_from(metrics, module, datamap[key], result) + if key in datamapib: + diff_from(metrics, module, prdata["total"], datamapib[key], ibdata["total"], result) results["modules"].append(result) else: - datamap[key] = module - diff_from(metrics, module, datamap[key], result) + datamapib[key] = module + diff_from(metrics, module, prdata["total"], datamapib[key], ibdata["total"], result) results["modules"].append(result) -datamap3 = {module["type"] + "|" + module["label"]: module for module in results["modules"]} +datamapres = {module["type"] + "|" + module["label"]: module for module in results["modules"]} -threshold = 1.0 -error_threshold = 10.0 + +threshold = 5.0 +error_threshold = 20.0 summaryLines = [] @@ -95,57 +132,107 @@ def diff_from(metrics, data, dest, res): + "warn threshold %0.2f" % threshold + '%
Module type | ' + "|
metric: <pull request > <baseline> (PR - baseline) | <100* (PR - baseline)> |
Type | ' + + 'Label | ' + + 'real time | ' + + 'cpu time | ' + + 'allocated memory | ' + + 'deallocated memory | ' + + 'events | ' + + "%s | " % prdata["total"]["type"] + + "%s | " % prdata["total"]["label"] + + '%0.6f %0.6f %0.6f | '
+ % (
+ prdata["total"]["time_real"],
+ ibdata["total"]["time_real"],
+ results["total"]["time_real_diff"],
+ )
+ + '%0.6f %0.6f %0.6f | '
+ % (
+ prdata["total"]["time_thread"],
+ ibdata["total"]["time_thread"],
+ results["total"]["time_thread_diff"],
+ )
+ + '%0.f %0.f %0.f | '
+ % (
+ prdata["total"]["mem_alloc"],
+ ibdata["total"]["mem_alloc"],
+ results["total"]["mem_alloc_diff"],
+ )
+ + '%0.f %0.f %0.f | '
+ % (prdata["total"]["mem_free"], ibdata["total"]["mem_free"], results["total"]["mem_free_diff"])
+ + "%i %i %i | "
+ % (prdata["total"]["events"], ibdata["total"]["events"], results["total"]["events"])
+ + "
Module type | ' + 'Module label | ' - + 'real time diff | ' - + 'real time percent diff | ' - + 'cpu time diff | ' - + 'cpu time percent diff | ' + + 'real time fraction | ' + + 'real time fraction diff percent | ' + + 'cpu time fraction | ' + + 'cpu time fraction diff percent | ' + 'allocated memory diff | ' - + 'allocated memory percent diff | ' + 'deallocated memory diff | ' - + 'deallocated memory percent diff | ' + 'events | ' + "threshold: + if moduleres["time_thread_frac_pdiff"] > threshold: color = 'bgcolor="orange"' - if abs(module3["time_thread_pdiff"]) > error_threshold: + if moduleres["time_thread_frac_pdiff"] > error_threshold: color = 'bgcolor="red"' + if moduleres["time_thread_frac_pdiff"] < -1.0 * threshold: + color = 'bgcolor="cyan"' + if moduleres["time_thread_frac_pdiff"] < -1.0 * error_threshold: + color = 'bgcolor="green"' cellString += color cellString += ">" summaryLines += [ " |
%s | " % module3["type"] - + "%s | " % module3["label"] - + '%0.4f %0.4f %0.4f | '
- % (module1["time_real"], module2["time_real"], module3["time_real_diff"])
- + '%0.2f%% | ' % module3["time_real_pdiff"] - + '%0.4f %0.4f %0.4f | '
- % (module1["time_thread"], module2["time_thread"], module3["time_thread_diff"])
+ + "%s | " % moduleres["type"] + + "%s | " % moduleres["label"] + + '%0.6f %0.6f %0.6f | '
+ % (
+ moduleib["time_real_frac"],
+ modulepr["time_real_frac"],
+ moduleres["time_real_frac_diff"],
+ )
+ + '%0.6f%% | ' % moduleres["time_real_frac_pdiff"] + + '%0.6f %0.6f %0.6f | '
+ % (
+ moduleib["time_thread_frac"],
+ modulepr["time_thread_frac"],
+ moduleres["time_thread_frac_diff"],
+ )
+ cellString
- + "%0.2f%%" % module3["time_thread_pdiff"]
+ + "%0.6f%%" % moduleres["time_thread_frac_pdiff"]
+ '%0.f %0.f %0.f | '
- % (module1["mem_alloc"], module2["mem_alloc"], module3["mem_alloc_diff"])
- + '%0.2f%% | ' % module3["mem_alloc_pdiff"] + % (moduleib["mem_alloc"], modulepr["mem_alloc"], moduleres["mem_alloc_diff"]) + '%0.f %0.f %0.f | '
- % (module1["mem_free"], module2["mem_free"], module3["mem_free_diff"])
- + '%0.2f%% | ' % module3["mem_free_pdiff"] - + "%i %i %i | " % (module1["events"], module2["events"], module3["events"])
+ % (moduleib["mem_free"], modulepr["mem_free"], moduleres["mem_free_diff"])
+ + "%i %i %i | "
+ % (moduleib["events"], modulepr["events"], moduleres["events"])
+ "