Loading include/dca/linalg/reshapable_matrix.hpp +53 −10 Original line number Diff line number Diff line Loading @@ -100,6 +100,49 @@ public: return data_[i + j * leadingDimension()]; } struct Iterator { using iterator_category = std::forward_iterator_tag; using difference_type = std::ptrdiff_t; using value_type = ScalarType; using pointer = ScalarType*; using reference = ScalarType&; Iterator(pointer ptr) : m_ptr(ptr) {} reference operator*() const { return *m_ptr; } pointer operator->() { return m_ptr; } Iterator& operator++() { m_ptr++; return *this; } Iterator operator++(int) { Iterator tmp = *this; ++(*this); return tmp; } friend bool operator==(const Iterator& a, const Iterator& b) { return a.m_ptr == b.m_ptr; }; friend bool operator!=(const Iterator& a, const Iterator& b) { return a.m_ptr != b.m_ptr; }; private: pointer m_ptr; }; Iterator begin() { return Iterator(data_); } Iterator end() { return Iterator(data_ + size_.first * size_.second); } // Returns the pointer to the (0,0)-th element. ValueType* ptr() { return data_; Loading Loading @@ -221,7 +264,8 @@ template <typename ScalarRhs, DeviceType rhs_device_name, class AllocatorRhs> ReshapableMatrix<ScalarType, device_name, Allocator>& ReshapableMatrix< ScalarType, device_name, Allocator>::operator=(const ReshapableMatrix<ScalarRhs, rhs_device_name, AllocatorRhs>& rhs) { static_assert(sizeof(ScalarType) == sizeof(ScalarRhs), "sizeof ScalarType and ScalarRhs are not equal"); static_assert(sizeof(ScalarType) == sizeof(ScalarRhs), "sizeof ScalarType and ScalarRhs are not equal"); if constexpr (device_name == rhs_device_name) if (this != &rhs) return *this; Loading Loading @@ -257,8 +301,7 @@ ReshapableMatrix<ScalarType, device_name, Allocator>& ReshapableMatrix< } template <typename ScalarType, DeviceType device_name, class Allocator> ReshapableMatrix< ScalarType, device_name, Allocator>::ReshapableMatrix(ThisType&& rhs) { ReshapableMatrix<ScalarType, device_name, Allocator>::ReshapableMatrix(ThisType&& rhs) { swap(rhs); } Loading Loading @@ -393,8 +436,8 @@ std::size_t ReshapableMatrix<ScalarType, device_name, Allocator>::deviceFingerpr } template <typename ScalarType, DeviceType device_name, class Allocator> std::ostream& operator<<(std::ostream& ostr, const ReshapableMatrix<ScalarType, device_name, Allocator>& rmatrix) { std::ostream& operator<<(std::ostream& ostr, const ReshapableMatrix<ScalarType, device_name, Allocator>& rmatrix) { ostr << "{"; for (std::size_t i = 0; i < rmatrix.size().first; ++i) { ostr << "{"; Loading include/dca/phys/dca_step/cluster_solver/shared_tools/accumulation/tp/g4_helper.cuh +4 −1 Original line number Diff line number Diff line Loading @@ -32,9 +32,12 @@ namespace details { class G4Helper { public: /** pass a bunch of information into the G4Helper so it can help./ * \param[in] extension_offset (WTpExtDmn::dmn_size() - WTpDmn::dmn_size()) / 2 */ static void set(int nb, int nk, int nw, const std::vector<int>& delta_k, const std::vector<int>& delta_w, const int* add_k, int lda, const int* sub_k, int lds); const int extension_offset, const int* add_k, int lda, const int* sub_k, int lds); __device__ auto get_bands() const { return nb_; Loading include/dca/phys/dca_step/cluster_solver/shared_tools/accumulation/tp/tp_accumulator_base.hpp +2 −0 Original line number Diff line number Diff line Loading @@ -197,6 +197,8 @@ TpAccumulatorBase<Parameters, DT>::TpAccumulatorBase( if (WDmn::dmn_size() < WTpExtDmn::dmn_size()) throw(std::logic_error("The number of single particle frequencies is too small.")); std::cout << "WTpExtDmn Elements: " << vectorToString(WTpExtDmn::get_elements()) << '\n'; initializeG0(); // Reserve storage in advance such that we don't have to copy elements when we fill the vector. Loading include/dca/phys/dca_step/cluster_solver/shared_tools/accumulation/tp/tp_accumulator_cpu.hpp +4 −0 Original line number Diff line number Diff line Loading @@ -456,6 +456,8 @@ double TpAccumulator<Parameters, DT, linalg::CPU>::updateG4(const int channel_id // = -1/2 sum_s G(k2+k_ex, k1+k_ex, s) G(k1, k2, -s) for (int w_ex_idx = 0; w_ex_idx < exchange_frq.size(); ++w_ex_idx) { const int w_ex = exchange_frq[w_ex_idx]; if(w_ex != 0) std::cout << "cpu w_ex: " << w_ex << '\n'; for (int k_ex_idx = 0; k_ex_idx < exchange_mom.size(); ++k_ex_idx) { const int k_ex = exchange_mom[k_ex_idx]; for (int w2 = 0; w2 < WTpDmn::dmn_size(); ++w2) Loading @@ -481,6 +483,8 @@ double TpAccumulator<Parameters, DT, linalg::CPU>::updateG4(const int channel_id // - (s1 == s2) G(k2+k_ex, k1+k_ex, s1) G(k1, k2, s1)] for (int w_ex_idx = 0; w_ex_idx < exchange_frq.size(); ++w_ex_idx) { const int w_ex = exchange_frq[w_ex_idx]; if(w_ex != 0) std::cout << "cpu w_ex: " << w_ex << '\n'; for (int k_ex_idx = 0; k_ex_idx < exchange_mom.size(); ++k_ex_idx) { const int k_ex = exchange_mom[k_ex_idx]; for (int w2 = 0; w2 < WTpDmn::dmn_size(); ++w2) Loading include/dca/phys/dca_step/cluster_solver/shared_tools/accumulation/tp/tp_accumulator_gpu.hpp +1 −0 Original line number Diff line number Diff line Loading @@ -394,6 +394,7 @@ void TpAccumulator<Parameters, DT, linalg::GPU>::computeGSingleband(const int s) template <class Parameters, DistType DT> void TpAccumulator<Parameters, DT, linalg::GPU>::computeGMultiband(const int s) { std::cout << "WTpExtDmn::dmn_size(): " << WTpExtDmn::dmn_size() << '\n'; details::computeGMultiband(G_[s].ptr(), G_[s].leadingDimension(), get_G0()[s].ptr(), get_G0()[s].leadingDimension(), n_bands_, KDmn::dmn_size(), WTpExtDmn::dmn_size(), beta_, queues_[s]); Loading Loading
include/dca/linalg/reshapable_matrix.hpp +53 −10 Original line number Diff line number Diff line Loading @@ -100,6 +100,49 @@ public: return data_[i + j * leadingDimension()]; } struct Iterator { using iterator_category = std::forward_iterator_tag; using difference_type = std::ptrdiff_t; using value_type = ScalarType; using pointer = ScalarType*; using reference = ScalarType&; Iterator(pointer ptr) : m_ptr(ptr) {} reference operator*() const { return *m_ptr; } pointer operator->() { return m_ptr; } Iterator& operator++() { m_ptr++; return *this; } Iterator operator++(int) { Iterator tmp = *this; ++(*this); return tmp; } friend bool operator==(const Iterator& a, const Iterator& b) { return a.m_ptr == b.m_ptr; }; friend bool operator!=(const Iterator& a, const Iterator& b) { return a.m_ptr != b.m_ptr; }; private: pointer m_ptr; }; Iterator begin() { return Iterator(data_); } Iterator end() { return Iterator(data_ + size_.first * size_.second); } // Returns the pointer to the (0,0)-th element. ValueType* ptr() { return data_; Loading Loading @@ -221,7 +264,8 @@ template <typename ScalarRhs, DeviceType rhs_device_name, class AllocatorRhs> ReshapableMatrix<ScalarType, device_name, Allocator>& ReshapableMatrix< ScalarType, device_name, Allocator>::operator=(const ReshapableMatrix<ScalarRhs, rhs_device_name, AllocatorRhs>& rhs) { static_assert(sizeof(ScalarType) == sizeof(ScalarRhs), "sizeof ScalarType and ScalarRhs are not equal"); static_assert(sizeof(ScalarType) == sizeof(ScalarRhs), "sizeof ScalarType and ScalarRhs are not equal"); if constexpr (device_name == rhs_device_name) if (this != &rhs) return *this; Loading Loading @@ -257,8 +301,7 @@ ReshapableMatrix<ScalarType, device_name, Allocator>& ReshapableMatrix< } template <typename ScalarType, DeviceType device_name, class Allocator> ReshapableMatrix< ScalarType, device_name, Allocator>::ReshapableMatrix(ThisType&& rhs) { ReshapableMatrix<ScalarType, device_name, Allocator>::ReshapableMatrix(ThisType&& rhs) { swap(rhs); } Loading Loading @@ -393,8 +436,8 @@ std::size_t ReshapableMatrix<ScalarType, device_name, Allocator>::deviceFingerpr } template <typename ScalarType, DeviceType device_name, class Allocator> std::ostream& operator<<(std::ostream& ostr, const ReshapableMatrix<ScalarType, device_name, Allocator>& rmatrix) { std::ostream& operator<<(std::ostream& ostr, const ReshapableMatrix<ScalarType, device_name, Allocator>& rmatrix) { ostr << "{"; for (std::size_t i = 0; i < rmatrix.size().first; ++i) { ostr << "{"; Loading
include/dca/phys/dca_step/cluster_solver/shared_tools/accumulation/tp/g4_helper.cuh +4 −1 Original line number Diff line number Diff line Loading @@ -32,9 +32,12 @@ namespace details { class G4Helper { public: /** pass a bunch of information into the G4Helper so it can help./ * \param[in] extension_offset (WTpExtDmn::dmn_size() - WTpDmn::dmn_size()) / 2 */ static void set(int nb, int nk, int nw, const std::vector<int>& delta_k, const std::vector<int>& delta_w, const int* add_k, int lda, const int* sub_k, int lds); const int extension_offset, const int* add_k, int lda, const int* sub_k, int lds); __device__ auto get_bands() const { return nb_; Loading
include/dca/phys/dca_step/cluster_solver/shared_tools/accumulation/tp/tp_accumulator_base.hpp +2 −0 Original line number Diff line number Diff line Loading @@ -197,6 +197,8 @@ TpAccumulatorBase<Parameters, DT>::TpAccumulatorBase( if (WDmn::dmn_size() < WTpExtDmn::dmn_size()) throw(std::logic_error("The number of single particle frequencies is too small.")); std::cout << "WTpExtDmn Elements: " << vectorToString(WTpExtDmn::get_elements()) << '\n'; initializeG0(); // Reserve storage in advance such that we don't have to copy elements when we fill the vector. Loading
include/dca/phys/dca_step/cluster_solver/shared_tools/accumulation/tp/tp_accumulator_cpu.hpp +4 −0 Original line number Diff line number Diff line Loading @@ -456,6 +456,8 @@ double TpAccumulator<Parameters, DT, linalg::CPU>::updateG4(const int channel_id // = -1/2 sum_s G(k2+k_ex, k1+k_ex, s) G(k1, k2, -s) for (int w_ex_idx = 0; w_ex_idx < exchange_frq.size(); ++w_ex_idx) { const int w_ex = exchange_frq[w_ex_idx]; if(w_ex != 0) std::cout << "cpu w_ex: " << w_ex << '\n'; for (int k_ex_idx = 0; k_ex_idx < exchange_mom.size(); ++k_ex_idx) { const int k_ex = exchange_mom[k_ex_idx]; for (int w2 = 0; w2 < WTpDmn::dmn_size(); ++w2) Loading @@ -481,6 +483,8 @@ double TpAccumulator<Parameters, DT, linalg::CPU>::updateG4(const int channel_id // - (s1 == s2) G(k2+k_ex, k1+k_ex, s1) G(k1, k2, s1)] for (int w_ex_idx = 0; w_ex_idx < exchange_frq.size(); ++w_ex_idx) { const int w_ex = exchange_frq[w_ex_idx]; if(w_ex != 0) std::cout << "cpu w_ex: " << w_ex << '\n'; for (int k_ex_idx = 0; k_ex_idx < exchange_mom.size(); ++k_ex_idx) { const int k_ex = exchange_mom[k_ex_idx]; for (int w2 = 0; w2 < WTpDmn::dmn_size(); ++w2) Loading
include/dca/phys/dca_step/cluster_solver/shared_tools/accumulation/tp/tp_accumulator_gpu.hpp +1 −0 Original line number Diff line number Diff line Loading @@ -394,6 +394,7 @@ void TpAccumulator<Parameters, DT, linalg::GPU>::computeGSingleband(const int s) template <class Parameters, DistType DT> void TpAccumulator<Parameters, DT, linalg::GPU>::computeGMultiband(const int s) { std::cout << "WTpExtDmn::dmn_size(): " << WTpExtDmn::dmn_size() << '\n'; details::computeGMultiband(G_[s].ptr(), G_[s].leadingDimension(), get_G0()[s].ptr(), get_G0()[s].leadingDimension(), n_bands_, KDmn::dmn_size(), WTpExtDmn::dmn_size(), beta_, queues_[s]); Loading