QMCPACK
qmc_common.h
Go to the documentation of this file.
1 //////////////////////////////////////////////////////////////////////////////////////
2 // This file is distributed under the University of Illinois/NCSA Open Source License.
3 // See LICENSE file in top directory for details.
4 //
5 // Copyright (c) 2016 Jeongnim Kim and QMCPACK developers.
6 //
7 // File developed by: Jeremy McMinnis, jmcminis@gmail.com, University of Illinois at Urbana-Champaign
8 // Anouar Benali, benali@anl.gov, Argonne National Laboratory
9 // Jeongnim Kim, jeongnim.kim@gmail.com, University of Illinois at Urbana-Champaign
10 // Mark A. Berrill, berrillma@ornl.gov, Oak Ridge National Laboratory
11 //
12 // File created by: Jeongnim Kim, jeongnim.kim@gmail.com, University of Illinois at Urbana-Champaign
13 //////////////////////////////////////////////////////////////////////////////////////
14 
15 
16 #ifndef QMCPLUSPLUS_GLOBAL_OBJECTS_H
17 #define QMCPLUSPLUS_GLOBAL_OBJECTS_H
18 
19 #include <ostream>
20 #include <string>
21 
22 namespace qmcplusplus
23 {
24 /** class to definte global variables to keep track a run
25  */
26 struct QMCState
27 {
28  ///size of memory allocated in byte per MPI
29  size_t memory_allocated{0};
30  ///init for <qmc/> section
31  int qmc_counter{0};
32  ///number of mpi groups
33  int mpi_groups{1};
34  ///true, if density is used, e.g. MPC
35  bool use_density{false};
36  ///true, if it is a dryrun
37  bool dryrun{false};
38  ///true, print out file
39  bool io_node{true};
40 
41  ///constructor
42  QMCState();
43  ///initialize options from the command-line
44  void initialize(int argc, char** argv);
45  ///print command-line options
46  void print_options(std::ostream& os);
47  /** print memory increase
48  * @param who the name of the class/function calling this
49  * @param before memory_allocated before calling print
50  */
51  void print_memory_change(const std::string& who, size_t before);
52 
53  /// Print git info (commit hash, etc) if project was build from git repository
54  void print_git_info_if_present(std::ostream& os);
55 };
56 
57 ///a unique QMCState during a run
58 extern QMCState qmc_common;
59 
60 } // namespace qmcplusplus
61 
62 #endif
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
helper functions for EinsplineSetBuilder
Definition: Configuration.h:43
QMCState()
constructor
void initialize(int argc, char **argv)
initialize options from the command-line
Definition: qmc_common.cpp:28
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
int qmc_counter
init for <qmc> section
Definition: qmc_common.h:31
class to definte global variables to keep track a run
Definition: qmc_common.h:26
int mpi_groups
number of mpi groups
Definition: qmc_common.h:33
void print_options(std::ostream &os)
print command-line options
Definition: qmc_common.cpp:86
size_t memory_allocated
size of memory allocated in byte per MPI
Definition: qmc_common.h:29
void print_memory_change(const std::string &who, size_t before)
print memory increase
Definition: qmc_common.cpp:93
QMCState qmc_common
a unique QMCState during a run
Definition: qmc_common.cpp:111
bool use_density
true, if density is used, e.g. MPC
Definition: qmc_common.h:35