SST
14.0.0
StructuralSimulationToolkit
|
Output object provides consistent method for outputting data to stdout, stderr and/or sst debug file. More...
#include <output.h>
Public Types | |
enum | output_location_t { NONE, STDOUT, STDERR, FILE } |
Choice of output location. More... | |
Public Member Functions | |
Output (const std::string &prefix, uint32_t verbose_level, uint32_t verbose_mask, output_location_t location, const std::string &localoutputfilename="") | |
Constructor. More... | |
Output () | |
Default Constructor. More... | |
void | init (const std::string &prefix, uint32_t verbose_level, uint32_t verbose_mask, output_location_t location, const std::string &localoutputfilename="") |
Initialize the object after construction. More... | |
void | output (uint32_t line, const char *file, const char *func, const char *format,...) const |
Output the message with formatting as specified by the format parameter. More... | |
void | output (const char *format,...) const |
Output the message with formatting as specified by the format parameter. More... | |
void | verbose (uint32_t line, const char *file, const char *func, uint32_t output_level, uint32_t output_bits, const char *format,...) const |
Output the verbose message with formatting as specified by the format parameter. More... | |
void | verbosePrefix (const char *tempPrefix, uint32_t line, const char *file, const char *func, uint32_t output_level, uint32_t output_bits, const char *format,...) |
Output the verbose message with formatting as specified by the format parameter. More... | |
void | debugPrefix (const char *tempPrefix, uint32_t line, const char *file, const char *func, uint32_t output_level, uint32_t output_bits, const char *format,...) |
Output the debug message with formatting as specified by the format parameter. More... | |
void | debug (uint32_t line, const char *file, const char *func, uint32_t output_level, uint32_t output_bits, const char *format,...) const |
Output the debug message with formatting as specified by the format parameter. More... | |
void | fatal (uint32_t line, const char *file, const char *func, int exit_code, const char *format,...) const |
Output the fatal message with formatting as specified by the format parameter. More... | |
void | setPrefix (const std::string &prefix) |
Sets object prefix. More... | |
std::string | getPrefix () const |
Returns object prefix. | |
void | setVerboseMask (uint32_t verbose_mask) |
Sets object verbose mask. More... | |
uint32_t | getVerboseMask () const |
Returns object verbose mask. | |
void | setVerboseLevel (uint32_t verbose_level) |
Sets object verbose level. More... | |
uint32_t | getVerboseLevel () const |
Returns object verbose level. | |
void | setOutputLocation (output_location_t location) |
Sets object output location. More... | |
output_location_t | getOutputLocation () const |
Returns object output location. | |
void | flush () const |
This method allows for the manual flushing of the output. More... | |
void | serialize_order (SST::Core::Serialization::serializer &ser) override |
ImplementSerializable(SST::Output) private void | setTargetOutput (output_location_t location) |
void | openSSTTargetFile () const |
void | closeSSTTargetFile () |
int | getMPIWorldRank () const |
int | getMPIWorldSize () const |
uint32_t | getNumThreads () const |
uint32_t | getThreadRank () const |
std::string | buildPrefixString (uint32_t line, const std::string &file, const std::string &func) const |
void | outputprintf (uint32_t line, const std::string &file, const std::string &func, const char *format, va_list arg) const |
void | outputprintf (const char *format, va_list arg) const |
friend | int ::main (int argc, char **argv) |
![]() | |
virtual const char * | cls_name () const =0 |
virtual uint32_t | cls_id () const =0 |
virtual std::string | serialization_name () const =0 |
Static Public Member Functions | |
static void | setFileName (const std::string &filename) |
This method sets the static filename used by SST. More... | |
static Output & | getDefaultObject () |
static Output & | setDefaultObject (const std::string &prefix, uint32_t verbose_level, uint32_t verbose_mask, output_location_t location, const std::string &localoutputfilename="") |
static void | setWorldSize (int num_ranks, int num_threads, int mpiRank) |
static void | setThreadID (std::thread::id mach, uint32_t user) |
Data Fields | |
bool | m_objInitialized |
std::string | m_outputPrefix |
uint32_t | m_verboseLevel |
uint32_t | m_verboseMask |
output_location_t | m_targetLoc |
std::FILE ** | m_targetOutputRef |
std::FILE ** | m_targetFileHandleRef |
std::string * | m_targetFileNameRef |
uint32_t * | m_targetFileAccessCountRef |
std::string | m_sstLocalFileName |
std::FILE * | m_sstLocalFileHandle |
uint32_t | m_sstLocalFileAccessCount |
Static Public Attributes | |
static constexpr uint32_t | PrintAll = std::numeric_limits<uint32_t>::max() |
static Output | m_defaultObject |
static std::string | m_sstGlobalSimFileName = "" |
static std::FILE * | m_sstGlobalSimFileHandle = nullptr |
static uint32_t | m_sstGlobalSimFileAccessCount = 0 |
static std::unordered_map< std::thread::id, uint32_t > | m_threadMap |
static int | m_worldSize_ranks |
static int | m_worldSize_threads |
static int | m_mpiRank = 0 |
![]() | |
static constexpr uint32_t | NullClsId = std::numeric_limits<uint32_t>::max() |
Additional Inherited Members | |
![]() | |
enum | cxn_flag_t { ConstructorFlag } |
![]() | |
static void | serializable_abort (uint32_t line, const char *file, const char *func, const char *obj) |
Output object provides consistent method for outputting data to stdout, stderr and/or sst debug file.
All components should use this class to log any information.
SST::Output::Output | ( | const std::string & | prefix, |
uint32_t | verbose_level, | ||
uint32_t | verbose_mask, | ||
output_location_t | location, | ||
const std::string & | localoutputfilename = "" |
||
) |
Constructor.
Set up output configuration.
prefix | Prefix to be prepended to all strings emitted by calls to debug(), verbose(), fatal() and possibly output(). NOTE: No space will be inserted between the prepended prefix string and the normal output string. Prefix can contain the following escape codes:
|
verbose_level | Debugging output level. Calls to debug(), verbose() and fatal() are only output if their output_level parameter is less than or equal to the verbose_level currently set for the object |
verbose_mask | Bitmask of allowed message types for debug(), verbose() and fatal(). The Output object will only output the message if the set bits of the output_bits parameter are set in the verbose_mask of the object. It uses this logic: if (~verbose_mask & output_bits == 0) then output is enabled. |
location | Output location. Output will be directed to STDOUT, STDERR, FILE, or NONE. If FILE output is selected, the output will be directed to the file defined by the –debug runtime parameter, or to the file 'sst_output' if the –debug parameter is not defined. If the size of MPI_COMM_WORLD is > 1, then the rank process will be appended to the file name. |
localoutputfilename. | Send the output of this class to the file identified in localoutputfilename instead of the of the normal output file set by the run time parameter –debug-file. location parameter must be set to FILE. This parameter is intended for special case debug purposes only. |
References init().
SST::Output::Output | ( | ) |
|
inline |
Output the debug message with formatting as specified by the format parameter.
Output will only occur if specified output_level and output_bits meet criteria defined by object. The output will be prepended with the expanded prefix set in the object. NOTE: Debug outputs will only occur if the SST_DEBUG_OUTPUT is defined. this define can be set in source code or by setting the –enable-debug option during SST configuration.
line | Line number of calling function (use CALL_INFO macro) |
file | File name calling function (use CALL_INFO macro) |
func | Function name calling function (use CALL_INFO macro) |
output_level | For output to occur, output_level must be less than or equal to verbose_level set in object |
output_bits | The Output object will only output the message if the set bits of the output_bits parameter are set in the verbose_mask of the object. It uses this logic: if (~verbose_mask & output_bits == 0) then output is enabled. |
format | Format string. All valid formats for printf are available. |
... | Arguments for format. |
References NONE.
|
inline |
Output the debug message with formatting as specified by the format parameter.
Output will only occur if specified output_level and output_bits meet criteria defined by object. The output will be prepended with the expanded prefix set in the object.
tempPrefix | For just this call use this prefix |
line | Line number of calling function (use CALL_INFO macro) |
file | File name calling function (use CALL_INFO macro) |
func | Function name calling function (use CALL_INFO macro) |
output_level | For output to occur, output_level must be less than or equal to verbose_level set in object |
output_bits | The Output object will only output the message if the set bits of the output_bits parameter are set in the verbose_mask of the object. It uses this logic: if (~verbose_mask & output_bits == 0) then output is enabled. |
format | Format string. All valid formats for printf are available. |
... | Arguments for format. |
References NONE.
void SST::Output::fatal | ( | uint32_t | line, |
const char * | file, | ||
const char * | func, | ||
int | exit_code, | ||
const char * | format, | ||
... | |||
) | const |
Output the fatal message with formatting as specified by the format parameter.
Message will be sent to the output location and to stderr. The output will be prepended with the expanded prefix set in the object. NOTE: fatal() will call MPI_Abort(exit_code) to terminate simulation.
line | Line number of calling function (use CALL_INFO macro) |
file | File name calling function (use CALL_INFO macro) |
func | Function name calling function (use CALL_INFO macro) |
exit_code | The exit code used for termination of simulation. will be passed to MPI_Abort() |
format | Format string. All valid formats for printf are available. |
... | Arguments for format. |
References SST::Simulation_impl::emergencyShutdown(), flush(), NONE, STDERR, and STDOUT.
Referenced by SST::Event::clone(), SST::Factory::CreateComponent(), SST::Core::SSTPythonModelDefinition::createConfigGraph(), SST::Factory::CreatePartitioner(), SST::SSTElementPythonModule::createPrimaryModule(), SST::Factory::CreateStatistic(), SST::Factory::DoesSubComponentSlotExist(), SST::Factory::GetComponentInfoStatisticEnableLevel(), SST::Factory::GetComponentInfoStatisticUnits(), SST::Simulation_impl::getNextClockCycle(), SST::Factory::getParamNames(), SST::TimeLord::getTimeConverter(), SST::Simulation_impl::intializeProfileTools(), SST::Factory::isPortNameValid(), SST::Factory::isProfilePointValid(), SST::BaseComponent::isUserSubComponentLoadableUsingAPI(), SST::BaseComponent::loadUserSubComponent(), SST::Statistics::Statistic< void >::outputStatisticFields(), SST::Core::Serialization::pvt::ser_packer::pack_buffer(), SST::Link::recv(), SST::Exit::refDec(), SST::Link::replaceFunctor(), SST::Simulation_impl::reregisterClock(), SST::Link::send_impl(), SST::Link::sendUntimedData(), SST::Link::setFunctor(), and SST::Core::Serialization::pvt::ser_unpacker::unpack_buffer().
|
inline |
This method allows for the manual flushing of the output.
Referenced by fatal().
void SST::Output::init | ( | const std::string & | prefix, |
uint32_t | verbose_level, | ||
uint32_t | verbose_mask, | ||
output_location_t | location, | ||
const std::string & | localoutputfilename = "" |
||
) |
Initialize the object after construction.
prefix | Prefix to be prepended to all strings emitted by calls to debug(), verbose(), fatal() and possibly output(). NOTE: No space will be inserted between the prepended prefix string and the normal output string. Prefix can contain the following escape codes:
|
verbose_level | Debugging output level. Calls to debug(), verbose() and fatal() are only output if their output_level parameter is less than or equal to the verbose_level currently set for the object |
verbose_mask | Bitmask of allowed message types for debug(), verbose() and fatal(). The Output object will only output the message if the set bits of the output_bits parameter are set in the verbose_mask of the object. It uses this logic: if (~verbose_mask & output_bits == 0) then output is enabled. |
location | Output location. Output will be directed to STDOUT, STDERR, FILE, or NONE. If FILE output is selected, the output will be directed to the file defined by the –debug runtime parameter, or to the file 'sst_output' if the –debug parameter is not defined. If the size of MPI_COMM_WORLD is > 1, then the rank process will be appended to the file name. |
localoutputfilename. | Send the output of this class to the file identified in localoutputfilename instead of the of the normal output file set by the run time parameter –debug-file. location parameter must be set to FILE. This parameter is intended for special case debug purposes only. |
Referenced by Output().
|
inline |
Output the message with formatting as specified by the format parameter.
The output will be prepended with the expanded prefix set in the object.
line | Line number of calling function (use CALL_INFO macro) |
file | File name calling function (use CALL_INFO macro) |
func | Function name calling function (use CALL_INFO macro) |
format | Format string. All valid formats for printf are available. |
... | Argument strings for format. |
References NONE.
Referenced by SST::SimulatorHeartbeat::execute(), SST::CheckpointAction::execute(), SST::CoreTestMemPoolTest::MemPoolTestComponent::finish(), SST::IMPL::TimeVortexPQBase< true >::print(), SST::OneShot::print(), SST::Exit::print(), SST::IMPL::TimeVortexBinnedMapBase< true >::print(), SST::Params::print_all_params(), SST::Simulation_impl::printStatus(), SST::Statistics::StatisticOutputTextBase::printUsage(), SST::Statistics::StatisticOutputJSON::printUsage(), SST::Statistics::StatisticOutputCSV::printUsage(), and SST::Params::verifyKey().
|
inline |
|
static |
This method sets the static filename used by SST.
It can only be called once, and is automatically called by the SST Core. No components should call this method.
void SST::Output::setOutputLocation | ( | output_location_t | location | ) |
Sets object output location.
location | Output location. Output will be directed to STDOUT, STDERR, FILE, or NONE. If FILE output is selected, the output will be directed to the file defined by the –debug runtime parameter, or to the file 'sst_output' if the –debug parameter is not defined. If the size of MPI_COMM_WORLD is > 1, then the rank process will be appended to the file name. |
void SST::Output::setPrefix | ( | const std::string & | prefix | ) |
Sets object prefix.
prefix | Prefix to be prepended to all strings emitted by calls to debug(), verbose(), fatal() and possibly output(). NOTE: No space will be inserted between the prepended prefix string and the normal output string. Prefix can contain the following escape codes:
|
void SST::Output::setVerboseLevel | ( | uint32_t | verbose_level | ) |
void SST::Output::setVerboseMask | ( | uint32_t | verbose_mask | ) |
Sets object verbose mask.
verbose_mask | Bitmask of allowed message types for debug(), verbose() and fatal(). The Output object will only output the message if the set bits of the output_bits parameter are set in the verbose_mask of the object. It uses this logic: if (~verbose_mask & output_bits == 0) then output is enabled. |
|
inline |
Output the verbose message with formatting as specified by the format parameter.
Output will only occur if specified output_level and output_bits meet criteria defined by object. The output will be prepended with the expanded prefix set in the object.
line | Line number of calling function (use CALL_INFO macro) |
file | File name calling function (use CALL_INFO macro) |
func | Function name calling function (use CALL_INFO macro) |
output_level | For output to occur, output_level must be less than or equal to verbose_level set in object |
output_bits | The Output object will only output the message if the set bits of the output_bits parameter are set in the verbose_mask of the object. It uses this logic: if (~verbose_mask & output_bits == 0) then output is enabled. |
format | Format string. All valid formats for printf are available. |
... | Arguments for format. |
References NONE.
Referenced by SST::Core::SSTPythonModelDefinition::createConfigGraph(), and SST::Exit::refDec().
|
inline |
Output the verbose message with formatting as specified by the format parameter.
Output will only occur if specified output_level and output_bits meet criteria defined by object. The output will be prepended with the expanded prefix set in the object.
tempPrefix | For just this call use this prefix |
line | Line number of calling function (use CALL_INFO macro) |
file | File name calling function (use CALL_INFO macro) |
func | Function name calling function (use CALL_INFO macro) |
output_level | For output to occur, output_level must be less than or equal to verbose_level set in object |
output_bits | The Output object will only output the message if the set bits of the output_bits parameter are set in the verbose_mask of the object. It uses this logic: if (~verbose_mask & output_bits == 0) then output is enabled. |
format | Format string. All valid formats for printf are available. |
... | Arguments for format. |
References NONE.