Skip to main content


A SubComponent is a modular piece of functionality that can be dynamically loaded into a Component or another SubComponent. SubComponents can be declared in the SST configuration input file (i.e., a user subcomponent) or can be loaded directly by a (sub)component such that the user may not have control over which component is loaded (i.e., an anonymous subcomponent). A parent (sub)Component interacts directly with its loaded subcomponent via function calls. SubComponents and their parents are always co-located when SST is running in parallel.

SubComponents must inherit from a SubComponent API which must in turn inherit from the SST::SubComponent class. This allows SST to load any SubComponent that inherits from a given API into a slot designed for that API.

User versus Anonymous SubComponents

Defined in the simulation input fileDefined by the (sub)component that loads it
Parameters come from simulation inputParameters come from parent (sub)component
Can have linksCan only use its parent's links


Excerpt from src/sst/elements/simpleElementExample/
#include <sst/core/subcomponent.h>

// SubComponent API - define an API for a type of subcomponent
class basicSubComponentAPI : public SST::SubComponent
// Tell SST that this class is a SubComponent API

basicSubComponentAPI(ComponentId_t id, Params& params) : SubComponent(id) {}
virtual ~basicSubComponentAPI() {}

virtual int compute (int num) =0;
virtual std::string compute (std::string comp) =0;

// This is a subcomponent that implements the API defined above
class basicSubComponentIncrement : public basicSubComponentAPI
basicSubComponentIncrement, // Class name
"simpleElementExample", // Library name, the 'lib' in SST's format
"basicSubComponentIncrement", // Name used to refer to this subcomponent, the 'name' in SST's format
SST_ELI_ELEMENT_VERSION(1,0,0), // A version number
"SubComponent that increments a value", // Description
SST::simpleElementExample::basicSubComponentAPI) // Fully qualified name of the API this subcomponent implements

// Other ELI macros as needed for parameters, ports, statistics, and subcomponent slots
SST_ELI_DOCUMENT_PARAMS( { "amount", "Amount to increment by", "1" } )

basicSubComponentIncrement(ComponentId_t id, Params& params);

// Implement the API functions
int compute( int num) override;
std::string compute( std::string comp ) override;

int amount;
Excerpt from src/sst/elements/simpleElementExample/basicSubComponent_subcomponent.h
#include <sst_config.h>
#include <basicSubComponent_subcomponent.h>

basicSubComponentIncrement::basicSubComponentIncrement(ComponentId_t id, Params& params) :
basicSubComponentAPI(id, params)
amount = params.find<int>("amount", 1);

basicSubComponentIncrement::~basicSubComponentIncrement() { }

int basicSubComponentIncrement::compute( int num )
return num + amount;

std::string basicSubComponentIncrement::compute ( std::string comp )
return "(" + comp + ")" + " + " + std::to_string(amount);
#include <sst/core/subcomponent.h>