Loading include/dca/phys/dca_step/cluster_solver/ctaux/ctaux_cluster_solver.hpp +9 −11 Original line number Diff line number Diff line // Copyright (C) 2018 ETH Zurich // Copyright (C) 2018 UT-Battelle, LLC // Copyright (C) 2021 ETH Zurich // Copyright (C) 2021 UT-Battelle, LLC // All rights reserved. // // See LICENSE for terms of usage. Loading @@ -7,6 +7,7 @@ // // Author: Peter Staar (taa@zurich.ibm.com) // Giovanni Balduzzi (gbalduzz@itp.phys.ethz.ch) // Peter Doak (doakpw@ornl.gov) // // Cluster Monte Carlo integrator based on a continuous-time auxilary field (CT-AUX) expansion. // Loading Loading @@ -68,9 +69,6 @@ public: static constexpr linalg::DeviceType device = device_t; protected: std::shared_ptr<io::Writer<Concurrency>> writer_; private: using w = func::dmn_0<domains::frequency_domain>; using b = func::dmn_0<domains::electron_band_domain>; Loading @@ -86,7 +84,7 @@ private: public: CtauxClusterSolver(Parameters& parameters_ref, Data& MOMS_ref, const std::shared_ptr<io::Writer<Concurrency>>& writer = nullptr); const std::shared_ptr<io::Writer<Concurrency>>& writer); template <typename Writer> void write(Writer& writer); Loading Loading @@ -148,6 +146,8 @@ protected: int dca_iteration_; G0Interpolation<device, typename Walker::Scalar> g0_; private: Rng rng_; Loading @@ -157,14 +157,15 @@ private: func::function<std::complex<double>, NuNuKClusterWDmn> Sigma_old_; func::function<std::complex<double>, NuNuKClusterWDmn> Sigma_new_; G0Interpolation<device, typename Walker::Scalar> g0_; double accumulated_sign_; func::function<std::complex<double>, NuNuRClusterWDmn> M_r_w_; func::function<std::complex<double>, NuNuRClusterWDmn> M_r_w_squared_; bool averaged_; bool compute_jack_knife_; protected: std::shared_ptr<io::Writer<Concurrency>> writer_; }; template <dca::linalg::DeviceType device_t, class Parameters, class Data, dca::DistType DIST> Loading @@ -190,11 +191,8 @@ CtauxClusterSolver<device_t, Parameters, Data, DIST>::CtauxClusterSolver( M_r_w_("M_r_w"), M_r_w_squared_("M_r_w_squared"), averaged_(false), writer_(writer) { TimeCorrelator<Parameters, typename Walker::Scalar, device>::setG0(g0_); if (concurrency_.id() == concurrency_.first()) std::cout << "\n\n\t CT-AUX Integrator is born \n" << std::endl; } Loading include/dca/phys/dca_step/cluster_solver/ctaux/structs/vertex_pair.hpp +5 −3 Original line number Diff line number Diff line // Copyright (C) 2018 ETH Zurich // Copyright (C) 2018 UT-Battelle, LLC // Copyright (C) 2021 ETH Zurich // Copyright (C) 2021 UT-Battelle, LLC // All rights reserved. // // See LICENSE for terms of usage. Loading Loading @@ -50,6 +50,7 @@ public: uint64_t id); this_type& operator=(const this_type& other_vertex_pair); vertex_pair(const this_type& other_vertex_pair) = default; uint64_t get_id() const { return id_; Loading Loading @@ -188,6 +189,7 @@ vertex_pair<parameters_type>::vertex_pair(parameters_type& parameters_ref, rng_t Bennett(false), shuffled(false) {} // \todo replace this sematic changing operator overload template <class parameters_type> vertex_pair<parameters_type>& vertex_pair<parameters_type>::operator=( const vertex_pair<parameters_type>& other_vertex_pair) // --> necessary for push_back Loading include/dca/phys/dca_step/cluster_solver/ctint/ctint_cluster_solver.hpp +4 −4 Original line number Diff line number Diff line // Copyright (C) 2018 ETH Zurich // Copyright (C) 2018 UT-Battelle, LLC // Copyright (C) 2021 ETH Zurich // Copyright (C) 2021 UT-Battelle, LLC // All rights reserved. // // See LICENSE.txt 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) // Peter Doak(doakpw@ornl.gov) // // Cluster Monte Carlo integrator based on a CT-INT algorithm. Loading Loading @@ -142,12 +143,12 @@ protected: int dca_iteration_ = 0; std::shared_ptr<io::Writer<Concurrency>> writer_; G0Interpolation<device_t, typename Walker::Scalar> g0_; private: bool perform_tp_accumulation_; const LabelDomain label_dmn_; std::unique_ptr<Walker> walker_; // Walker input. G0Interpolation<device_t, Real> g0_; Rng rng_; }; Loading @@ -163,7 +164,6 @@ CtintClusterSolver<DEV, PARAM, use_submatrix, DIST>::CtintClusterSolver( rng_(concurrency_.id(), concurrency_.number_of_processors(), parameters_.get_seed()) { Walker::setDMatrixBuilder(g0_); // TimeCorrelator<Parameters, Real, device_t>::setG0(g0_); Walker::setInteractionVertices(data_, parameters_); if (concurrency_.id() == concurrency_.first()) Loading include/dca/phys/dca_step/cluster_solver/ctint/walker/ctint_walker_base.hpp +1 −2 Original line number Diff line number Diff line Loading @@ -246,8 +246,7 @@ void CtintWalkerBase<Parameters, Real, DIST>::initialize(int iteration) { sweeps_per_meas_ = parameters_.get_sweeps_per_measurement().at(iteration); sign_ = 1; // in some DCA-develop code Giovanni has this set to 0 mc_log_weight_ = 1.; mc_log_weight_ = 0.; if (!configuration_.size()) { // Do not initialize config if it was read. while (parameters_.getInitialConfigurationSize() > configuration_.size()) { Loading include/dca/phys/dca_step/cluster_solver/shared_tools/accumulation/time_correlator.hpp +9 −19 Original line number Diff line number Diff line // Copyright (C) 2018 ETH Zurich // Copyright (C) 2018 UT-Battelle, LLC // Copyright (C) 2021 ETH Zurich // Copyright (C) 2021 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) // Peter Doak (doakpw@ornl.gov) // // This class measures the correlation of G(r = 0, t = 0). Loading Loading @@ -53,19 +54,12 @@ public: template <DeviceType conf_device> using Config = linalg::MultiVector<conf_device, Real, int, int>; TimeCorrelator(const Parameters& parameters_, int id); TimeCorrelator(const Parameters& parameters_, int id, G0Interpolation<device, Real>& g0); template <class WalkerConfig, typename RealInp> void compute_G_r_t(const std::array<dca::linalg::Matrix<RealInp, device>, 2>& M, const std::array<WalkerConfig, 2>& configs, int sign); // TODO: use a shared pointer. static void setG0(const G0Interpolation<device, Real>& g0) { if constexpr (device == linalg::GPU) details::SolverHelper::set<RDmn, BDmn>(); g0_ = &g0; } auto& getCorrelators() { return autocorrelations_; } Loading Loading @@ -100,7 +94,7 @@ private: constexpr static int n_correlators_ = n_bands_ * (n_bands_ + 1) / 2; // Number of independent entries in a band-band matrix. static const inline G0Interpolation<device, Real>* g0_ = nullptr; G0Interpolation<device, Real>& g0_; const linalg::util::GpuStream& stream_; Loading @@ -121,11 +115,11 @@ private: }; template <class Parameters, typename Real, DeviceType device> TimeCorrelator<Parameters, Real, device>::TimeCorrelator(const Parameters& parameters_ref, int id) TimeCorrelator<Parameters, Real, device>::TimeCorrelator(const Parameters& parameters_ref, int id, G0Interpolation<device, Real>& g0) : parameters_(parameters_ref), concurrency_(parameters_.get_concurrency()), thread_id_(id), g0_(g0), stream_(linalg::util::getStream(thread_id_, 0)) { // We're going to make one of these per walker // @gbalduzz solution of making this static creates a race with cuda driver shutting down. Loading Loading @@ -160,10 +154,6 @@ template <class WalkerConfig, typename RealInp> void TimeCorrelator<Parameters, Real, device>::compute_G_r_t( const std::array<dca::linalg::Matrix<RealInp, device>, 2>& M, const std::array<WalkerConfig, 2>& configs, int sign) { if (!g0_) { throw(std::runtime_error("G0 is not set.")); } // Upload state constexpr int n_electron_spins = 1; // Compute only on up-up sector. Loading Loading @@ -270,7 +260,7 @@ void TimeCorrelator<Parameters, Real, device>::computeG0(linalg::Matrix<Real, GP G0_mat.resizeNoCopy(std::make_pair(config_l.size(), config_r.size())); linalg::MatrixView<Real, device> G0_view(G0_mat); details::computeG0(G0_view, *g0_, config_l.template get<0>(), config_l.template get<1>(), details::computeG0(G0_view, g0_, config_l.template get<0>(), config_l.template get<1>(), config_l.template get<2>(), config_r.template get<0>(), config_r.template get<1>(), config_r.template get<2>(), stream_); } Loading Loading @@ -299,7 +289,7 @@ void TimeCorrelator<Parameters, Real, device>::computeG0(linalg::Matrix<Real, CP const int r = RDmn::parameter_type::subtract(r_r[j], r_l[i]); const int label = labels(b_l[i], b_r[j], r); G0_mat(i, j) = (*g0_)(tau, label); G0_mat(i, j) = g0_(tau, label); } } Loading Loading
include/dca/phys/dca_step/cluster_solver/ctaux/ctaux_cluster_solver.hpp +9 −11 Original line number Diff line number Diff line // Copyright (C) 2018 ETH Zurich // Copyright (C) 2018 UT-Battelle, LLC // Copyright (C) 2021 ETH Zurich // Copyright (C) 2021 UT-Battelle, LLC // All rights reserved. // // See LICENSE for terms of usage. Loading @@ -7,6 +7,7 @@ // // Author: Peter Staar (taa@zurich.ibm.com) // Giovanni Balduzzi (gbalduzz@itp.phys.ethz.ch) // Peter Doak (doakpw@ornl.gov) // // Cluster Monte Carlo integrator based on a continuous-time auxilary field (CT-AUX) expansion. // Loading Loading @@ -68,9 +69,6 @@ public: static constexpr linalg::DeviceType device = device_t; protected: std::shared_ptr<io::Writer<Concurrency>> writer_; private: using w = func::dmn_0<domains::frequency_domain>; using b = func::dmn_0<domains::electron_band_domain>; Loading @@ -86,7 +84,7 @@ private: public: CtauxClusterSolver(Parameters& parameters_ref, Data& MOMS_ref, const std::shared_ptr<io::Writer<Concurrency>>& writer = nullptr); const std::shared_ptr<io::Writer<Concurrency>>& writer); template <typename Writer> void write(Writer& writer); Loading Loading @@ -148,6 +146,8 @@ protected: int dca_iteration_; G0Interpolation<device, typename Walker::Scalar> g0_; private: Rng rng_; Loading @@ -157,14 +157,15 @@ private: func::function<std::complex<double>, NuNuKClusterWDmn> Sigma_old_; func::function<std::complex<double>, NuNuKClusterWDmn> Sigma_new_; G0Interpolation<device, typename Walker::Scalar> g0_; double accumulated_sign_; func::function<std::complex<double>, NuNuRClusterWDmn> M_r_w_; func::function<std::complex<double>, NuNuRClusterWDmn> M_r_w_squared_; bool averaged_; bool compute_jack_knife_; protected: std::shared_ptr<io::Writer<Concurrency>> writer_; }; template <dca::linalg::DeviceType device_t, class Parameters, class Data, dca::DistType DIST> Loading @@ -190,11 +191,8 @@ CtauxClusterSolver<device_t, Parameters, Data, DIST>::CtauxClusterSolver( M_r_w_("M_r_w"), M_r_w_squared_("M_r_w_squared"), averaged_(false), writer_(writer) { TimeCorrelator<Parameters, typename Walker::Scalar, device>::setG0(g0_); if (concurrency_.id() == concurrency_.first()) std::cout << "\n\n\t CT-AUX Integrator is born \n" << std::endl; } Loading
include/dca/phys/dca_step/cluster_solver/ctaux/structs/vertex_pair.hpp +5 −3 Original line number Diff line number Diff line // Copyright (C) 2018 ETH Zurich // Copyright (C) 2018 UT-Battelle, LLC // Copyright (C) 2021 ETH Zurich // Copyright (C) 2021 UT-Battelle, LLC // All rights reserved. // // See LICENSE for terms of usage. Loading Loading @@ -50,6 +50,7 @@ public: uint64_t id); this_type& operator=(const this_type& other_vertex_pair); vertex_pair(const this_type& other_vertex_pair) = default; uint64_t get_id() const { return id_; Loading Loading @@ -188,6 +189,7 @@ vertex_pair<parameters_type>::vertex_pair(parameters_type& parameters_ref, rng_t Bennett(false), shuffled(false) {} // \todo replace this sematic changing operator overload template <class parameters_type> vertex_pair<parameters_type>& vertex_pair<parameters_type>::operator=( const vertex_pair<parameters_type>& other_vertex_pair) // --> necessary for push_back Loading
include/dca/phys/dca_step/cluster_solver/ctint/ctint_cluster_solver.hpp +4 −4 Original line number Diff line number Diff line // Copyright (C) 2018 ETH Zurich // Copyright (C) 2018 UT-Battelle, LLC // Copyright (C) 2021 ETH Zurich // Copyright (C) 2021 UT-Battelle, LLC // All rights reserved. // // See LICENSE.txt 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) // Peter Doak(doakpw@ornl.gov) // // Cluster Monte Carlo integrator based on a CT-INT algorithm. Loading Loading @@ -142,12 +143,12 @@ protected: int dca_iteration_ = 0; std::shared_ptr<io::Writer<Concurrency>> writer_; G0Interpolation<device_t, typename Walker::Scalar> g0_; private: bool perform_tp_accumulation_; const LabelDomain label_dmn_; std::unique_ptr<Walker> walker_; // Walker input. G0Interpolation<device_t, Real> g0_; Rng rng_; }; Loading @@ -163,7 +164,6 @@ CtintClusterSolver<DEV, PARAM, use_submatrix, DIST>::CtintClusterSolver( rng_(concurrency_.id(), concurrency_.number_of_processors(), parameters_.get_seed()) { Walker::setDMatrixBuilder(g0_); // TimeCorrelator<Parameters, Real, device_t>::setG0(g0_); Walker::setInteractionVertices(data_, parameters_); if (concurrency_.id() == concurrency_.first()) Loading
include/dca/phys/dca_step/cluster_solver/ctint/walker/ctint_walker_base.hpp +1 −2 Original line number Diff line number Diff line Loading @@ -246,8 +246,7 @@ void CtintWalkerBase<Parameters, Real, DIST>::initialize(int iteration) { sweeps_per_meas_ = parameters_.get_sweeps_per_measurement().at(iteration); sign_ = 1; // in some DCA-develop code Giovanni has this set to 0 mc_log_weight_ = 1.; mc_log_weight_ = 0.; if (!configuration_.size()) { // Do not initialize config if it was read. while (parameters_.getInitialConfigurationSize() > configuration_.size()) { Loading
include/dca/phys/dca_step/cluster_solver/shared_tools/accumulation/time_correlator.hpp +9 −19 Original line number Diff line number Diff line // Copyright (C) 2018 ETH Zurich // Copyright (C) 2018 UT-Battelle, LLC // Copyright (C) 2021 ETH Zurich // Copyright (C) 2021 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) // Peter Doak (doakpw@ornl.gov) // // This class measures the correlation of G(r = 0, t = 0). Loading Loading @@ -53,19 +54,12 @@ public: template <DeviceType conf_device> using Config = linalg::MultiVector<conf_device, Real, int, int>; TimeCorrelator(const Parameters& parameters_, int id); TimeCorrelator(const Parameters& parameters_, int id, G0Interpolation<device, Real>& g0); template <class WalkerConfig, typename RealInp> void compute_G_r_t(const std::array<dca::linalg::Matrix<RealInp, device>, 2>& M, const std::array<WalkerConfig, 2>& configs, int sign); // TODO: use a shared pointer. static void setG0(const G0Interpolation<device, Real>& g0) { if constexpr (device == linalg::GPU) details::SolverHelper::set<RDmn, BDmn>(); g0_ = &g0; } auto& getCorrelators() { return autocorrelations_; } Loading Loading @@ -100,7 +94,7 @@ private: constexpr static int n_correlators_ = n_bands_ * (n_bands_ + 1) / 2; // Number of independent entries in a band-band matrix. static const inline G0Interpolation<device, Real>* g0_ = nullptr; G0Interpolation<device, Real>& g0_; const linalg::util::GpuStream& stream_; Loading @@ -121,11 +115,11 @@ private: }; template <class Parameters, typename Real, DeviceType device> TimeCorrelator<Parameters, Real, device>::TimeCorrelator(const Parameters& parameters_ref, int id) TimeCorrelator<Parameters, Real, device>::TimeCorrelator(const Parameters& parameters_ref, int id, G0Interpolation<device, Real>& g0) : parameters_(parameters_ref), concurrency_(parameters_.get_concurrency()), thread_id_(id), g0_(g0), stream_(linalg::util::getStream(thread_id_, 0)) { // We're going to make one of these per walker // @gbalduzz solution of making this static creates a race with cuda driver shutting down. Loading Loading @@ -160,10 +154,6 @@ template <class WalkerConfig, typename RealInp> void TimeCorrelator<Parameters, Real, device>::compute_G_r_t( const std::array<dca::linalg::Matrix<RealInp, device>, 2>& M, const std::array<WalkerConfig, 2>& configs, int sign) { if (!g0_) { throw(std::runtime_error("G0 is not set.")); } // Upload state constexpr int n_electron_spins = 1; // Compute only on up-up sector. Loading Loading @@ -270,7 +260,7 @@ void TimeCorrelator<Parameters, Real, device>::computeG0(linalg::Matrix<Real, GP G0_mat.resizeNoCopy(std::make_pair(config_l.size(), config_r.size())); linalg::MatrixView<Real, device> G0_view(G0_mat); details::computeG0(G0_view, *g0_, config_l.template get<0>(), config_l.template get<1>(), details::computeG0(G0_view, g0_, config_l.template get<0>(), config_l.template get<1>(), config_l.template get<2>(), config_r.template get<0>(), config_r.template get<1>(), config_r.template get<2>(), stream_); } Loading Loading @@ -299,7 +289,7 @@ void TimeCorrelator<Parameters, Real, device>::computeG0(linalg::Matrix<Real, CP const int r = RDmn::parameter_type::subtract(r_r[j], r_l[i]); const int label = labels(b_l[i], b_r[j], r); G0_mat(i, j) = (*g0_)(tau, label); G0_mat(i, j) = g0_(tau, label); } } Loading