Cypress  1.0
C++ Spiking Neural Network Simulation Framework
genn.hpp
Go to the documentation of this file.
1 /*
2  * Cypress -- C++ Spiking Neural Network Simulation Framework
3  * Copyright (C) 2019 Christoph Ostrau
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 
27 #pragma once
28 
29 #include <cypress/core/backend.hpp>
30 #include <cypress/util/json.hpp>
31 #include <stdexcept>
32 #include <string>
33 #include <vector>
34 
35 namespace cypress {
36 // Forward declaration
37 struct network_storage;
38 
39 class GeNN : public Backend {
40 private:
41  void do_run(NetworkBase &network, Real duration) const override;
42 
43  double m_timestep = 0.1;
44  bool m_gpu = false;
45  bool m_double = false;
46  bool m_timing = false;
47  bool m_keep_compile = false;
48  bool m_disable_status = false;
49  std::shared_ptr<network_storage> m_storage;
50  size_t m_recording_buffer_size = 10000;
51 
52 public:
56  class GeNNSimulatorNotFound : public std::runtime_error {
57  public:
58  using std::runtime_error::runtime_error;
59  };
60 
76  GeNN(const Json &setup = Json());
77 
81  ~GeNN() override = default;
82 
86  std::unordered_set<const NeuronType *> supported_neuron_types()
87  const override;
88 
92  std::string name() const override { return "genn"; }
93 
94  // void load_pop(const NeuronGroup& neuron);
95 };
96 } // namespace cypress
97 
98 extern "C" {
105 {
106  return new cypress::GeNN(setup);
107 }
108 }
Definition: backend.hpp:50
Definition: genn.hpp:39
std::string name() const override
Definition: genn.hpp:92
std::unordered_set< const NeuronType * > supported_neuron_types() const override
double Real
Definition: types.hpp:56
nlohmann::json Json
Definition: json.hpp:27
cypress::Backend * make_genn_backend(const cypress::Json &setup)
Expose constructor for program dynamically loading this lib.
Definition: genn.hpp:104
Definition: network_base.hpp:116
Definition: brainscales_lib.hpp:39
GeNN(const Json &setup=Json())
~GeNN() override=default