-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Make Circles plots for resources reported by Module Alloc Monitor service. #48961
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
cmsbuild
merged 18 commits into
cms-sw:master
from
gartung:gartung-PerfTools-AllocMonitor-2
Sep 26, 2025
Merged
Changes from 16 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
efd423b
Early sketch
makortel cba66f6
initial comit of ModuleAllocMonitor customise python file
gartung b1cc982
Use full module name
gartung 5a79c73
sourceType->PoolSource
gartung 1e7dc14
Put cpptype info into constrution transition module json output
gartung 042f541
Add additional metrics. Add options for construction and events trans…
gartung 3918c8a
Make processModule functions for each transition type
gartung 98d319a
Add resources for all transitions of interest and all allocs of inter…
gartung 203798b
Pick the largest nEvents for total events
gartung e105b7d
Use consistent descriptions
gartung 8d2e3e0
Impliment changes suggested by code review
gartung e9c2446
Add comment about setting total events to 1 since values already norm…
gartung ec37daa
Use normlized resource in the total sum
gartung 6042d6a
Changes suggested by code review.
gartung 1ecb732
Put metric first in title (column heading)
gartung fb9a7d5
Add cmsDriver alloc_monitor option to use prefix env LD_PRELOAD=libPe…
gartung 6ea8fa1
Put back libPerfToolsAllocMonitorPreload.so
gartung 9a13634
Make suggested changes
gartung File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| import FWCore.ParameterSet.Config as cms | ||
| def customise(process): | ||
| process.ModuleAllocMonitor = cms.Service("ModuleAllocMonitor", | ||
| fileName=cms.untracked.string("moduleAllocMonitor.log") | ||
| ) | ||
| return(process) |
138 changes: 138 additions & 0 deletions
138
PerfTools/AllocMonitor/scripts/edmModuleAllocJsonToCircles.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,138 @@ | ||
| #!/usr/bin/env python3 | ||
| import json | ||
| transitionTypes = [ | ||
| "construction", | ||
| "begin job", | ||
| "begin stream", | ||
| "global begin run", | ||
| "stream begin run", | ||
| "global begin luminosity block", | ||
| "stream begin luminosity block", | ||
| "event", | ||
| ] | ||
| allocTypes = ["added", "nAlloc", "nDealloc", "maxTemp", "max1Alloc"] | ||
|
|
||
| def processModuleTransition(moduleLabel, moduleType, moduleInfo, transitionType, moduleTransition): | ||
| moduleTransition[moduleLabel] = {"cpptype": moduleType, "allocs": []} | ||
| for entry in moduleInfo: | ||
| if entry["transition"] == transitionType: | ||
| moduleTransition[moduleLabel]["allocs"].append(entry.get("alloc",{})) | ||
| moduleTransition[moduleLabel]["nTransitions"] = len(moduleTransition[moduleLabel]["allocs"]) | ||
|
|
||
| def formatToCircles(moduleTransitions): | ||
| modules_dict = {} | ||
| doc = { | ||
| "modules": [], | ||
| "resources": [], | ||
| "total": {} | ||
| } | ||
| for transitionType in transitionTypes: | ||
| doc["resources"] += [ | ||
| { | ||
| "name": f"added {transitionType}", | ||
| "description": f"{transitionType}: added memory (average)", | ||
| "title": f"{transitionType}: Amount of memory added to the process at the end of the transition", | ||
| "unit": "kB" | ||
| }, | ||
| { | ||
|
|
||
| "name": f"nAlloc {transitionType}", | ||
| "description": f"{transitionType}: num allocs (average)", | ||
| "title": f"{transitionType}: Number of allocations during the transition", | ||
| "unit": "" | ||
| }, | ||
| { | ||
| "name": f"nDealloc {transitionType}", | ||
| "description": f"{transitionType}: num deallocs (average)", | ||
| "title": f"{transitionType}: Number of deallocations during the transition", | ||
| "unit": "" | ||
| }, | ||
| { | ||
| "name": f"maxTemp {transitionType}", | ||
| "description": f"{transitionType}: maximum temporary memory (average)", | ||
| "title": f"{transitionType}: Maximum temporary memory during the transition", | ||
| "unit": "kB" | ||
| }, | ||
| { | ||
| "name": f"max1Alloc {transitionType}", | ||
| "description": f"{transitionType}: largest single allocation (average)", | ||
| "title": f"{transitionType}: Largest single allocation during the transition", | ||
| "unit": "kB" | ||
| }, | ||
| ] | ||
| # The circles code uses the "events" field to normalize the values between files with different number of events | ||
| # Here we set it to 1 for the total events because the total is already normalized per transition | ||
| doc["total"]["events"] = 1 | ||
| doc["total"]["label"] = "Job" | ||
| doc["total"]["type"] = "Job" | ||
| for allocType in allocTypes: | ||
| doc["total"][f"{allocType} {transitionType}"] = 0 | ||
|
|
||
| for transitionType, moduleTransition in moduleTransitions.items(): | ||
| for label, info in moduleTransition.items(): | ||
| allocs = info.get("allocs", []) | ||
| if not label in modules_dict: | ||
| modules_dict[label] = { | ||
| "label": info.get("label", label), | ||
| "type": info.get("cpptype", "unknown") | ||
| } | ||
| added = 0 | ||
| nAlloc = 0 | ||
| nDealloc = 0 | ||
| maxTemp = 0 | ||
| max1Alloc = 0 | ||
| for alloc in allocs: | ||
| added += alloc.get("added", 0) | ||
| nAlloc += alloc.get("nAlloc", 0) | ||
| nDealloc += alloc.get("nDealloc", 0) | ||
| maxTemp += alloc.get("maxTemp", 0) | ||
| max1Alloc += alloc.get("max1Alloc", 0) | ||
| ntransitions = moduleTransitions[transitionType][label]["nTransitions"] | ||
| if ntransitions > 0: | ||
| modules_dict[label][f"nAlloc {transitionType}"] = nAlloc/ntransitions | ||
| modules_dict[label][f"added {transitionType}"] = (added/ntransitions)/1024 | ||
| modules_dict[label][f"maxTemp {transitionType}"] = (maxTemp/ntransitions)/1024 | ||
| modules_dict[label][f"nDealloc {transitionType}"] = nDealloc/ntransitions | ||
| modules_dict[label][f"max1Alloc {transitionType}"] = (max1Alloc/ntransitions)/1024 | ||
| else: | ||
| modules_dict[label][f"nAlloc {transitionType}"] = nAlloc | ||
| modules_dict[label][f"added {transitionType}"] = (added)/1024 | ||
| modules_dict[label][f"maxTemp {transitionType}"] = (maxTemp)/1024 | ||
| modules_dict[label][f"nDealloc {transitionType}"] = nDealloc | ||
| modules_dict[label][f"max1Alloc {transitionType}"] = max1Alloc/1024 | ||
| doc["total"][f"nAlloc {transitionType}"] += modules_dict[label][f"nAlloc {transitionType}"] | ||
| doc["total"][f"nDealloc {transitionType}"] += modules_dict[label][f"nDealloc {transitionType}"] | ||
| doc["total"][f"maxTemp {transitionType}"] += modules_dict[label][f"maxTemp {transitionType}"] | ||
| doc["total"][f"added {transitionType}"] += modules_dict[label][f"added {transitionType}"] | ||
| doc["total"][f"max1Alloc {transitionType}"] += modules_dict[label][f"max1Alloc {transitionType}"] | ||
|
|
||
| for key in sorted(modules_dict.keys()): | ||
| module = modules_dict[key] | ||
| module["events"] = moduleTransitions['event'][key].get("nTransitions") | ||
| doc["modules"].append(module) | ||
|
|
||
| return doc | ||
|
|
||
| def main(args): | ||
| import sys | ||
| doc = json.load(args.filename) | ||
| moduleTypes = doc['cpptypes'] | ||
| moduleTransitions = dict() | ||
| for transition in transitionTypes: | ||
| moduleTransition = dict() | ||
| processModuleTransition("source", "PoolSource", doc["source"], transition, moduleTransition) | ||
| for moduleLabel, moduleInfo in doc["modules"].items(): | ||
| processModuleTransition(moduleLabel, moduleTypes[moduleLabel], moduleInfo, transition, moduleTransition) | ||
| moduleTransitions[transition] = moduleTransition | ||
|
|
||
| json.dump(formatToCircles(moduleTransitions), sys.stdout, indent=2) | ||
|
|
||
| if __name__ == "__main__": | ||
| import argparse | ||
|
|
||
| parser = argparse.ArgumentParser(description='Convert the JSON output of edmModuleAllocMonitorAnalyze.py to JSON for Circles') | ||
| parser.add_argument('filename', | ||
| type=argparse.FileType('r'), # open file | ||
| help='file to process') | ||
| args = parser.parse_args() | ||
| main(args) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.