SNABSuite  0.x
Spiking Neural Architecture Benchmark Suite
max_input.hpp
Go to the documentation of this file.
1 /*
2  * SNABSuite -- Spiking Neural Architecture Benchmark Suite
3  * Copyright (C) 2016 Christoph Jenzen
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 #pragma once
20 
21 #ifndef SNABSUITE_SNABS_MAX_INPUT_HPP
22 #define SNABSUITE_SNABS_MAX_INPUT_HPP
23 
24 #include <cypress/cypress.hpp>
25 
26 #include "common/snab_base.hpp"
27 
28 namespace SNAB {
33 class MaxInputOneToOne : public SNABBase {
34 private:
35  cypress::PopulationBase m_pop;
36  cypress::Population<cypress::SpikeSourceArray> m_pop_source;
37  size_t m_num_neurons = 0, m_num_spikes = 0;
38  cypress::NeuronParameter m_neuro_params;
39  cypress::Real simulation_length = 100; // ms
40 
41 public:
42  MaxInputOneToOne(const std::string backend, size_t bench_index);
43  cypress::Network &build_netw(cypress::Network &netw) override;
44  void run_netw(cypress::Network &netw) override;
45  std::vector<std::array<cypress::Real, 4>> evaluate() override;
46  std::shared_ptr<SNABBase> clone() override
47  {
48  return std::make_shared<MaxInputOneToOne>(m_backend, m_bench_index);
49  }
50 };
51 
56 class MaxInputAllToAll : public SNABBase {
57 private:
58  cypress::PopulationBase m_pop;
59  cypress::Population<cypress::SpikeSourceArray> m_pop_source;
60  size_t m_num_neurons = 0, m_num_inp_neurons = 0, m_num_spikes = 0;
61  cypress::NeuronParameter m_neuro_params;
62  cypress::Real simulation_length = 100; // ms
63 
64 public:
65  MaxInputAllToAll(const std::string backend, size_t bench_index);
66  cypress::Network &build_netw(cypress::Network &netw) override;
67  void run_netw(cypress::Network &netw) override;
68  std::vector<std::array<cypress::Real, 4>> evaluate() override;
69  std::shared_ptr<SNABBase> clone() override
70  {
71  return std::make_shared<MaxInputAllToAll>(m_backend, m_bench_index);
72  }
73 };
74 
80 protected:
81  cypress::PopulationBase m_pop;
82  cypress::Population<cypress::SpikeSourceArray> m_pop_source;
83  size_t m_num_neurons = 0, m_num_inp_neurons = 0, m_num_spikes = 0;
84  cypress::NeuronParameter m_neuro_params;
85  cypress::Real simulation_length = 100; // ms
87  std::string name, std::string backend,
88  std::initializer_list<std::string> indicator_names,
89  std::initializer_list<std::string> indicator_types,
90  std::initializer_list<std::string> indicator_measures,
91  std::initializer_list<std::string> indicator_units,
92  std::initializer_list<std::string> required_parameters,
93  size_t bench_index);
94 
95 public:
96  MaxInputFixedOutConnector(const std::string backend, size_t bench_index);
97  cypress::Network &build_netw(cypress::Network &netw) override;
98  void run_netw(cypress::Network &netw) override;
99  std::vector<std::array<cypress::Real, 4>> evaluate() override;
100  virtual std::shared_ptr<SNABBase> clone() override
101  {
102  return std::make_shared<MaxInputFixedOutConnector>(m_backend,
103  m_bench_index);
104  }
105 };
106 
112 public:
113  MaxInputFixedInConnector(const std::string backend, size_t bench_index);
114  cypress::Network &build_netw(cypress::Network &netw) override;
115  std::shared_ptr<SNABBase> clone() override
116  {
117  return std::make_shared<MaxInputFixedInConnector>(m_backend,
118  m_bench_index);
119  }
120 };
121 } // namespace SNAB
122 #endif /* SNABSUITE_SNABS_MAX_INPUT_HPP */
cypress::NeuronParameter m_neuro_params
Definition: max_input.hpp:84
std::vector< std::array< cypress::Real, 4 > > evaluate() override
This should contain the evaluation process and return the result in order of those in names()...
std::string m_backend
String which contains the name of the simulation backend.
Definition: snab_base.hpp:210
cypress::PopulationBase m_pop
Definition: max_input.hpp:81
std::shared_ptr< SNABBase > clone() override
Virtual method cloning the SNAB without knowing which SNAB it is.
Definition: max_input.hpp:115
void run_netw(cypress::Network &netw) override
Virtual Base class for SNABs(Benchmarks). All SNABs should have seperate building of networks...
Definition: snab_base.hpp:33
std::shared_ptr< SNABBase > clone() override
Virtual method cloning the SNAB without knowing which SNAB it is.
Definition: max_input.hpp:46
MaxInputOneToOne(const std::string backend, size_t bench_index)
const std::vector< std::string > & indicator_measures() const
Getter for SNABSSuite::m_indicator_measures.
Definition: snab_base.hpp:128
const std::vector< std::string > & indicator_names() const
Getter for SNABSSuite::m_indicator_names.
Definition: snab_base.hpp:106
const std::vector< std::string > & indicator_types() const
Getter for SNABSSuite::m_indicator_types.
Definition: snab_base.hpp:117
cypress::Network & build_netw(cypress::Network &netw) override
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.
virtual std::shared_ptr< SNABBase > clone() override
Virtual method cloning the SNAB without knowing which SNAB it is.
Definition: max_input.hpp:100
const size_t m_bench_index
Definition: snab_base.hpp:260
std::shared_ptr< SNABBase > clone() override
Virtual method cloning the SNAB without knowing which SNAB it is.
Definition: max_input.hpp:69
cypress::Population< cypress::SpikeSourceArray > m_pop_source
Definition: max_input.hpp:82