Cypress  1.0
C++ Spiking Neural Network Simulation Framework
nmpi.hpp
Go to the documentation of this file.
1 /*
2  * Cypress -- C++ Spiking Neural Network Simulation Framework
3  * Copyright (C) 2016 Andreas Stöckel
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 CYPRESS_BACKEND_NMPI_HPP
22 #define CYPRESS_BACKEND_NMPI_HPP
23 
24 #include <memory>
25 #include <stdexcept>
26 #include <string>
27 #include <vector>
28 
30 #include <cypress/core/backend.hpp>
31 
32 namespace cypress {
33 
34 // Forward declarations
35 class PyNN_;
36 
41 class NMPI : public Backend {
42 private:
46  std::unique_ptr<Backend> m_pynn;
47 
53  void do_run(NetworkBase &network, Real duration) const override;
54 
55  void init(
56  std::unique_ptr<Backend> pynn, int &argc, const char *argv[],
57  const std::vector<std::string> &files = std::vector<std::string>(),
58  bool scan_args = true);
59 
60  void init_bs(
61  const std::string &bs_backend, int &argc, const char *argv[],
62  Json setup,
63  const std::vector<std::string> &files = std::vector<std::string>(),
64  bool scan_args = true);
65 
66 public:
71  class NoNMPIPlatform : public std::runtime_error {
72  public:
73  using std::runtime_error::runtime_error;
74  };
75 
79  class InvalidCommandLine : public std::runtime_error {
80  public:
81  using std::runtime_error::runtime_error;
82  };
83 
98  NMPI(std::unique_ptr<Backend> pynn, int &argc, const char *argv[],
99  const std::vector<std::string> &files = std::vector<std::string>(),
100  bool scan_args = true);
101 
115  NMPI(const std::string &pynn_backend, int &argc, const char *argv[],
116  const std::vector<std::string> &files = std::vector<std::string>(),
117  bool scan_args = true);
118 
122  ~NMPI() override;
123 
127  std::unordered_set<const NeuronType *> supported_neuron_types()
128  const override;
129 
133  std::string name() const override;
134 
139  static bool check_args(int argc, const char *argv[]);
140 };
141 } // namespace cypress
142 
143 #endif /* CYPRESS_BACKEND_NMPI_HPP */
Definition: backend.hpp:50
Definition: nmpi.hpp:71
double Real
Definition: types.hpp:56
std::string name() const override
nlohmann::json Json
Definition: json.hpp:27
static bool check_args(int argc, const char *argv[])
std::unordered_set< const NeuronType * > supported_neuron_types() const override
~NMPI() override
Definition: network_base.hpp:116
Definition: nmpi.hpp:79
Definition: brainscales_lib.hpp:39
NMPI(std::unique_ptr< Backend > pynn, int &argc, const char *argv[], const std::vector< std::string > &files=std::vector< std::string >(), bool scan_args=true)
Definition: nmpi.hpp:41