21 #ifndef SNABSUITE_COMMON_SNAB_BASE_HPP 22 #define SNABSUITE_COMMON_SNAB_BASE_HPP 24 #include <cypress/cypress.hpp> 52 SNABBase(std::string name, std::string backend,
56 std::initializer_list<std::string> indicator_units,
57 std::initializer_list<std::string> required_parameters,
70 virtual cypress::Network &
build_netw(cypress::Network &network) = 0;
85 virtual void run_netw(cypress::Network &network) = 0;
139 virtual std::vector<std::array<cypress::Real, 4>>
evaluate() = 0;
184 virtual std::shared_ptr<SNABBase>
clone() = 0;
258 std::string
_debug_filename(
const std::string append = std::string())
const;
cypress::Json evaluate_json()
The result of evaluation() is converted into the format used by the HBP benchmark repository...
cypress::Json get_config() const
Getter for the config file.
virtual std::vector< std::array< cypress::Real, 4 > > evaluate()=0
This should contain the evaluation process and return the result in order of those in names()...
cypress::Json m_config_file
Platform specific config file which is read in with the constructor.
std::string m_backend
String which contains the name of the simulation backend.
void set_config(cypress::Json json)
Setting a new config file. Note that before building the new network you probably want to reset the n...
const std::vector< std::string > m_indicator_types
indicator_types can be e.g. "quality", "performance", "energy consumption". See also SNABBase::indica...
virtual cypress::Network & build_netw(cypress::Network &network)=0
Building the neural network for benchmarking. If you want to use an external network, you should use the first version of building (and the corresponding run function), for the member network use the second function. The implementation is contained in the first one.
const std::string m_snab_name
The name of the Benchmark/SNAB.
cypress::Network & build()
Calls SNABBase::build_netw with the internal network.
virtual ~SNABBase()
Default destructor.
Virtual Base class for SNABs(Benchmarks). All SNABs should have seperate building of networks...
std::string _debug_filename(const std::string append=std::string()) const
Beginning of the filename of all debug data (including directories)
cypress::Network m_netw
Internal spiking network which should be used by the SNAB.
const std::vector< std::string > m_indicator_names
For formatting the output in the correct structure introduced in the SP9 Guidebook, the evaluation process needs the exact order of the names, types and measures of the results returned from the function SNABBase::evaluate(). indicator_names should be unique for the measurement and represent the idea behind the value.
cypress::Real NaN()
Used to indicate bad or invalid results.
const std::vector< std::string > & indicator_measures() const
Getter for SNABSSuite::m_indicator_measures.
const std::vector< std::string > & indicator_names() const
Getter for SNABSSuite::m_indicator_names.
void reset_network()
Reset the internal cypress network, therefore deleting all old populations. For example in several co...
const std::vector< std::string > m_indicator_units
indicator_units should be the "unit of the measurement", therefore the unit of the value...
const std::vector< std::string > & indicator_types() const
Getter for SNABSSuite::m_indicator_types.
bool m_valid
Flag which tracks whether the SNAB can be executed on the backend This can be set in config file by s...
const std::vector< std::string > m_indicator_measures
indicator_measures should be the "type of the measurement", or what has been measures, e.g. norm, p-value, time. See also SNABBase::indicator_names.
bool valid() const
Returns the state of the m_valid flag. Simulation should not be executed when valid() returns false...
virtual std::shared_ptr< SNABBase > clone()=0
Virtual method cloning the SNAB without knowing which SNAB it is.
virtual void run_netw(cypress::Network &network)=0
void run()
Calls SNABBase::run_netw on the internal network.
SNABBase(std::string name, std::string backend, std::initializer_list< std::string > indicator_names, std::initializer_list< std::string > indicator_types, std::initializer_list< std::string > indicator_measures, std::initializer_list< std::string > indicator_units, std::initializer_list< std::string > required_parameters, size_t bench_index)
Constructor which reads in platform specific config file For description of the indicator initializer...
const size_t m_bench_index
const std::string snab_name() const
Returns the name of the current benchmark.