Skip to content
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

Add PortModules to core API #1068

Open
feldergast opened this issue Apr 15, 2024 · 2 comments
Open

Add PortModules to core API #1068

feldergast opened this issue Apr 15, 2024 · 2 comments
Labels
Enhancement in progress Major Feature A new feature that has broad impact on codebase and requires a minimum two week discussion period

Comments

@feldergast
Copy link
Contributor

Please describe the new features with any relevant use cases.

PortModules will be added to the core interfaces. The PortModule will be able to intercept Events on both send and receive.
This functionality could be useful for simulating "noisy channels", where errors may be introduced during communication.

Describe the proposed solution you plan to implement
The implementation will be similar to and encapsulate the functionality of the EventHandlerProfileTool interface (i.e., the EventHandlerProfileTool will inherit from PortModule). The major change to the API will be that the function calls will return Event* instead of void. This will allow the PortModule to modify or drop the event, if desired.

Testing plan
A test using PortModules will be developed and will test the cases of dropping and modifying Events.

Additional context
The major challenge is making the EventHandlerProfileTool inherit from both PortModule and ProfileTool. The main issue here is how to handle the ELI information for the combined class.

@feldergast feldergast added Enhancement in progress Major Feature A new feature that has broad impact on codebase and requires a minimum two week discussion period labels Apr 15, 2024
@bpswenson
Copy link
Contributor

bpswenson commented Jul 8, 2024

Current implementation is here: https://github.com/bpswenson/sst-core/tree/portmod.
Example port module that drops events on either send or receive: https://github.com/bpswenson/sst-core/blob/portmod/src/sst/core/portModules/randomDropPortModule.h

Example usage:

atlanta = sst.Component("Atlanta_ATL", "AirportSim.Airport")

atlanta.addParams({
	"name" : "Atlanta_ATL",
        "num_connectors" : 1,
        "num_planes": 2
})

milwaukee = sst.Component("Milwaukee_MKE", "AirportSim.Airport")
milwaukee.addParams({
    "name" : "Milwaukee_MKE",
    "num_connectors" : 1,
    "num_planes": 1
})

atl_mke = sst.Link("atlanta_milwaukee")
atl_mke.connect((atlanta, "airport_connector_0", "4s"), (milwaukee, "airport_connector_0", "4s"))`

atlanta.addPortModule("airport_connector_0", "sst.portmodules.random_drop_port_module", {
    "drop_prob": 0.9,
    "verbose": "true",
    "drop_on_send": "true"
})

@feldergast
Copy link
Contributor Author

In general I think the code structure looks good. We will need to figure out how to make these checkpoint able. We are not planning to include profiling tools in checkpoints, but these reuse the same data structures and will need to go into the checkpoint. I wouldn't worry about that for getting this code in, we'll deal with that as the checkpointing support continues to evolve. The only other thing I noticed is that verbose print-outs need to use the Output class instead of cout.

At this point, the code will need a rebase, but I think it looks good and it can moved onto a PR if things are ready.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement in progress Major Feature A new feature that has broad impact on codebase and requires a minimum two week discussion period
Projects
None yet
Development

No branches or pull requests

2 participants