Cypress  1.0
C++ Spiking Neural Network Simulation Framework
slurm.hpp
Go to the documentation of this file.
1 /*
2  * Cypress -- C++ Spiking Neural Network Simulation Framework
3  * Copyright (C) 2017 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 CYPRESS_BACKEND_SLURM_HPP
22 #define CYPRESS_BACKEND_SLURM_HPP
23 
25 
26 #include <string>
27 #include <vector>
28 
30 #include <cypress/core/backend.hpp>
31 #include <cypress/util/json.hpp>
32 
33 namespace cypress {
34 
35 class Slurm : public ToJson {
36 private:
37  // Flags for different running modes:
38  // m_write_binnf sets wether binnf files should be written
39  bool m_write_binnf = true;
40  // Trigger the python process via srun
41  bool m_exec_python = true;
42  // Read back results from the python process
43  bool m_read_results = true;
44 
45  // keep json/cbor files
46  bool m_keep_file = false;
47 
48  // True: use json, false: use cbor
49  bool m_json = false;
50 
51  std::string m_norm_simulator;
52 
53  void do_run(NetworkBase &network, Real duration) const override;
54 
55 public:
65  Slurm(const std::string &simulator, const Json &setup = Json());
66 
70  ~Slurm() override;
71 
72  void set_flags(size_t num);
73 
74  void set_base_filename(const std::string &filename) { m_path = filename; }
75  const std::string &get_base_filename() const { return m_path; }
76 };
77 } // namespace cypress
78 
79 #endif /* CYPRESS_BACKEND_SLURM_HPP */
Slurm(const std::string &simulator, const Json &setup=Json())
~Slurm() override
double Real
Definition: types.hpp:56
std::string m_path
Definition: to_json.hpp:41
nlohmann::json Json
Definition: json.hpp:27
const std::string & get_base_filename() const
Definition: slurm.hpp:75
Definition: network_base.hpp:116
Definition: to_json.hpp:34
Definition: brainscales_lib.hpp:39
Definition: slurm.hpp:35
void set_flags(size_t num)
void set_base_filename(const std::string &filename)
Definition: slurm.hpp:74