Skip to content

Commit

Permalink
Mercury: node component derived from NodeBase
Browse files Browse the repository at this point in the history
  • Loading branch information
jpkenny committed Nov 22, 2024
1 parent 52c2eda commit 8e49e80
Show file tree
Hide file tree
Showing 23 changed files with 799 additions and 155 deletions.
12 changes: 1 addition & 11 deletions src/sst/elements/iris/sumi/sim_transport.cc
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,6 @@ SimTransport::SimTransport(SST::Params& params, SST::Hg::App* parent) :
Library(params, parent),
//the server is what takes on the specified libname
completion_queues_(1),
// spy_bytes_(nullptr),
default_progress_queue_(parent->os()),
nic_ioctl_(parent->os()->nicDataIoctl()),
qos_analysis_(nullptr),
Expand Down Expand Up @@ -206,13 +205,6 @@ SimTransport::SimTransport(SST::Params& params, SST::Hg::App* parent) :
rdma_page_delay_ = TimeDelta(params.find<SST::UnitAlgebra>("rdma_page_delay", "0s").getValue().toDouble());
pin_delay_ = rdma_pin_latency_.ticks() || rdma_page_delay_.ticks();
page_size_ = params.find<SST::UnitAlgebra>("rdma_page_size", "4096").getRoundedValue();

// std::cerr << "post_rdma_delay: " << post_rdma_delay_ << std::endl;
// std::cerr << "post_header_delay: " << post_header_delay_ << std::endl;
// std::cerr << "poll_delay: " << poll_delay_ << std::endl;
// std::cerr << "rdma_pin_latency " << rdma_pin_latency_ << std::endl;
// std::cerr << "rdma_page_delay " << rdma_page_delay_ << std::endl;
// std::cerr << "rdma_page_size " << page_size_ << std::endl;

output.output("%d", sid().app_);
nproc_ = os_->nranks();
Expand Down Expand Up @@ -277,9 +269,6 @@ SimTransport::~SimTransport()
if (del) delete server;

if (engine_) delete engine_;

//if (spy_bytes_) delete spy_bytes_;
//if (spy_num_messages_) delete spy_num_messages_;
}

void
Expand Down Expand Up @@ -319,6 +308,7 @@ SimTransport::nidlist() const
//the types are the same size and the bits can be
//interpreted correctly
//return (int*) rank_mapper_->rankToNode().data();
sst_hg_abort_printf("sumi_transport::nidList unimplemented");
return nullptr;
}

Expand Down
5 changes: 5 additions & 0 deletions src/sst/elements/mercury/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ libhg_la_SOURCES = \
common/connection.cc \
components/nic.cc \
components/node.cc \
components/node_base.cc \
components/node_CL.cc \
components/operating_system.cc \
hardware/common/packet.cc \
hardware/common/recv_cq.cc \
Expand Down Expand Up @@ -118,6 +120,9 @@ nobase_library_include_HEADERS = \
components/nic.h \
components/nic_fwd.h \
components/node.h \
components/node_base.h \
components/node_base_fwd.h \
components/node_CL.h \
components/node_fwd.h \
components/operating_system.h \
components/operating_system_fwd.h \
Expand Down
6 changes: 3 additions & 3 deletions src/sst/elements/mercury/components/nic.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include <mercury/components/nic.h>
#include <sst/core/params.h>
#include <mercury/common/util.h>
#include <mercury/components/node.h>
#include <mercury/components/node_base.h>
#include <mercury/components/operating_system.h>
#include <mercury/hardware/network/network_message.h>

Expand All @@ -34,7 +34,7 @@ NicEvent::serialize_order(serializer &ser)
ser & msg_;
}

NIC::NIC(uint32_t id, SST::Params& params, Node* parent) :
NIC::NIC(uint32_t id, SST::Params& params, NodeBase* parent) :
SST::Hg::SubComponent(id),
parent_(parent),
my_addr_(parent->os()->addr()),
Expand Down Expand Up @@ -404,7 +404,7 @@ NIC::internodeSend(NetworkMessage* netmsg)
void
NIC::sendToNode(NetworkMessage* payload)
{
auto forward_ev = newCallback(parent_, &Node::handle, payload);
auto forward_ev = newCallback(parent_, &NodeBase::handle, payload);
parent_->sendExecutionEventNow(forward_ev);
}

Expand Down
12 changes: 6 additions & 6 deletions src/sst/elements/mercury/components/nic.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@
#include <sst/core/eli/elementbuilder.h>
#include <sst/core/interfaces/simpleNetwork.h>

