Unverified Commit 8e0bff07 authored by Peter Doak's avatar Peter Doak Committed by GitHub
Browse files

Merge pull request #178 from gbalduzz/write_checkpoints

Write checkpoints
parents 4e259a0b 927762e3
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -139,8 +139,10 @@ set(DCA_LIBS
  cluster_domains
  quantum_domains
  time_and_frequency_domains
  signals
  symmetrization
  coarsegraining
  stdc++fs # std::filesystem
  ${DCA_CONCURRENCY_LIB}
  ${DCA_THREADING_LIBS}
  lapack
+4 −1
Original line number Diff line number Diff line
@@ -14,13 +14,14 @@
#include <string>
#include <iostream>

#include "dca/application/dca_loop_dispatch.hpp"
#include "dca/config/cmake_options.hpp"
// Defines Concurrency, Threading, ParametersType, DcaData, DcaLoop, and Profiler.
#include "dca/config/dca.hpp"
#include "dca/io/json/json_reader.hpp"
#include "dca/util/git_version.hpp"
#include "dca/util/modules.hpp"
#include "dca/application/dca_loop_dispatch.hpp"
#include "dca/util/signal_handler.hpp"

int main(int argc, char** argv) {
  if (argc < 2) {
@@ -31,6 +32,8 @@ int main(int argc, char** argv) {
  Concurrency concurrency(argc, argv);

  try {
    dca::util::SignalHandler::init(concurrency.id() == concurrency.first());

    std::string input_file(argv[1]);

    Profiler::start();
+27 −0
Original line number Diff line number Diff line
// Copyright (C) 2020 ETH Zurich
// Copyright (C) 2020 UT-Battelle, LLC
// All rights reserved.
//
// See LICENSE for terms of usage.
// See CITATION.md for citation guidelines, if DCA++ is used for scientific publications.
//
// Author: Giovanni Balduzzi (gbalduzz@itp.phys.ethz.ch)
//
// Conditional inclusion of std::filesystem

#ifndef DCA_IO_FILESYSTEM
#define DCA_IO_FILESYSTEM

#if __has_include(<filesystem>)

#include <filesystem>
namespace filesystem = std::filesystem;

#else

#include <experimental/filesystem>
namespace filesystem = std::experimental::filesystem;

#endif

#endif  // DCA_IO_FILESYSTEM
+3 −11
Original line number Diff line number Diff line
@@ -112,21 +112,15 @@ public:
    return execute(name, static_cast<io::Buffer::Container>(buffer));
  }

  operator bool() const {
  operator bool() const noexcept {
    return static_cast<bool>(file_);
  }

  void lock() {
    mutex_.lock();
  }

  void unlock() {
    mutex_.unlock();
  void set_verbose(bool verbose) {
    verbose_ = verbose;
  }

private:
  bool fexists(const char* filename);

  bool exists(const std::string& name) const;

  H5::DataSet write(const std::string& name, const std::vector<hsize_t>& size, H5::DataType type,
@@ -143,8 +137,6 @@ private:

  bool verbose_;

  std::mutex mutex_;

  std::vector<hsize_t> size_check_;
};

+7 −5
Original line number Diff line number Diff line
@@ -40,7 +40,7 @@ public:
  typedef JSON_context JsonDataType;

public:
  JSONReader();
  JSONReader(bool verbose = true);

  bool is_reader() {
    return true;
@@ -132,6 +132,7 @@ private:
  }

private:
  bool verbose_;
  std::string current_file_name;

  JSON_parser<JsonDataType> parser;
@@ -175,6 +176,7 @@ void JSONReader::execute(std::string name, scalartype& value, const JsonAccessor

template <typename scalartype, typename domain_type>
void JSONReader::execute(func::function<scalartype, domain_type>& f) {
  if (verbose_)
    std::cout << "\t starts reading function : " << f.get_name() << "\n";
  execute(f.get_name(), f, parse_result, 0);
}
@@ -321,7 +323,7 @@ void JSONReader::execute(std::string name,
  }
}

}  // io
}  // dca
}  // namespace io
}  // namespace dca

#endif  // DCA_IO_JSON_JSON_READER_HPP
Loading