NEURON
nrnreport.cpp
Go to the documentation of this file.
1 /*
2 # =============================================================================
3 # Copyright (c) 2016 - 2022 Blue Brain Project/EPFL
4 #
5 # See top-level LICENSE file for details.
6 # =============================================================================
7 */
8 
9 #include <iostream>
10 #include <vector>
11 #include <algorithm>
12 #include <map>
13 #include <set>
14 #include <cmath>
15 
25 #ifdef ENABLE_SONATA_REPORTS
26 #include "bbp/sonata/reports.h"
27 #endif
28 
29 namespace coreneuron {
30 
31 // Size in MB of the report buffer
32 static int size_report_buffer = 4;
33 
34 void nrn_flush_reports(double t) {
35  // flush before buffer is full
36 #ifdef ENABLE_SONATA_REPORTS
37  sonata_check_and_flush(t);
38 #endif
39 }
40 
41 /** in the current implementation, we call flush during every spike exchange
42  * interval. Hence there should be sufficient buffer to hold all reports
43  * for the duration of mindelay interval. In the below call we specify the
44  * number of timesteps that we have to buffer.
45  * TODO: revisit this because spike exchange can happen few steps before/after
46  * mindelay interval and hence adding two extra timesteps to buffer.
47  */
48 void setup_report_engine(double dt_report, double mindelay) {
49  int min_steps_to_record = static_cast<int>(std::round(mindelay / dt_report));
50  static_cast<void>(min_steps_to_record);
51 #ifdef ENABLE_SONATA_REPORTS
52  sonata_set_min_steps_to_record(min_steps_to_record);
53  sonata_setup_communicators();
54  sonata_prepare_datasets();
55 #endif
56 }
57 
58 // Size in MB of the report buffers
61 #ifdef ENABLE_SONATA_REPORTS
62  sonata_set_max_buffer_size_hint(size_report_buffer);
63 #endif
64 }
65 
67 #ifdef ENABLE_SONATA_REPORTS
68  sonata_flush(nrn_threads[0]._t);
69 #endif
70 }
71 } // Namespace coreneuron
THIS FILE IS AUTO GENERATED DONT MODIFY IT.
NrnThread * nrn_threads
Definition: multicore.cpp:56
void nrn_flush_reports(double t)
Definition: nrnreport.cpp:34
void set_report_buffer_size(int n)
Definition: nrnreport.cpp:59
void finalize_report()
Definition: nrnreport.cpp:66
void setup_report_engine(double dt_report, double mindelay)
in the current implementation, we call flush during every spike exchange interval.
Definition: nrnreport.cpp:48
static int size_report_buffer
Definition: nrnreport.cpp:32
int const size_t const size_t n
Definition: nrngsl.h:10