#include <mercury/components/node_base_fwd.h>
#include <mercury/components/operating_system_fwd.h>
#include <mercury/common/thread_safe_new.h>
#include <mercury/common/node_address.h>
#include <mercury/common/timestamp.h>
#include <mercury/common/event_handler.h>
#include <mercury/components/node_fwd.h>
#include <mercury/components/operating_system_fwd.h>
#include <mercury/common/connection.h>
#include <mercury/hardware/common/packet_fwd.h>
#include <mercury/hardware/common/recv_cq.h>
Expand Down Expand Up @@ -69,7 +69,7 @@ class NIC : public SST::Hg::SubComponent
public:

SST_ELI_REGISTER_SUBCOMPONENT_API(SST::Hg::NIC,
SST::Hg::Node*)
SST::Hg::NodeBase*)

SST_ELI_REGISTER_SUBCOMPONENT(
NIC,
Expand Down Expand Up @@ -210,11 +210,11 @@ class NIC : public SST::Hg::SubComponent
}

public:
NIC(uint32_t id, SST::Params& params, SST::Hg::Node* parent);
NIC(uint32_t id, SST::Params& params, SST::Hg::NodeBase* parent);

protected:

Node* parent() const {
SST::Hg::NodeBase* parent() const {
return parent_;
}

Expand All @@ -224,7 +224,7 @@ class NIC : public SST::Hg::SubComponent

protected:
int negligibleSize_;
Node* parent_;
SST::Hg::NodeBase* parent_;
NodeId my_addr_;
EventLink::ptr logp_link_;

Expand Down
55 changes: 1 addition & 54 deletions src/sst/elements/mercury/components/node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,60 +25,7 @@ extern template class HgBase<SST::Component>;
extern template SST::TimeConverter* HgBase<SST::Component>::time_converter_;

Node::Node(ComponentId_t id, Params &params)
: SST::Hg::Component(id), nic_(0) {
my_addr_ = params.find<unsigned int>("logicalID",-1);
unsigned int verbose = params.find<unsigned int>("verbose",0);
out_ = std::unique_ptr<SST::Output>(new SST::Output(sprintf("Node%d:",my_addr_), verbose, 0, Output::STDOUT));

out_->debug(CALL_INFO, 1, 0, "loading hg.operatingsystem\n");
os_ = loadUserSubComponent<OperatingSystem>("os_slot", SST::ComponentInfo::SHARE_NONE, this);
assert(os_);

out_->debug(CALL_INFO, 1, 0, "loading hg.NIC\n");
link_control_ = loadUserSubComponent<SST::Interfaces::SimpleNetwork>("link_control_slot", SST::ComponentInfo::SHARE_NONE,1);
if (link_control_) {
out_->debug(CALL_INFO, 1, 0, "loading hg.NIC\n");
nic_ = loadUserSubComponent<NIC>("nic_slot", SST::ComponentInfo::SHARE_NONE, this);
assert(nic_);
nic_->set_link_control(link_control_);
}
else {
// assume basic tests
// (unused but needs to be there or multithread termination breaks)
netLink_ = configureLink("network");
}

unsigned int nranks = params.find<unsigned int>("nranks",-1);
os_->set_nranks(nranks);

int ncores_ = params.find<std::int32_t>("ncores", 1);
int nsockets_ = params.find<std::int32_t>("nsockets",1);

// Tell the simulation not to end until we're ready
registerAsPrimaryComponent();
primaryComponentDoNotEndSim();
}

void
Node::init(unsigned int phase)
{
SST::Component::init(phase);
os_->init(phase);
if (nic_) nic_->init(phase);
}

void
Node::setup()
{
SST::Component::setup();
os_->setup();
if (nic_) nic_->setup();
}

void
Node::handle(Request* req)
{
os_->handleRequest(req);
: SST::Hg::NodeBase(id,params) {
}

} // namespace Hg
Expand Down
65 changes: 7 additions & 58 deletions src/sst/elements/mercury/components/node.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

#include <mercury/common/component.h>

#include <mercury/components/node_base.h>
#include <sst/core/timeConverter.h>
#include <sst/core/link.h>
#include <mercury/components/operating_system_fwd.h>
Expand All @@ -30,7 +31,7 @@ namespace SST {
namespace Hg {

// Components inherit from SST::Component
class Node : public SST::Hg::Component {
class Node : public NodeBase {
public:
/*
* SST Registration macros register Components with the SST Core and
Expand All @@ -40,69 +41,17 @@ class Node : public SST::Hg::Component {
*/
// REGISTER THIS COMPONENT INTO THE ELEMENT LIBRARY
SST_ELI_REGISTER_COMPONENT(
Node, // Component class
SST::Hg::Node, // Component class
"hg", // Component library (for Python/library lookup)
"node", // Component name (for Python/library lookup)
"Node", // Component name (for Python/library lookup)
SST_ELI_ELEMENT_VERSION(
0, 0, 1), // Version of the component (not related to SST version)
"Mercury Node", // Description
COMPONENT_CATEGORY_UNCATEGORIZED // Category
"Simple Mercury node", // Description
COMPONENT_CATEGORY_UNCATEGORIZED, // Category
SST::Hg::NodeBase
)

SST_ELI_DOCUMENT_PARAMS({"verbose",
"Output verbose level", 0},
)

SST_ELI_DOCUMENT_PORTS(
{"network", "Dummy network port to connect nodes for testing", {} },
)

SST_ELI_DOCUMENT_SUBCOMPONENT_SLOTS(
{"os_slot", "The operating system", "hg.operating_system"},
{"nic_slot", "The nic", "hg.nic"},
{"link_control_slot", "Slot for a link control", "SST::Interfaces::SimpleNetwork" }
)

Node(SST::ComponentId_t id, SST::Params &params);

/**
@return A unique integer identifier
*/
NodeId addr() const {
return my_addr_;
}

void init(unsigned int phase) override;

void setup() override;

void endSim() {
primaryComponentOKToEndSim();
}

SST::Hg::OperatingSystem* os() const {
return os_;
}

int ncores() { return ncores_; }
int nsockets() { return nsockets_; }

void handle(Request* req);

SST::Hg::NIC* nic() { return nic_; }

std::string toString() { return sprintf("HgNode%d:",my_addr_); }

private:

SST::Hg::NIC* nic_;
SST::Hg::OperatingSystem* os_;
SST::Interfaces::SimpleNetwork* link_control_;
SST::Link* netLink_;
std::unique_ptr<SST::Output> out_;
NodeId my_addr_;
int ncores_;
int nsockets_;
};

} // namespace Hg
Expand Down
31 changes: 31 additions & 0 deletions src/sst/elements/mercury/components/node_CL.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// Copyright 2009-2024 NTESS. Under the terms
// of Contract DE-NA0003525 with NTESS, the U.S.
// Government retains certain rights in this software.
//
// Copyright (c) 2009-2024, NTESS
// All rights reserved.
//
// Portions are copyright of other developers:
// See the file CONTRIBUTORS.TXT in the top level directory
// of the distribution for more information.
//
// This file is part of the SST software package. For license
// information, see the LICENSE file in the top level directory of the
// distribution.

#include <mercury/components/node_CL.h>

namespace SST {
namespace Hg {

extern template class HgBase<SST::Component>;
extern template SST::TimeConverter* HgBase<SST::Component>::time_converter_;

NodeCL::NodeCL(ComponentId_t id, Params &params)
: NodeBase(id,params) {
int ncores_ = params.find<std::int32_t>("ncores", 1);
int nsockets_ = params.find<std::int32_t>("nsockets",1);
}

} // namespace Hg
} // namespace SST
64 changes: 64 additions & 0 deletions src/sst/elements/mercury/components/node_CL.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
// Copyright 2009-2024 NTESS. Under the terms
// of Contract DE-NA0003525 with NTESS, the U.S.
// Government retains certain rights in this software.
//
// Copyright (c) 2009-2024, NTESS
// All rights reserved.
//
// Portions are copyright of other developers:
// See the file CONTRIBUTORS.TXT in the top level directory
// of the distribution for more information.
//
// This file is part of the SST software package. For license
// information, see the LICENSE file in the top level directory of the
// distribution.

#pragma once

#include <mercury/common/component.h>

#include <sst/core/timeConverter.h>
#include <mercury/components/node_base.h>
#include <mercury/components/node.h>
#include <cstdint>
#include <memory>

namespace SST {
namespace Hg {

// Components inherit from SST::Component
class NodeCL : public NodeBase {
public:
/*
* SST Registration macros register Components with the SST Core and
* document their parameters, ports, etc.
* SST_ELI_REGISTER_COMPONENT is required, the documentation macros
* are only required if relevant
*/
// REGISTER THIS COMPONENT INTO THE ELEMENT LIBRARY
SST_ELI_REGISTER_COMPONENT(
SST::Hg::NodeCL, // Component class
"hg", // Component library (for Python/library lookup)
"NodeCL", // Component name (for Python/library lookup)
SST_ELI_ELEMENT_VERSION(
0, 0, 1), // Version of the component (not related to SST version)
"Mercury Node including ComputeLibrary", // Description
COMPONENT_CATEGORY_UNCATEGORIZED, // Category
SST::Hg::Node
)

NodeCL(SST::ComponentId_t id, SST::Params &params);

int ncores() { return ncores_; }
int nsockets() { return nsockets_; }

std::string toString() override { return sprintf("HgNode%d:",my_addr_); }

private:

int ncores_;
int nsockets_;
};

} // namespace Hg
} // namespace SST
Loading

0 comments on commit 8e49e80

Please sign in to comment.