19 #ifndef QMCPLUSPLUS_TRACEMANAGER_H 20 #define QMCPLUSPLUS_TRACEMANAGER_H 23 #if !defined(DISABLE_TRACEMANAGER) 47 const unsigned int DMAX = 4;
89 APP_ABORT(
"TraceQuantity::incorporate\n cannot merge quantities with differing names\n names: " +
name +
" " +
164 inline bool screen_sample(
const std::string& domain,
const std::string& name,
bool& write)
193 if (default_quantity)
202 if (default_quantity)
208 std::vector<std::string>& deps,
211 bool default_quantity =
false)
218 if (default_quantity)
227 quantities[name].scalar_stream_requested =
true;
229 quantities[name].scalar_write_requested =
true;
236 quantities[name].array_stream_requested =
true;
238 quantities[name].array_write_requested =
true;
266 inline void request_scalar(
const std::set<std::string>& names,
bool write =
false)
268 std::set<std::string>::iterator name;
269 for (name = names.begin(); name != names.end(); ++name)
274 inline void request_array(
const std::set<std::string>& names,
bool write =
false)
276 std::set<std::string>::iterator name;
277 for (name = names.begin(); name != names.end(); ++name)
284 std::map<std::string, TraceQuantity>::iterator it;
293 std::map<std::string, std::set<std::string>>::iterator d;
296 const std::string& name = d->first;
297 std::set<std::string>& deps = d->second;
308 std::map<std::string, TraceQuantity>::iterator it;
354 std::set<std::string>::iterator name;
357 for (name = deps.begin(); name != deps.end(); ++name)
385 std::map<std::string, TraceQuantity>::iterator it;
414 write_selected(
"scalar streams requested",
"scalar_stream_requested");
415 write_selected(
"array streams requested",
"array_stream_requested");
417 write_selected(
"scalar writes requested",
"scalar_write_requested");
418 write_selected(
"array writes requested",
"array_write_requested");
427 inline void write_selected(
const std::string& header,
const std::string& selector)
429 app_log() <<
" " << header <<
":";
431 std::map<std::string, TraceQuantity>::iterator it;
435 bool selected =
false;
436 if (selector ==
"scalar_available")
438 else if (selector ==
"array_available")
440 else if (selector ==
"scalar_stream_requested")
442 else if (selector ==
"array_stream_requested")
444 else if (selector ==
"scalar_write_requested")
446 else if (selector ==
"array_write_requested")
448 else if (selector ==
"stream_scalar")
450 else if (selector ==
"stream_array")
452 else if (selector ==
"write_scalar")
454 else if (selector ==
"write_array")
457 APP_ABORT(
"TraceRequest::write_selected unrecognized selector: " + selector);
486 std::set<std::string> stmp;
496 APP_ABORT(
"TraceRequest::check_presence quantity " + name +
" is not present");
534 inline TraceSample(
const std::string& sdomain,
const std::string& sname,
int sindex,
int sdim,
Vector<T>& ssample)
542 const std::string& sname,
557 inline void initialize(
const std::string& sdomain,
const std::string& sname,
int sindex,
int sdim)
577 bool correct_shape =
true;
579 if (correct_dimension)
585 correct_dimension = correct_dimension &&
shape[d] > 0;
587 correct_shape = tsize ==
size;
589 if (!correct_dimension)
590 APP_ABORT(
"TraceSample::check_shape dimension of sample array is incorrect");
592 APP_ABORT(
"TraceSample::check_shape shape and size of sample array do not match");
629 std::string pad2 = pad +
" ";
631 app_log() << pad <<
" TraceSample " <<
name << std::endl;
633 app_log() << pad << ind <<
" TraceSample " <<
name << std::endl;
635 app_log() << pad2 <<
"name = " <<
name << std::endl;
639 app_log() << pad2 <<
"size = " <<
size << std::endl;
658 const std::string& sname,
662 :
TraceSample<T>(sdomain, sname, sindex, sdim, ssample)
669 const std::string& sname,
674 :
TraceSample<T>(sdomain, sname, sindex, sdim, sshape, ssample)
697 APP_ABORT(
"CombinedTraceSample::add_component attempted to add a different shape component\n my domain: " +
698 this->
domain +
"\n my name: " + this->
name +
"\n component domain: " + component->
domain +
699 "\n component name: " + component->
name);
702 APP_ABORT(
"CombinedTraceSample::add_component attempted to add a different domain component\n my domain: " +
703 this->
domain +
"\n my name: " + this->
name +
"\n component domain: " + component->
domain +
704 "\n component name: " + component->
name);
718 this->
sample[j] += weight * component[j];
726 std::string pad2 = pad +
" ";
727 std::string pad3 = pad2 +
" ";
728 app_log() << pad << ind <<
" CombinedTraceSample " << this->
name << std::endl;
729 app_log() << pad2 <<
"domain = " << this->
domain << std::endl;
731 app_log() << pad2 <<
"components" << std::endl;
737 app_log() << pad2 <<
"end components" << std::endl;
738 app_log() << pad2 <<
"vector address = " << (size_t) & this->
sample << std::endl;
771 inline void assign_sample_index(
const std::string& domain,
const std::string& name,
int index, std::string label =
"")
775 APP_ABORT(
"TraceSamples::checkout " + label +
" variable " + name +
" already exists in domain " + domain);
788 std::array<size_t, D> subshape;
789 for (
int idim = 0; idim < D; idim++)
790 subshape[idim] = shape[idim];
795 app_log() <<
"TraceSamples::checkout_array " << domain <<
" " << name <<
" " << index << std::endl;
806 std::array<size_t, D> subshape;
807 for (
int idim = 0; idim < D; idim++)
808 subshape[idim] = shape[idim];
812 s->array_trace =
true;
814 app_log() <<
"TraceSamples::checkout_array " << domain <<
" " << name <<
" " << index << std::endl;
822 for (
int i = 0; i <
samples.size(); ++i)
832 APP_ABORT(
"TraceSamples::get_trace failed to get trace for quantity " + name +
" in domain " + domain);
854 std::vector<std::string>& names,
855 std::vector<TraceReal>& weights)
857 bool created =
false;
858 if (names.size() != weights.size())
859 APP_ABORT(
"TraceSamples::make_combined_trace names and weights must be the same size");
860 std::map<std::string, std::map<std::string, int>>::iterator it;
863 std::string domain = it->first;
864 std::map<std::string, int>& indices = it->second;
865 bool any_present =
false;
866 for (
int i = 0; i < names.size(); ++i)
867 any_present = any_present || indices.count(names[i]) > 0;
873 for (
int i = 0; i < names.size(); ++i)
875 if (indices.count(names[i]) > 0)
894 for (
int i = 0; i <
samples.size(); i++)
901 for (
int i = 0; i <
samples.size(); i++)
906 app_log() <<
"TraceRequest screening " <<
s.name <<
" in domain " <<
s.domain <<
". stream: " << stream
907 <<
" write: " <<
s.write << std::endl;
908 if (!stream && !
s.is_combined())
909 app_log() <<
"warning: quantity " +
s.name +
" in domain " +
s.domain +
910 " was not requested but is streaming anyway" 918 for (
int i = 0; i <
samples.size(); i++)
939 for (
int i = 0; i <
samples.size(); i++)
947 int min_index = 2000000000;
948 for (
int i = 0; i <
samples.size(); i++)
957 for (
int i = 0; i <
samples.size(); i++)
958 max_index = std::max(max_index,
samples[i]->buffer_end);
993 std::map<std::string, std::map<std::string, int>>::iterator it;
994 std::map<std::string, int>::iterator it2;
997 const std::string& domain = it->first;
998 std::map<std::string, int>& indices = it->second;
1000 for (it2 = indices.begin(); it2 != indices.end(); ++it2)
1002 const std::string& quantity = it2->first;
1023 std::string pad2 = pad +
" ";
1024 std::string pad3 = pad2 +
" ";
1025 std::string pad4 = pad3 +
" ";
1026 app_log() << pad <<
"TraceSamples<" << type <<
">" << std::endl;
1027 app_log() << pad2 <<
"nsamples = " <<
samples.size() << std::endl;
1029 app_log() << pad2 <<
"sample_indices" << std::endl;
1030 std::map<std::string, std::map<std::string, int>>::iterator it;
1031 std::map<std::string, int>::iterator it2;
1034 const std::string& domain = it->first;
1035 std::map<std::string, int>& indices = it->second;
1036 app_log() << pad3 << domain << std::endl;
1037 for (it2 = indices.begin(); it2 != indices.end(); ++it2)
1038 app_log() << pad4 << it2->first <<
" = " << it2->second << std::endl;
1040 app_log() << pad2 <<
"end sample_indices" << std::endl;
1041 app_log() << pad2 <<
"combined_sample_vectors = ";
1045 app_log() << pad2 <<
"combined_samples" << std::endl;
1048 app_log() << pad2 <<
"end combined_samples" << std::endl;
1049 app_log() << pad2 <<
"samples" << std::endl;
1054 app_log() << pad2 <<
"end samples" << std::endl;
1055 app_log() << pad <<
"end TraceSamples<" << type <<
">" << std::endl;
1059 inline void user_report(
const std::string& type,
const std::string& pad =
" ")
1061 std::string pad2 = pad +
" ";
1062 app_log() << pad << type <<
" traces provided by estimators" << std::endl;
1063 std::map<std::string, std::map<std::string, int>>::iterator it;
1064 std::map<std::string, int>::iterator it2;
1067 const std::string& domain = it->first;
1068 std::map<std::string, int>& indices = it->second;
1069 app_log() << pad2 <<
"domain " << domain <<
": ";
1071 for (it2 = indices.begin(); it2 != indices.end(); ++it2)
1074 app_log() << std::endl << pad2 <<
" ";
1076 const std::string& quantity = it2->first;
1085 template<
typename T>
1133 std::vector<std::string>& names,
1134 std::vector<TraceReal>& weights)
1136 bool created_real =
samples->make_combined_trace(name, names, weights);
1140 if (created_real && created_complex)
1142 ">::make_combined_trace\n cannot create real and complex combined traces for the same quantity\n " 1143 "attempted for quantity " +
1160 int sample_size = 0;
1161 samples->set_buffer_ranges(sample_size);
1164 #if defined(TRACE_CHECK) 1168 int nsamples_init = 1;
1179 app_log() <<
" TraceBuffer<" <<
type <<
">::collect_sample()" << std::endl;
1186 int current_row = nrows;
1193 app_log() <<
" increasing # of rows to " << nrows << std::endl;
1200 std::vector<TraceSample<T>*>& ordered_samples =
samples->ordered_samples;
1201 for (
int s = 0;
s < ordered_samples.size();
s++)
1206 auto& sample = tsample.
sample;
1207 for (
int i = 0; i < sample.size(); ++i)
1215 for (
int s = 0;
s < ordered_samples.size();
s++)
1220 auto& sample = tsample.
sample;
1221 for (
int i = 0, ib = 0; i < sample.size(); ++i, ib += 2)
1230 samples->reset_combined_samples();
1233 #if defined(TRACE_CHECK) 1240 inline void write() {
APP_ABORT(
"TraceBuffer::write has not yet been implemented"); }
1245 std::string pad2 = pad +
" ";
1246 app_log() << pad <<
"TraceBuffer<" <<
type <<
">" << std::endl;
1253 app_log() << pad <<
"end TraceBuffer<" <<
type <<
">" << std::endl;
1268 samples->register_hdf_data(f);
1275 ">::register_hdf_data() some hdf groups are still open at the end of registration");
1286 app_log() <<
"TraceBuffer<" <<
type <<
">::write_hdf() " << file_pointer <<
" " <<
buffer.
size(0) <<
" " 1303 int ssize =
samples->total_size();
1306 if (sample_size != ssize)
1308 app_log() <<
"sample_size = " << sample_size <<
"\ntotal_size = " << ssize << std::endl;
1309 APP_ABORT(
"TraceBuffer::test_buffer_write sample_size and total_size do not match");
1312 int nsamples =
samples->size();
1313 int min_index =
samples->min_buffer_index();
1314 int max_index =
samples->max_buffer_index();
1324 APP_ABORT(
"TraceBuffer::test_buffer_write min_index!=0\n min_index=" << min_index);
1325 if (max_index != sample_size)
1326 APP_ABORT(
"TraceBuffer::test_buffer_write max_index!=sample_size");
1329 test_buffer.
resize(1, sample_size);
1330 std::fill(test_buffer.
begin(), test_buffer.
end(), 0);
1332 int row_size = test_buffer.
size(1);
1333 int offset = row * row_size;
1334 int* loc1 = &test_buffer(offset);
1335 int* loc2 = &test_buffer(row, 0);
1337 APP_ABORT(
"TraceBuffer::test_buffer_write serialized buffer offset improperly computed");
1340 std::vector<TraceSample<T>*>& ordered_samples =
samples->ordered_samples;
1341 for (
int s = 0;
s < ordered_samples.size();
s++)
1344 std::vector<T>& sample = tsample.
sample;
1346 for (
int i = 0; i < sample.size(); ++i)
1347 test_buffer(boffset + i) = 1;
1354 for (
int s = 0;
s < ordered_samples.size();
s++)
1357 std::vector<std::complex<T>>& sample = tsample.
sample;
1359 for (
int i = 0, ib = 0; i < sample.size(); ++i, ib += tsample.
unit_size)
1361 test_buffer(boffset + ib) = 1;
1362 test_buffer(boffset + ib + 1) = 1;
1369 for (
int i = 0; i < row_size; ++i)
1370 if (!test_buffer(row, i))
1371 APP_ABORT(
"TraceBuffer::test_buffer_write write to row is not contiguous");
1379 app_log() <<
"TraceBuffer::test_buffer_collect" << std::endl;
1380 std::string scalars =
"scalars";
1381 std::map<std::string, std::map<std::string, int>>::iterator dom;
1382 std::map<std::string, int>::iterator var;
1383 std::map<std::string, std::map<std::string, int>>& domains =
samples->sample_indices;
1384 std::vector<TraceSample<T>*>& tsamples =
samples->samples;
1385 std::map<std::string, int>& scalar_vars = domains[scalars];
1386 for (var = scalar_vars.begin(); var != scalar_vars.end(); var++)
1388 const std::string& name = var->first;
1392 bool any_present =
false;
1393 for (dom = domains.begin(); dom != domains.end(); dom++)
1395 const std::string& domain = dom->first;
1396 if (domain != scalars)
1398 std::map<std::string, int>& vars = dom->second;
1399 if (vars.count(name) > 0)
1405 for (
int i = start; i < end; i++)
1406 svalue +=
buffer(current_row, i);
1413 app_log() <<
" " << name <<
" " << value <<
" " << svalue << std::endl;
1475 APP_ABORT(
"TraceManager::makeClone only the master copy should call this function");
1519 inline void put(xmlNodePtr cur,
bool allow_traces, std::string series_root)
1524 bool traces_requested = cur != NULL;
1531 app_log() <<
" traces requested : " << traces_requested << std::endl;
1537 std::string writing =
"yes";
1538 std::string
scalar =
"yes";
1539 std::string array =
"yes";
1540 std::string scalar_defaults =
"yes";
1541 std::string array_defaults =
"yes";
1542 std::string verbose_write =
"no";
1544 attrib.
add(writing,
"write");
1546 attrib.
add(array,
"array");
1547 attrib.
add(scalar_defaults,
"scalar_defaults");
1548 attrib.
add(array_defaults,
"array_defaults");
1551 attrib.
add(verbose_write,
"verbose");
1552 attrib.
add(array,
"particle");
1553 attrib.
add(array_defaults,
"particle_defaults");
1556 bool scalars_on =
scalar ==
"yes";
1557 bool arrays_on = array ==
"yes";
1558 bool use_scalar_defaults = scalar_defaults ==
"yes";
1559 bool use_array_defaults = array_defaults ==
"yes";
1560 verbose = verbose_write ==
"yes";
1568 APP_ABORT(
"TraceManager::put " +
format +
" is not a valid file format for traces\n valid options is: hdf");
1573 std::set<std::string> scalar_requests;
1574 std::set<std::string> array_requests;
1575 xmlNodePtr element = cur->children;
1576 while (element != NULL)
1578 std::string name((
const char*)element->name);
1579 if (name ==
"scalar_traces")
1581 std::string defaults =
"no";
1583 eattrib.
add(defaults,
"defaults");
1584 eattrib.
put(element);
1585 use_scalar_defaults = use_scalar_defaults && defaults ==
"yes";
1586 if (!use_scalar_defaults)
1588 std::vector<std::string> scalar_list;
1590 scalar_requests.insert(scalar_list.begin(), scalar_list.end());
1593 else if (name ==
"array_traces" || name ==
"particle_traces")
1595 std::string defaults =
"no";
1597 eattrib.
add(defaults,
"defaults");
1598 eattrib.
put(element);
1599 use_array_defaults = use_array_defaults && defaults ==
"yes";
1600 if (!use_array_defaults)
1602 std::vector<std::string> array_list;
1604 array_requests.insert(array_list.begin(), array_list.end());
1607 else if (name !=
"text")
1610 " is not a valid sub-element of <trace/>\n valid options are: scalar_traces, array_traces");
1612 element = element->next;
1690 const std::string& name,
1719 const std::string& name,
1744 return checkout_complex<D>(
default_domain, name, n1, n2, n3, n4);
1748 const std::string& name,
1851 std::vector<TraceReal> weights;
1852 weights.resize(names.size());
1853 std::fill(weights.begin(), weights.end(), 1.0);
1858 std::vector<std::string>& names,
1859 std::vector<TraceReal>& weights)
1864 app_log() <<
"TraceManager::make_combined_trace " <<
master_copy <<
" " << name << std::endl;
1875 app_log() <<
"TraceManager::check_clones" << std::endl;
1876 bool all_same =
true;
1880 for (
int i = 0; i < clones.size(); ++i)
1885 all_same = all_same && int_same && real_same;
1889 for (
int i = 0; i < clones.size(); ++i)
1891 APP_ABORT(
"TraceManager::check_clones trace buffer widths of clones do not match\n contiguous write is " 1892 "impossible\n this was first caused by clones contributing array traces from identical, but " 1893 "differently named, particlesets such as e, e2, e3 ... (fixed)\n please check the TraceManager " 1894 "summaries printed above");
1942 APP_ABORT(
"TraceManager::write_buffers should not be called from non-master copy");
1955 clones[0]->write_summary();
1963 APP_ABORT(
"TraceManager::open_file should not be called from non-master copy");
1982 APP_ABORT(
"TraceManager::close_file should not be called from non-master copy");
1986 inline void startRun(
int blocks, std::vector<TraceManager*>& clones)
1997 APP_ABORT(
"TraceManager::startRun should not be called from non-master copy");
2011 APP_ABORT(
"TraceManager::stopRun should not be called from non-master copy");
2032 std::string pad2 = pad +
" ";
2034 app_log() << pad <<
"TraceManager (detailed summary)" << std::endl;
2044 app_log() << pad <<
"end TraceManager" << std::endl;
2050 std::string pad2 = pad +
" ";
2051 std::string pad3 = pad2 +
" ";
2053 app_log() << pad <<
"Traces report" << std::endl;
2055 app_log() << pad2 <<
"Type and domain breakdown of streaming quantities:" << std::endl;
2056 std::set<std::string>::iterator req;
2067 if (clones.size() == 0)
2068 APP_ABORT(
"TraceManager::open_hdf_file no trace clones exist, cannot open file");
2071 std::array<char, 32> ptoken;
2077 length = std::snprintf(ptoken.data(), ptoken.size(),
".p%05d",
rank);
2078 else if (nprocs > 1000)
2079 length = std::snprintf(ptoken.data(), ptoken.size(),
".p%04d",
rank);
2081 length = std::snprintf(ptoken.data(), ptoken.size(),
".p%03d",
rank);
2083 throw std::runtime_error(
"Error generating filename");
2084 file_name.append(ptoken.data(), length);
2086 file_name +=
".traces.h5";
2088 app_log() <<
"TraceManager::open_hdf_file opening traces hdf file " << file_name << std::endl;
2089 hdf_file = std::make_unique<hdf_archive>();
2090 bool successful =
hdf_file->create(file_name);
2092 APP_ABORT(
"TraceManager::open_hdf_file failed to open hdf file " + file_name);
2105 for (
int ip = 0; ip < clones.size(); ++ip)
2132 using TraceComp = std::complex<TraceReal>;
2142 inline bool streaming_array(
const std::string& name) {
return false; }
2143 inline bool streaming(
const std::string& name) {
return false; }
2145 inline bool streaming() {
return false; }
2152 inline void request_scalar(
const std::string& name,
bool write =
false) {}
2153 inline void request_array(
const std::string& name,
bool write =
false) {}
2163 inline void contribute_scalar(
const std::string& name,
bool default_quantity =
false) {}
2164 inline void contribute_array(
const std::string& name,
bool default_quantity =
false) {}
2166 std::vector<std::string>& deps,
2169 bool default_quantity =
false)
2174 template<
typename T>
2181 template<
typename T>
2182 struct CombinedTraceSample :
public TraceSample<T>
2201 inline void put(xmlNodePtr cur,
bool allow_traces, std::string series_root) {}
2215 const ParticleSet& P,
2230 const ParticleSet& P,
2241 const ParticleSet& P,
2252 inline TraceSample<TraceReal>*
get_real_trace(
const std::string& name) {
return 0; }
2254 inline TraceSample<TraceReal>*
get_real_trace(
const ParticleSet& P,
const std::string& name) {
return 0; }
2257 inline TraceSample<TraceComp>*
get_complex_trace(
const ParticleSet& P,
const std::string& name) {
return 0; }
2272 inline void make_combined_trace(
const std::string& name, std::vector<std::string>& names) {}
2277 inline void write_buffers(std::vector<TraceManager*>& clones,
int block) {}
2280 inline void startRun(
int blocks, std::vector<TraceManager*>& clones) {}
TinyVector< int, DMAX > shape
void resize(size_type n, Type_t val=Type_t())
Resize the container.
TraceSample< TraceComp > * get_complex_trace(const std::string &domain, const std::string &name)
Array< TraceInt, D > * checkout_int(const std::string &name, const ParticleSet &P, int n2=0, int n3=0, int n4=0)
CombinedTraceSample< T > * get_combined_trace(const std::string &domain, const std::string &name)
std::string default_domain
void set_samples(TraceSamples< T > &s)
bool method_allows_traces
TraceBuffer< TraceInt > int_buffer
void put(xmlNodePtr cur, bool allow_traces, std::string series_root)
Array< TraceComp, D > * checkout_complex(const std::string &name, int n1=1, int n2=0, int n3=0, int n4=0)
bool quantity_present(const std::string &name)
void write(T &data, const std::string &aname)
write the data to the group aname and check status runtime error is issued on I/O error ...
void initialize(const std::string &sdomain, const std::string &sname, int sindex, int sdim)
bool h5d_append(hid_t grp, const std::string &aname, hsize_t ¤t, hsize_t ndims, const hsize_t *const dims, const T *const first, hsize_t chunk_size=1, hid_t xfer_plist=H5P_DEFAULT)
TraceSamples< TraceReal > real_samples
void delete_iter(IT first, IT last)
delete the pointers in [first,last)
std::map< std::string, TraceQuantity > quantities
helper functions for EinsplineSetBuilder
void open_hdf_file(std::vector< TraceManager *> &clones)
hid_t top() const
return the top of the group stack
int rank() const
return the rank
void incorporate(const TraceQuantity &other)
void write_hdf(hdf_archive &f)
bool streaming_array(const std::string &name)
bool open_groups()
check if any groups are open group stack will have entries if so
void write_buffers(std::vector< TraceManager *> &clones, int block)
void register_hdf_data(hdf_archive &f)
bool array_write_requested
TraceSample< TraceReal > * get_real_trace(const ParticleSet &P, const std::string &name)
size_t getTotalNum() const
void startRun(int blocks, std::vector< TraceManager *> &clones)
bool put(xmlNodePtr cur)
assign attributes to the set
CombinedTraceSample< TraceComp > * get_complex_combined_trace(const std::string &name)
CombinedTraceSample< TraceComp > * get_complex_combined_trace(const std::string &domain, const std::string &name)
std::vector< Vector< T > * > combined_sample_vectors
void user_report(const std::string &pad=" ")
Array< TraceComp, D > * checkout_complex(const std::string &name, const ParticleSet &P, int n2=0, int n3=0, int n4=0)
void buffer_sample(int current_step)
Array< TraceComp, D > * checkout_complex(const std::string &domain, const std::string &name, int n1=1, int n2=0, int n3=0, int n4=0)
void set_type(std::string stype)
bool streaming_scalar(const std::string &name)
void write_selected(const std::string &header, const std::string &selector)
void write_hdf(hdf_archive &f, hsize_t &file_pointer)
CombinedTraceSample< TraceInt > * get_int_combined_trace(const ParticleSet &P, const std::string &name)
bool streaming_default_scalars
std::vector< TraceSample< T > * > ordered_samples
virtual bool is_combined()
Array< TraceInt, D > * checkout_int(const std::string &name, int n1=1, int n2=0, int n3=0, int n4=0)
void resize(const std::array< SIZET, D > &dims)
Resize the container.
int size() const
return the number of tasks
void check_presence(const std::string &name)
void determine_stream_write()
bool same_as(TraceBuffer< T > &ref)
void startBlock(int nsteps)
CombinedTraceSample< TraceInt > * get_int_combined_trace(const std::string &domain, const std::string &name)
void write_summary(int ind=-1, std::string pad=" ")
Array< TraceReal, D > * checkout_real(const std::string &domain, const std::string &name, int n1=1, int n2=0, int n3=0, int n4=0)
CombinedTraceSample< TraceReal > * get_real_combined_trace(const std::string &domain, const std::string &name)
Declaration of OhmmsElementBase and define xml-related macros.
bool streaming(const std::string &name)
void copy(const Array< T1, 3 > &src, Array< T2, 3 > &dest)
std::vector< TraceSample< T > * > components
Wrapping information on parallelism.
std::string scalar_domain
void write_summary(std::string type, std::string pad=" ")
omp_int_t omp_get_thread_num()
TraceSample< TraceReal > * get_real_trace(const std::string &domain, const std::string &name)
Specialized paritlce class for atomistic simulations.
TraceManager(Communicate *comm=0)
void set_unit_size(int usize)
size_type size() const
return the current size
bool is_combined() override
Communicate * communicator
bool TraceSample_comp(TraceSample< T > *left, TraceSample< T > *right)
std::map< std::string, TraceInt > meta_int
void make_combined_trace(const std::string &name, std::vector< std::string > &names)
void write_summary(std::string pad=" ")
void make_combined_trace(const std::string &name, std::vector< std::string > &names, std::vector< TraceReal > &weights)
TraceSample< TraceInt > * get_int_trace(const ParticleSet &P, const std::string &name)
CombinedTraceSample(const std::string &sdomain, const std::string &sname, int sindex, int sdim, TinyVector< int, DMAX > sshape, Vector< T > &ssample)
TraceSamples< TraceInt > int_samples
void transfer_state_from(const TraceManager &tm)
void open_file(std::vector< TraceManager *> &clones)
class to handle a set of attributes of an xmlNode
Array< T, D > * checkout_array(const ParticleSet &P, const std::string &name, TinyVector< int, DMAX > shape)
void test_buffer_collect(int current_row)
void contribute_scalar(const std::string &name, bool default_quantity=false)
std::vector< TraceReal > weights
std::string lowerCase(const std::string_view s)
++17
bool scalar_write_requested
const std::string & parentName() const
return parent's name
bool same_shape(TraceSample< T > *other)
TraceSample< TraceInt > * get_int_trace(const std::string &name)
#define APP_ABORT(msg)
Widely used but deprecated fatal error macros from legacy code.
void user_report(std::string pad=" ")
void make_combined_trace(const std::string &name, std::vector< std::string > &names, std::vector< TraceReal > &weights)
TraceSample< TraceComp > * get_complex_trace(const ParticleSet &P, const std::string &name)
TraceSample(const std::string &sdomain, const std::string &sname, int sindex, int sdim, Vector< T > &ssample)
void incorporate(TraceRequest &other)
void write_buffers_hdf(std::vector< TraceManager *> &clones)
void user_report(const std::string &type, const std::string &pad=" ")
TraceManager * makeClone()
void set_unit_size(int usize)
std::vector< CombinedTraceSample< T > * > combined_samples
TraceSamples< TraceComp > comp_samples
TraceSamples< std::complex< T > > * complex_samples
bool scalar_stream_requested
TraceSample< TraceInt > * get_int_trace(const std::string &domain, const std::string &name)
void set_buffer_range(int &bstart)
CombinedTraceSample< TraceReal > * get_real_combined_trace(const ParticleSet &P, const std::string &name)
void request_array(const std::string &name, bool write=false)
Array< TraceReal, D > * checkout_real(const std::string &name, int n1=1, int n2=0, int n3=0, int n4=0)
void push(const std::string &gname, bool createit=true)
push a group to the group stack
bool putContent(T &a, xmlNodePtr cur)
replaces a's value with the first "element" in the "string" returned by XMLNodeString{cur}.
TraceSample(const std::string &sdomain, const std::string &sname, int sindex, int sdim, TinyVector< int, DMAX > sshape, Vector< T > &ssample)
void contribute_combined(const std::string &name, std::vector< std::string > &deps, bool scalar=false, bool array=false, bool default_quantity=false)
void request_scalar(const std::set< std::string > &names, bool write=false)
std::vector< TraceSample< T > * > samples
Array< TraceInt, D > * checkout_int(const std::string &domain, const std::string &name, int n1=1, int n2=0, int n3=0, int n4=0)
void relay_stream_info(TraceRequest &other)
Array< TraceReal, D > * checkout_real(const std::string &name, const ParticleSet &P, int n2=0, int n3=0, int n4=0)
sycl::event copy_n(sycl::queue &aq, const T1 *restrict VA, size_t array_size, T2 *restrict VC, const std::vector< sycl::event > &events)
void assign_sample_index(const std::string &domain, const std::string &name, int index, std::string label="")
TraceSample< TraceComp > * get_complex_trace(const std::string &name)
void set_buffer_ranges(int &starting_index)
std::map< std::string, TraceReal > meta_real
CombinedTraceSample< TraceInt > * get_int_combined_trace(const std::string &name)
void reset_combined_samples()
void request_array(const std::set< std::string > &names, bool write=false)
void contribute_array(const std::string &name, bool default_quantity=false)
void register_hdf_data(hdf_archive &f)
std::complex< TraceReal > TraceComp
bool writing_default_arrays
Container_t::iterator begin()
bool writing_default_scalars
CombinedTraceSample(const std::string &sdomain, const std::string &sname, int sindex, int sdim, Vector< T > &ssample)
void set_samples(TraceSamples< std::complex< T >> &s)
void write_summary(std::string pad=" ")
void test_buffer_write(int sample_size)
void add_component(TraceSample< T > *component, TraceReal weight)
bool streaming_default_arrays
void write_summary_combined(int ind, std::string pad=" ")
std::map< std::string, std::map< std::string, int > > sample_indices
std::map< std::string, std::set< std::string > > combined_dependencies
bool array_stream_requested
CombinedTraceSample< TraceReal > * get_real_combined_trace(const std::string &name)
void add(PDT &aparam, const std::string &aname, std::vector< PDT > candidate_values={}, TagStatus status=TagStatus::OPTIONAL)
add a new attribute
TraceSamples< T > * samples
bool screen_sample(const std::string &domain, const std::string &name, bool &write)
void set_scalar_domain(const std::string &domain)
std::unique_ptr< hdf_archive > hdf_file
TraceSample< TraceReal > * get_real_trace(const std::string &name)
TraceBuffer< TraceReal > real_buffer
void screen_writes(TraceRequest &request)
void request_scalar(const std::string &name, bool write=false)
bool make_combined_trace(const std::string &name, std::vector< std::string > &names, std::vector< TraceReal > &weights)
TraceSample< T > * get_trace(const std::string &domain, const std::string &name)
CombinedTraceSample< TraceComp > * get_complex_combined_trace(const ParticleSet &P, const std::string &name)
void check_clones(std::vector< TraceManager *> &clones)
Array< T, D > * checkout_array(const std::string &domain, const std::string &name, TinyVector< int, DMAX > shape)
void guarantee_presence(const std::string &name, bool combined=false)
std::map< std::string, std::string > meta_string
virtual ~TraceSample()=default
Container_t::iterator end()
OHMMS_PRECISION TraceReal