Skip to content

Commit b397cd4

Browse files
Thoemi09Wentzell
authored andcommitted
Add tests for mc_generic and remove old ones
1 parent 9a85b1c commit b397cd4

File tree

5 files changed

+199
-293
lines changed

5 files changed

+199
-293
lines changed

c++/triqs/mc_tools/mc_generic.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ namespace triqs::mc_tools {
7878
for (; !stop_flag; ++cycle_counter) {
7979
try {
8080
// do cycle_length MC steps / cycle
81-
for (std::int64_t i = 0; i < params.cycle_length; i++) {
81+
for (std::int64_t i = 0; i < params.cycle_length; ++i) {
8282
if (triqs::signal_handler::received()) throw triqs::signal_handler::exception{};
8383
// Metropolis step
8484
metropolis_step();
@@ -92,7 +92,7 @@ namespace triqs::mc_tools {
9292
} catch (std::exception const &err) {
9393
// log the exception and node number, either abort or report to other nodes
9494
std::cerr << fmt::format("[Rank {}] Error int mc_generic::run: Exception occured:\n{}\n", rank, err.what());
95-
if (params.propagate_exception) {
95+
if (exception_monitor) {
9696
exception_monitor->report_local_event();
9797
break;
9898
} else {
@@ -101,7 +101,7 @@ namespace triqs::mc_tools {
101101
}
102102

103103
// recompute fraction done and runtime so far
104-
percentage_done_ = cycle_counter * 100.0 / params.ncycles;
104+
percentage_done_ = static_cast<double>(cycle_counter) * 100.0 / params.ncycles;
105105
double runtime = run_timer_;
106106

107107
// is it time to print simulation info
@@ -247,7 +247,7 @@ namespace triqs::mc_tools {
247247
info += fmt::format("[Rank {}] Measurement durations:\n{}", c.rank(), measures_.get_timings(fmt::format("[Rank {}] ", c.rank())));
248248
info += fmt::format("[Rank {}] Move statistics:\n{}", c.rank(), moves_.get_statistics(fmt::format("[Rank {}] ", c.rank())));
249249

250-
// gather all output string on rank 0 to print in order
250+
// gather all output strings on rank 0 to print in order
251251
auto all_infos = mpi::gather(info, c);
252252
if (c.rank() == 0) {
253253
report_(3) << all_infos;
@@ -262,7 +262,7 @@ namespace triqs::mc_tools {
262262
// current simulation parameters
263263
auto const rank = params.comm.rank();
264264
double const runtime = run_timer_;
265-
auto const cycles_per_sec = cycle_counter / runtime;
265+
auto const cycles_per_sec = static_cast<double>(cycle_counter) / runtime;
266266

267267
// do the printing
268268
if (percentage_done_ < 0) {
@@ -288,7 +288,7 @@ namespace triqs::mc_tools {
288288
params.after_cycle_duty();
289289
if (params.enable_calibration) moves_.calibrate(params.comm);
290290
if (params.enable_measures) {
291-
nmeasures_done_++;
291+
++nmeasures_done_;
292292
for (auto &m : measures_aux_) m();
293293
measures_.accumulate(sign_);
294294
}

test/c++/mc_tools/CMakeLists.txt

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
all_tests()
22

3-
set(TEST_MPI_NUMPROC 2)
4-
add_cpp_test(different_moves_mc)
5-
add_cpp_test(callback)
6-
set(TEST_MPI_NUMPROC 3)
7-
add_cpp_test(different_moves_mc)
83
set(TEST_MPI_NUMPROC 4)
94
add_cpp_test(mctools_move_set)
10-
add_cpp_test(different_moves_mc)
5+
add_cpp_test(mctools_measure_set)
6+
add_cpp_test(mctools_mc_generic)

test/c++/mc_tools/callback.cpp

Lines changed: 0 additions & 101 deletions
This file was deleted.

test/c++/mc_tools/different_moves_mc.cpp

Lines changed: 0 additions & 180 deletions
This file was deleted.

0 commit comments

Comments
 (0)