25 bool driver_allows_logs = allow_logs;
27 bool logs_requested = inp.
present;
35 app_log() <<
"\n WalkerLogManager::put() " << std::endl;
36 app_log() <<
" logs requested : " << logs_requested << std::endl;
37 app_log() <<
" driver allows logs : " << driver_allows_logs << std::endl;
44 bool quantiles = inp.
get<
bool>(
"quantiles");
74 app_log() <<
"WalkerLogManager::makeCollector " << std::endl;
75 return std::make_unique<WalkerLogCollector>(
state);
85 throw std::runtime_error(
"BUG collectors are empty but walker logs are active");
87 app_log() <<
"WalkerLogManager::startRun " << std::endl;
100 app_log() <<
"WalkerLogManager::stopRun " << std::endl;
113 app_log() <<
"WalkerLogManager::writeBuffers " << std::endl;
138 for (
size_t c = 0; c < collectors.size(); ++c)
142 for (
size_t r = 0; r < tc.
energies.size(); ++r)
153 auto step = std::get<0>(v);
163 if (step != prev_step)
169 auto nmed = (n1 + n2) / 2;
215 app_log() <<
"WalkerLogManager::checkCollectors" << std::endl;
216 if (collectors.size() > 0)
218 bool all_same =
true;
220 for (
int i = 0; i < collectors.size(); ++i)
229 throw std::runtime_error(
230 "WalkerLogManager::checkCollectors log buffer widths of collectors do not match\n contiguous write is " 231 "impossible\n this was first caused by collectors contributing array logs from identical, but " 232 "differently named, particlesets such as e, e2, e3 ... (fixed)\n please check the WalkerLogManager " 233 "summaries printed above");
242 app_log() <<
"WalkerLogManager::openFile " << std::endl;
250 app_log() <<
"WalkerLogManager::closeFile " << std::endl;
258 app_log() <<
"WalkerLogManager::openHDFFile " << std::endl;
259 if (collectors.size() == 0)
260 throw std::runtime_error(
"WalkerLogManager::openHDFFile no log collectors exist, cannot open file");
264 std::array<char, 32> ptoken;
270 length = std::snprintf(ptoken.data(), ptoken.size(),
".p%05d",
rank);
271 else if (nprocs > 1000)
272 length = std::snprintf(ptoken.data(), ptoken.size(),
".p%04d",
rank);
274 length = std::snprintf(ptoken.data(), ptoken.size(),
".p%03d",
rank);
276 throw std::runtime_error(
"Error generating filename");
277 file_name.append(ptoken.data(), length);
279 file_name +=
".wlogs.h5";
281 app_log() <<
"WalkerLogManager::openHDFFile opening logs hdf file " << file_name << std::endl;
283 hdf_file = std::make_unique<hdf_archive>();
285 bool successful =
hdf_file->create(file_name);
287 throw std::runtime_error(
"WalkerLogManager::openHDFFile failed to open hdf file " + file_name);
295 app_log() <<
"WalkerLogManager::writeBuffersHDF " << std::endl;
326 for (
int ip = 0; ip < collectors.size(); ++ip)
358 app_log() <<
"WalkerLogManager::closeHDFFile " << std::endl;
std::string file_root
file prefix for the current driver
bool write_min_data
whether to write full data for the minimum energy walker at each step
void closeHDFFile()
close the logs file (HDF format)
RefVector< WalkerLogCollector > collectors_in_run_
void addRow(WalkerLogBuffer< T > other, size_t i)
add a data row from another buffer to this one
Abstraction of information on executor environments.
helper functions for EinsplineSetBuilder
int rank() const
return the rank
void checkCollectors(const RefVector< WalkerLogCollector > &collectors) const
check consistency of walker buffer row sizes
bool verbose
controls verbosity of log file writes
bool write_med_data
whether to write full data for the median energy walker at each step
int step_period
period between MC steps for data collection
WalkerLogBuffer< WLog::Int > walker_property_int_buffer
buffer containing integer walker properties
bool registered_hdf
whether walker quantity data ("data_layout") has been recorded in HDF
std::vector< std::tuple< size_t, WLog::Real, size_t, size_t > > energy_order
used to sort energy information for identifying walkers by energy quantile
void startRun(RefVector< WalkerLogCollector > &&collectors)
open the logs file and check consistency of the collectors at the start of a run
WalkerLogBuffer< WLog::Int > wmed_property_int_buffer
buffer containing integer properties for the median energy walkers
void checkBuffers()
Check that all buffers have the same number of rows.
WalkerLogBuffer< WLog::Real > walker_property_real_buffer
buffer containing real-valued walker properties
Crowd-level resource for walker log collection.
void stopRun()
close the logs file at the end of a run
bool write_max_data
whether to write full data for the maximum energy walker at each step
int size() const
return the number of tasks
std::string label
label for this data in HDF file
bool logs_active
whether logs are active in the current driver
void writeBuffersHDF()
write data buffers to the logs file (HDF format)
Wrapping information on parallelism.
WalkerLogBuffer< WLog::Real > walker_particle_real_buffer
buffer containing per-particle walker data
void openFile(const RefVector< WalkerLogCollector > &collectors)
open the logs file
void writeBuffers()
collect min/max/median walker data and write buffered walker log data to file
void closeFile()
close the logs file
WalkerLogBuffer< WLog::Real > wmed_property_real_buffer
buffer containing real-valued properties for the median energy walkers
WalkerLogBuffer< WLog::Real > wmax_particle_real_buffer
buffer containing per-particle properties for the maximum energy walkers
bool sameAs(const WalkerLogBuffer< T > &ref)
compare row size of this buffer to another one
WalkerLogState state
output state
std::unique_ptr< hdf_archive > hdf_file
access to HDF file
unsigned int getWorkerId()
WalkerLogBuffer< WLog::Real > wmax_property_real_buffer
buffer containing real-valued properties for the maximum energy walkers
WalkerLogBuffer< WLog::Real > wmin_property_real_buffer
buffer containing real-valued properties for the minimum energy walkers
bool write_particle_data
whether to write per-particle data for all walkers
WalkerLogBuffer< WLog::Int > wmax_property_int_buffer
buffer containing integer properties for the maximum energy walkers
WalkerLogBuffer< WLog::Int > wmin_property_int_buffer
buffer containing integer properties for the minimum energy walkers
std::vector< std::reference_wrapper< T > > RefVector
WalkerLogBuffer< WLog::Real > wmin_particle_real_buffer
buffer containing per-particle properties for the minimum energy walkers
std::vector< WLog::Real > energies
LocalEnergy information for each walker throughout the MC block.
void registerHDFData(hdf_archive &f)
write the data_layout for all walker quantities in the HDF file
void resetBuffer()
resize the buffer to zero
void writeHDF(hdf_archive &f)
write the buffer data into the HDF file
WalkerLogBuffer< WLog::Real > wmed_particle_real_buffer
buffer containing per-particle properties for the median energy walkers
void openHDFFile(const RefVector< WalkerLogCollector > &collectors)
open the logs file (HDF format)
T get(const std::string &name) const
Communicate * communicator
WalkerLogManager(WalkerLogInput &inp, bool allow_logs, std::string series_root, Communicate *comm=0)
std::vector< size_t > steps
MC step information for each walker throughout the MC block.
std::unique_ptr< WalkerLogCollector > makeCollector() const
create a WalkerLogCollector
hsize_t hdf_file_pointer
HDF file pointer.
Native representation for walker logs input.