00001 // Copyright 2009-2015 Sandia Corporation. Under the terms 00002 // of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. 00003 // Government retains certain rights in this software. 00004 // 00005 // Copyright (c) 2009-2015, Sandia Corporation 00006 // All rights reserved. 00007 // 00008 // This file is part of the SST software package. For license 00009 // information, see the LICENSE file in the top level directory of the 00010 // distribution. 00011 00012 #ifndef SST_CORE_ELEMENT_H 00013 #define SST_CORE_ELEMENT_H 00014 00015 #include <sst/core/sst_types.h> 00016 00017 //#include <sst/core/component.h> 00018 //#include <sst/core/params.h> 00019 00020 #include <stdio.h> 00021 #include <string> 00022 00023 // Component Category Definitions 00024 #define COMPONENT_CATEGORY_UNCATEGORIZED 0x00 00025 #define COMPONENT_CATEGORY_PROCESSOR 0x01 00026 #define COMPONENT_CATEGORY_MEMORY 0x02 00027 #define COMPONENT_CATEGORY_NETWORK 0x04 00028 #define COMPONENT_CATEGORY_SYSTEM 0x08 00029 00030 namespace SST { 00031 class Component; 00032 class ConfigGraph; 00033 class PartitionGraph; 00034 class Introspector; 00035 class Module; 00036 class Params; 00037 class SubComponent; 00038 namespace Partition { 00039 class SSTPartitioner; 00040 } 00041 00042 typedef Component* (*componentAllocate)(ComponentId_t, Params&); 00043 typedef Introspector* (*introspectorAllocate)(Params&); 00044 typedef void (*eventInitialize)(void); 00045 typedef Module* (*moduleAllocate)(Params&); 00046 typedef Module* (*moduleAllocateWithComponent)(Component*, Params&); 00047 typedef SubComponent* (*subcomponentAllocate)(Component*, Params&); 00048 typedef SST::Partition::SSTPartitioner* (*partitionFunction)(int, int, int); 00049 typedef void (*generateFunction)(ConfigGraph*, std::string options, int ranks); 00050 typedef void* (*genPythonModuleFunction)(void); 00051 00052 /** Describes Statistics used by a Component. 00053 */ 00054 struct ElementInfoStatistic { 00055 const char* name; /*!< Name of the Statistic to be Enabled */ 00056 const char* description; /*!< Brief description of the Statistic */ 00057 const char* units; /*!< Units associated with this Statistic value */ 00058 const uint8_t enableLevel; /*!< Level to meet to enable statistic 0 = disabled */ 00059 }; 00060 00061 /** Describes Parameters to a Component. 00062 */ 00063 struct ElementInfoParam { 00064 const char *name; /*!< Name of the parameter */ 00065 const char *description; /*!< Brief description of the parameter (ie, what it controls) */ 00066 const char *defaultValue; /*!< Default value (if any) NULL == required parameter with no default, "" == optional parameter, blank default, "foo" == default value */ 00067 }; 00068 00069 /** Describes Ports that the Component can use 00070 */ 00071 struct ElementInfoPort { 00072 const char *name; /*!< Name of the port. Can contain %d for a dynamic port, also %(xxx)d for dynamic port with xxx being the controlling component parameter */ 00073 const char *description; /*!< Brief description of the port (ie, what it is used for) */ 00074 const char **validEvents; /*!< List of fully-qualified event types that this Port expects to send or receive */ 00075 }; 00076 00077 /** Describes a Component and its associated information 00078 */ 00079 struct ElementInfoComponent { 00080 const char *name; /*!< Name of the component */ 00081 const char *description; /*!< Brief description of what the component does */ 00082 void (*printHelp)(FILE *output); /*!< Pointer to a function that will print additional documentation about the component. (optional) */ 00083 componentAllocate alloc; /*!< Pointer to function to allocate a new instance of this component. */ 00084 const ElementInfoParam *params; /*!< List of parameters for which this component expects to look. */ 00085 const ElementInfoPort *ports; /*!< List of ports that this component uses. */ 00086 uint32_t category; /*!< Bit-mask of categories in which this component fits. */ 00087 const ElementInfoStatistic *stats; /*!< List of statistic Names that this component wants enabled. */ 00088 }; 00089 00090 /** Describes an Introspector 00091 */ 00092 struct ElementInfoIntrospector { 00093 const char *name; /*!< Name of the introspector */ 00094 const char *description; /*!< Brief description of what the introspector does. */ 00095 void (*printHelp)(FILE *output); /*!< Pointer to a function that will print additional documentation about the introspector. (optional) */ 00096 introspectorAllocate alloc; /*!< Pointer to a function to allocate a new instance of this introspector. */ 00097 const ElementInfoParam *params; /*!< List of parameters which this introspector uses. */ 00098 }; 00099 00100 /** Describes an Event 00101 */ 00102 struct ElementInfoEvent { 00103 const char *name; /*!< Name of the event */ 00104 const char *description; /*!< Brief description of this event. */ 00105 void (*printHelp)(FILE *output); /*!< Pointer to a function that will print additional documentation about the event. (optional) */ 00106 eventInitialize init; /*!< Pointer to a function to initialize the library for use of this event. (optional) */ 00107 }; 00108 00109 /** Describes a Module 00110 */ 00111 struct ElementInfoModule { 00112 const char *name; /*!< Name of the module. */ 00113 const char *description; /*!< Brief description of the module. */ 00114 void (*printHelp)(FILE *output); /*!< Pointer to a function that will print additional documentation about the module. (optional) */ 00115 moduleAllocate alloc; /*!< Pointer to a function to do a default initialization of the module. */ 00116 moduleAllocateWithComponent alloc_with_comp; /*!< Pointer to a function to initialize a module instance, passing a Component as an argument. */ 00117 const ElementInfoParam *params; /*!< List of parameters which are used by this module. */ 00118 const char *provides; /*!< Name of SuperClass which for this module can be used. */ 00119 }; 00120 00121 struct ElementInfoSubComponent { 00122 const char *name; /*!< Name of the subcomponent. */ 00123 const char *description; /*!< Brief description of the subcomponent. */ 00124 void (*printHelp)(FILE *output); /*!< Pointer to a function that will print additional documentation about the subcomponent (optional) */ 00125 subcomponentAllocate alloc; /*!< Pointer to a function to initialize a subcomponent instance, passing a Component as an argument. */ 00126 const ElementInfoParam *params; /*!< List of parameters which are used by this subcomponent. */ 00127 const ElementInfoStatistic *stats; /*!< List of statistics supplied by this subcomponent. */ 00128 const char *provides; /*!< Name of SuperClass which for this subcomponent can be used. */ 00129 }; 00130 00131 /** Describes a Partitioner 00132 */ 00133 struct ElementInfoPartitioner { 00134 const char *name; /*!< Name of the Partitioner */ 00135 const char *description; /*!< Brief description of the partitioner */ 00136 void (*printHelp)(FILE *output); /*!< Pointer to a function that will print additional documentation about the partitioner. (optional) */ 00137 partitionFunction func; /*!< Function to be called to perform the paritioning */ 00138 }; 00139 00140 /** Describes a Generator 00141 */ 00142 struct ElementInfoGenerator { 00143 const char *name; /*!< Name of the Generator */ 00144 const char *description; /*!< Brief description of the generator */ 00145 void (*printHelp)(FILE *output); /*!< Pointer to a function that will print additional documentation about the generator. (optional) */ 00146 generateFunction func; /*!< Function to be called to perform the graph generation */ 00147 }; 00148 00149 /** Describes all the parts of the Element Library 00150 */ 00151 struct ElementLibraryInfo { 00152 const char *name; /*!< Name of the Library. */ 00153 const char *description; /*!< Brief description of the Library */ 00154 const struct ElementInfoComponent* components; /*!< List of Components contained in the library. */ 00155 const struct ElementInfoEvent* events; /*!< List of Events exported by the library. */ 00156 const struct ElementInfoIntrospector* introspectors; /*!< List of Introspectors provided by the library. */ 00157 const struct ElementInfoModule* modules; /*!< List of Modules provided by the library. */ 00158 const struct ElementInfoSubComponent* subcomponents; /*!< List of SubComponents provided by the library. */ 00159 const struct ElementInfoPartitioner* partitioners; /*!< List of Partitioners provided by the library. */ 00160 genPythonModuleFunction pythonModuleGenerator; /*!< Pointer to Function to generate a Python Module for use in Configurations */ 00161 const struct ElementInfoGenerator* generators; /*!< List of Generators provided by the library. */ 00162 }; 00163 } //namespace SST 00164 00165 #endif // SST_CORE_ELEMENT_H