Thread pool for global fits.
More...
#include <JFremantle_t.hh>
Thread pool for global fits.
Definition at line 33 of file JFremantle_t.hh.
◆ input_type
◆ output_type
◆ JFremantle()
JACOUSTICS::JFremantle::JFremantle |
( |
const JGeometry & | geometry, |
|
|
const JSoundVelocity & | velocity, |
|
|
const JFitParameters & | parameters, |
|
|
const size_t | ns, |
|
|
const size_t | backlog = std::numeric_limits<size_t>::max() ) |
|
inline |
Constructor.
- Parameters
-
geometry | detector geometry |
velocity | sound velocity |
parameters | parameters |
ns | number of threads |
backlog | backlog |
Definition at line 49 of file JFremantle_t.hh.
53 :
56 {
59
61
62 for (size_t i = 0; i < ns; ++i) {
63
64 thread worker([this, geometry, velocity, parameters]() {
65
67
68 for (
JGlobalfit katoomba(geometry, velocity, parameters); ; ) {
69
70 {
71 unique_lock<mutex> lock(
in);
72
73 cv.wait(lock, [
this]() {
return stop || !
input.empty(); });
74
76 return;
77 }
78
80
82 }
83
85
87
88 if (
result.chi2 /
result.ndf <= katoomba.parameters.chi2perNDF) {
89
90 {
91 unique_lock<mutex> lock(
out);
92
94
103 katoomba.gandalf.numberOfIterations),
107 }
108 }
109 }
110 }
111 });
112
113 workers.emplace_back(std::move(worker));
114 }
115 }
static output_type * output
optional output
std::condition_variable cw
std::vector< std::thread > workers
static JMATH::JQuantile_t Q
chi2/NDF
std::condition_variable cv
static int detid
detector identifier
static bool squash
squash transmissions in output
std::queue< input_type > input
virtual bool put(const T &object)=0
Object output.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Global fit of prameterised detector geometry to acoustics data.
Auxiliary data structure to convert model to super event.
void put(const double x)
Put value.
◆ ~JFremantle()
JACOUSTICS::JFremantle::~JFremantle |
( |
| ) |
|
|
inline |
Destructor.
Definition at line 121 of file JFremantle_t.hh.
122 {
124
125 {
126 unique_lock<mutex> lock(
in);
127
129 }
130
132
134 worker.join();
135 }
136 }
◆ enqueue()
void JACOUSTICS::JFremantle::enqueue |
( |
input_type & | data | ) |
|
|
inline |
Queue data.
- Parameters
-
Definition at line 144 of file JFremantle_t.hh.
145 {
147
148 {
149 unique_lock<mutex> lock(
in);
150
152
154 throw runtime_error("The thread pool has been stopped.");
155 }
156
157 input.emplace(std::move(data));
158 }
159
161 }
◆ detid
int JACOUSTICS::JFremantle::detid = -1 |
|
static |
◆ squash
bool JACOUSTICS::JFremantle::squash = false |
|
static |
◆ output
◆ workers
std::vector<std::thread> JACOUSTICS::JFremantle::workers |
|
private |
◆ input
std::queue<input_type> JACOUSTICS::JFremantle::input |
|
private |
◆ in
std::mutex JACOUSTICS::JFremantle::in |
|
private |
◆ out
std::mutex JACOUSTICS::JFremantle::out |
|
private |
◆ cv
std::condition_variable JACOUSTICS::JFremantle::cv |
|
private |
◆ cw
std::condition_variable JACOUSTICS::JFremantle::cw |
|
private |
◆ stop
bool JACOUSTICS::JFremantle::stop |
|
private |
◆ backlog
size_t JACOUSTICS::JFremantle::backlog |
|
private |
The documentation for this class was generated from the following files: