23#include <boost/algorithm/string.hpp>
24#include <boost/format.hpp>
36template <
typename JobContainer>
38 libint2::initialize();
40 std::string progFile = jobfile_;
41 std::unique_ptr<JobOperator> master = std::unique_ptr<JobOperator>(
44 master->getLogger().setMultithreading(
true);
45 master->getLogger().setPreface(
Log::info,
"\nMST INF");
46 master->getLogger().setPreface(
Log::error,
"\nMST ERR");
47 master->getLogger().setPreface(
Log::warning,
"\nMST WAR");
48 master->getLogger().setPreface(
Log::debug,
"\nMST DBG");
49 progObs_->InitFromProgFile(progFile, *(master.get()));
52 std::vector<std::unique_ptr<JobOperator>> jobOps;
54 for (
Index id = 0;
id < nThreads_;
id++) {
55 jobOps.push_back(std::unique_ptr<JobOperator>(
59 for (
Index id = 0;
id < nThreads_; ++id) {
60 CustomizeLogger(*jobOps[
id]);
64 std::cout << std::endl;
67 for (
Index id = 0;
id < nThreads_;
id++) {
71 for (
Index id = 0;
id < nThreads_;
id++) {
72 jobOps[id]->WaitDone();
76 for (
Index id = 0;
id < nThreads_;
id++) {
77 std::cout << std::endl << (jobOps[id]->getLogger()) << std::flush;
84 progObs_->SyncWithProgFile(*(master.get()));
89template <
typename JobContainer>
93 Job *job =
master_.progObs_->RequestNextJob(*
this);
99 this->
master_.progObs_->ReportJobDone(*job, res, *
this);
104template <
typename JobContainer>
107 std::cout <<
"\n... ... Initialized with " <<
nThreads_ <<
" threads.\n";
111 std::cout <<
"\n... ... Using " <<
openmp_threads_ <<
" openmp threads for "
118template <
typename JobContainer>
122 Logger &log = thread.getLogger();
127 (format(
"\nT%1$02d INF ...") % thread.getId()).str());
129 (format(
"\nT%1$02d ERR ...") % thread.getId()).str());
131 (format(
"\nT%1$02d WAR ...") % thread.getId()).str());
133 (format(
"\nT%1$02d DBG ...") % thread.getId()).str());
Logger is used for thread-safe output of messages.
void setPreface(Log::Level level, const std::string &preface)
void setReportLevel(Log::Level ReportLevel)
void setMultithreading(bool maverick)
ParallelXJobCalc< JobContainer > & master_
void Run() override
Run() executes the actual code.
typename JobContainer::value_type Job
void ParseCommonOptions(const tools::Property &options)
typename Job::JobResult Result
virtual void CustomizeLogger(QMThread &thread)
bool Evaluate(const Topology &top) final
Container for segments and box and atoms.
void setMaxThreads(Index)
base class for all analysis tools
static Level current_level