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 
24 #ifdef ENABLE_SONATA_REPORTS
25 #include "bbp/sonata/reports.h"
26 #endif
27 
28 namespace coreneuron {
29 
30 // Size in MB of the report buffer
31 static int size_report_buffer = 4;
32 
33 void nrn_flush_reports(double t) {
34  // flush before buffer is full
35 #ifdef ENABLE_SONATA_REPORTS
36  sonata_check_and_flush(t);
37 #endif
38 }
39 
40 /** in the current implementation, we call flush during every spike exchange
41  * interval. Hence there should be sufficient buffer to hold all reports
42  * for the duration of mindelay interval. In the below call we specify the
43  * number of timesteps that we have to buffer.
44  * TODO: revisit this because spike exchange can happen few steps before/after
45  * mindelay interval and hence adding two extra timesteps to buffer.
46  */
47 void setup_report_engine(double dt_report, double mindelay) {
48  int min_steps_to_record = static_cast<int>(std::round(mindelay / dt_report));
49  static_cast<void>(min_steps_to_record);
50 #ifdef ENABLE_SONATA_REPORTS
51  sonata_set_min_steps_to_record(min_steps_to_record);
52  sonata_setup_communicators();
53  sonata_prepare_datasets();
54 #endif
55 }
56 
57 // Size in MB of the report buffers
60 #ifdef ENABLE_SONATA_REPORTS
61  sonata_set_max_buffer_size_hint(size_report_buffer);
62 #endif
63 }
64 
66 #ifdef ENABLE_SONATA_REPORTS
67  sonata_flush(nrn_threads[0]._t);
68 #endif
69 }
70 } // 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:33
void set_report_buffer_size(int n)
Definition: nrnreport.cpp:58
void finalize_report()
Definition: nrnreport.cpp:65
void setup_report_engine(double dt_report, double mindelay)
in the current implementation, we call flush during every spike exchange interval.
Definition: nrnreport.cpp:47
static int size_report_buffer
Definition: nrnreport.cpp:31
int const size_t const size_t n
Definition: nrngsl.h:10