Commit 9507dd11 authored by Lukas Weber's avatar Lukas Weber
Browse files

fix checkpoint failure if .tmp files exist

parent 30b17301
...@@ -50,7 +50,9 @@ void mc::_do_update() { ...@@ -50,7 +50,9 @@ void mc::_do_update() {
clock_gettime(CLOCK_MONOTONIC_RAW, &tend); clock_gettime(CLOCK_MONOTONIC_RAW, &tend);
double sweep_time = (tend.tv_sec - tstart.tv_sec) + 1e-9 * (tend.tv_nsec - tstart.tv_nsec); double sweep_time = (tend.tv_sec - tstart.tv_sec) + 1e-9 * (tend.tv_nsec - tstart.tv_nsec);
measure.add("_ll_sweep_time", sweep_time); if(is_thermalized()) {
measure.add("_ll_sweep_time", sweep_time);
}
} }
void mc::_pt_update_param(int target_rank, const std::string &param_name, double new_param) { void mc::_pt_update_param(int target_rank, const std::string &param_name, double new_param) {
...@@ -70,7 +72,7 @@ void mc::_write(const std::string &dir) { ...@@ -70,7 +72,7 @@ void mc::_write(const std::string &dir) {
// blocks limit scopes of the dump file handles to ensure they are closed at the right time. // blocks limit scopes of the dump file handles to ensure they are closed at the right time.
{ {
std::error_code ec; std::error_code ec;
std::filesystem::copy(dir + ".meas.h5", dir + ".meas.h5.tmp", std::filesystem::copy_options::none, ec); std::filesystem::copy_file(dir + ".meas.h5", dir + ".meas.h5.tmp", std::filesystem::copy_options::overwrite_existing, ec);
if(ec && ec != std::errc::no_such_file_or_directory) { if(ec && ec != std::errc::no_such_file_or_directory) {
throw std::system_error(ec); throw std::system_error(ec);
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment