QMCPACK
QMCState Struct Reference

class to definte global variables to keep track a run More...

+ Collaboration diagram for QMCState:

Public Member Functions

 QMCState ()
 constructor More...
 
void initialize (int argc, char **argv)
 initialize options from the command-line More...
 
void print_options (std::ostream &os)
 print command-line options More...
 
void print_memory_change (const std::string &who, size_t before)
 print memory increase More...
 
void print_git_info_if_present (std::ostream &os)
 Print git info (commit hash, etc) if project was build from git repository. More...
 

Public Attributes

size_t memory_allocated {0}
 size of memory allocated in byte per MPI More...
 
int qmc_counter {0}
 init for <qmc> section More...
 
int mpi_groups {1}
 number of mpi groups More...
 
bool use_density {false}
 true, if density is used, e.g. MPC More...
 
bool dryrun {false}
 true, if it is a dryrun More...
 
bool io_node {true}
 true, print out file More...
 

Detailed Description

class to definte global variables to keep track a run

Definition at line 26 of file qmc_common.h.

Constructor & Destructor Documentation

◆ QMCState()

QMCState ( )
default

constructor

Member Function Documentation

◆ initialize()

void initialize ( int  argc,
char **  argv 
)

initialize options from the command-line

Definition at line 28 of file qmc_common.cpp.

References OHMMS::Controller, QMCState::dryrun, Communicate::finalize(), QMCState::io_node, QMCState::print_git_info_if_present(), and Communicate::rank().

Referenced by main().

29 {
30  io_node = (OHMMS::Controller->rank() == 0);
31  bool stopit = false;
32  //going to use better option library
33  int i = 1;
34  while (i < argc)
35  {
36  std::string c(argv[i]);
37  if (c.find("--dryrun") < c.size())
38  {
39  dryrun = true;
40  }
41  else if (c.find("--save_wfs") < c.size())
42  {
43  if (io_node)
44  std::cerr << std::endl
45  << "ERROR: command line option --save_wfs has been removed."
46  << "Use save_coefs input tag as described in the manual." << std::endl;
47  stopit = true;
48  }
49  else if (c.find("--help") < c.size())
50  {
51  stopit = true;
52  }
53  else if (c.find("--version") < c.size())
54  {
55  stopit = true;
56  }
57  else if (c.find("--vacuum") < c.size())
58  {
59  if (io_node)
60  std::cerr << std::endl
61  << "ERROR: command line option --vacuum has been removed. "
62  << "Use vacuum input tag as described in the manual." << std::endl;
63  stopit = true;
64  }
65  else if (c.find("--noprint") < c.size())
66  { //do not print Jastrow or PP
67  io_node = false;
68  }
69  ++i;
70  }
71  if (stopit && io_node)
72  {
73  std::cerr << std::endl
74  << "QMCPACK version " << QMCPACK_VERSION_MAJOR << "." << QMCPACK_VERSION_MINOR << "."
75  << QMCPACK_VERSION_PATCH << " built on " << __DATE__ << std::endl;
76  print_git_info_if_present(std::cerr);
77  std::cerr << std::endl << "Usage: qmcpack input [--dryrun --gpu]" << std::endl << std::endl;
78  }
79  if (stopit)
80  {
82  exit(1);
83  }
84 }
void print_git_info_if_present(std::ostream &os)
Print git info (commit hash, etc) if project was build from git repository.
Definition: qmc_common.cpp:99
int rank() const
return the rank
Definition: Communicate.h:116
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
bool dryrun
true, if it is a dryrun
Definition: qmc_common.h:37
bool io_node
true, print out file
Definition: qmc_common.h:39
void finalize()

◆ print_git_info_if_present()

void print_git_info_if_present ( std::ostream &  os)

Print git info (commit hash, etc) if project was build from git repository.

Definition at line 99 of file qmc_common.cpp.

Referenced by QMCState::initialize(), and QMCMain::QMCMain().

100 {
101 #ifdef QMCPACK_GIT_BRANCH
102  os << std::endl;
103  os << " Git branch: " << QMCPACK_GIT_BRANCH << std::endl;
104  os << " Last git commit: " << QMCPACK_GIT_HASH << std::endl;
105  os << " Last git commit date: " << QMCPACK_GIT_COMMIT_LAST_CHANGED << std::endl;
106  os << " Last git commit subject: " << QMCPACK_GIT_COMMIT_SUBJECT << std::endl;
107 #endif
108 }

◆ print_memory_change()

void print_memory_change ( const std::string &  who,
size_t  before 
)

print memory increase

Parameters
whothe name of the class/function calling this
beforememory_allocated before calling print

Definition at line 93 of file qmc_common.cpp.

References qmcplusplus::app_log(), and QMCState::memory_allocated.

Referenced by VMC::resetRun().

94 {
95  before = memory_allocated - before;
96  app_log() << "MEMORY increase " << (before >> 20) << " MB " << who << std::endl;
97 }
std::ostream & app_log()
Definition: OutputManager.h:65
size_t memory_allocated
size of memory allocated in byte per MPI
Definition: qmc_common.h:29

◆ print_options()

void print_options ( std::ostream &  os)

print command-line options

Definition at line 86 of file qmc_common.cpp.

References QMCState::dryrun.

Referenced by QMCMain::QMCMain().

87 {
88  os << " Global options " << std::endl;
89  if (dryrun)
90  os << " dryrun : All QMC and loop sections will be skipped." << std::endl;
91 }
bool dryrun
true, if it is a dryrun
Definition: qmc_common.h:37

Member Data Documentation

◆ dryrun

bool dryrun {false}

true, if it is a dryrun

Definition at line 37 of file qmc_common.h.

Referenced by QMCMain::execute(), QMCState::initialize(), and QMCState::print_options().

◆ io_node

bool io_node {true}

◆ memory_allocated

size_t memory_allocated {0}

size of memory allocated in byte per MPI

Definition at line 29 of file qmc_common.h.

Referenced by QMCState::print_memory_change(), and VMC::resetRun().

◆ mpi_groups

int mpi_groups {1}

◆ qmc_counter

int qmc_counter {0}

init for <qmc> section

Definition at line 31 of file qmc_common.h.

Referenced by QMCMain::execute(), QMCMain::executeLoop(), VMC::put(), CSVMC::put(), and QMCDriver::putQMCInfo().

◆ use_density

bool use_density {false}

true, if density is used, e.g. MPC

Definition at line 35 of file qmc_common.h.

Referenced by EinsplineSetBuilder::ReadOrbitalInfo_ESHDF(), and QMCMain::validateXML().


The documentation for this struct was generated from the following files: