Skip to content

Commit

Permalink
Merge Pull Request #2407 from heyitsanthony/sst-elements/anthony/brid…
Browse files Browse the repository at this point in the history
…ge-user-networkIF

Automatically Merged using SST Pull Request AutoTester
PR Title: b'merlin/bridge: load user subcomponent for networkIF'
PR Author: heyitsanthony
  • Loading branch information
sst-autotester authored Oct 8, 2024
2 parents 5ae55c8 + c273614 commit 9a211a9
Showing 1 changed file with 22 additions and 18 deletions.
40 changes: 22 additions & 18 deletions src/sst/elements/merlin/bridge.h
Original file line number Diff line number Diff line change
Expand Up @@ -204,25 +204,29 @@ class Bridge : public SST::Component {
dbg.debug(CALL_INFO, 2, 0, "Initializing network interface %d\n", id);
Nic_t &nic = interfaces[id];

Params if_params;

if_params.insert("link_bw",params.find<std::string>("network_bw","80GiB/s"));
if_params.insert("input_buf_size",params.find<std::string>("network_input_buffer_size", "1KiB"));
if_params.insert("output_buf_size",params.find<std::string>("network_output_buffer_size", "1KiB"));
if_params.insert("port_name","network" + std::to_string(id));

nic.nic = loadAnonymousSubComponent<SST::Interfaces::SimpleNetwork>
("merlin.linkcontrol", "networkIF", id,
ComponentInfo::SHARE_PORTS | ComponentInfo::INSERT_STATS, if_params, 1 /* vns */);

SubComponentSlotInfo *info = getSubComponentSlotInfo("networkIF");
if (info) {
int maxSlot = info->getMaxPopulatedSlotNumber();
if (maxSlot > 1) {
dbg.fatal(CALL_INFO, 1,
"May only specify slots 0 and 1 for 'networkIF'; maximum slot given: %d.\n",
maxSlot);
}
}
if (!info || !info->isPopulated(id)) {
Params if_params;
if_params.insert("link_bw",params.find<std::string>("network_bw","80GiB/s"));
if_params.insert("input_buf_size",params.find<std::string>("network_input_buffer_size", "1KiB"));
if_params.insert("output_buf_size",params.find<std::string>("network_output_buffer_size", "1KiB"));
if_params.insert("port_name","network" + std::to_string(id));

nic.nic = loadAnonymousSubComponent<SimpleNetwork>
("merlin.linkcontrol", "networkIF", id,
ComponentInfo::SHARE_PORTS | ComponentInfo::INSERT_STATS, if_params, 1 /* vns */);
} else {
nic.nic = info->create<SimpleNetwork>(id, ComponentInfo::SHARE_PORTS, 1 /* vns */);
}

// nic.nic = (SimpleNetwork*)loadSubComponent("merlin.linkcontrol", this, params);
// nic.nic->initialize( "network" + std::to_string(id),
// params.find<SST::UnitAlgebra>("network_bw", SST::UnitAlgebra("80GiB/s")),
// 1, /* should be num VN */
// params.find<SST::UnitAlgebra>("network_input_buffer_size", SST::UnitAlgebra("1KiB")),
// params.find<SST::UnitAlgebra>("network_output_buffer_size", SST::UnitAlgebra("1KiB")));

nic.nic->setNotifyOnReceive(new SimpleNetwork::Handler<Bridge, uint8_t>(this, &Bridge::handleIncoming, id));
sendNotify[id] = new SimpleNetwork::Handler<Bridge, uint8_t>(this, &Bridge::spaceAvailable, id);

Expand Down

0 comments on commit 9a211a9

Please sign in to comment.