Loading cmake/dca_config.cmake +15 −14 Original line number Diff line number Diff line Loading @@ -235,16 +235,6 @@ if (DCA_WITH_QMC_BIT) dca_add_config_define(DCA_WITH_QMC_BIT) endif() ################################################################################ # Single precision measurements # TODO: maybe change to ON by default. option(DCA_WITH_SINGLE_PRECISION_TP_MEASUREMENTS "Measure in single precision." OFF) mark_as_advanced(DCA_WITH_SINGLE_PRECISION_TP_MEASUREMENTS) if (DCA_WITH_SINGLE_PRECISION_TP_MEASUREMENTS) dca_add_config_define(DCA_WITH_SINGLE_PRECISION_TP_MEASUREMENTS) endif() ################################################################################ # Gnuplot option(DCA_WITH_GNUPLOT "Enable Gnuplot." OFF) Loading @@ -267,7 +257,7 @@ else() endif() ################################################################################ # Accumulation options. # MC options. option(DCA_WITH_MEMORY_SAVINGS "Save memory in the two particle accumulation at a slight performance cost." OFF) mark_as_advanced(DCA_WITH_MEMORY_SAVINGS) Loading @@ -277,12 +267,23 @@ else() set(MEMORY_SAVINGS false) endif() if (DCA_WITH_SINGLE_PRECISION_MEASUREMENTS) option(DCA_WITH_SINGLE_PRECISION_MC "Perform Monte Carlo and measurements in single precision." OFF) option(DCA_WITH_SINGLE_PRECISION_TP_MEASUREMENTS "Measure two particle function in single precision." OFF) if (DCA_WITH_SINGLE_PRECISION_MC) set(DCA_WITH_SINGLE_PRECISION_TP_MEASUREMENTS ON CACHE BOOL "Measure two particle function in single precision." FORCE) set(MC_SCALAR float) else() set(MC_SCALAR double) endif() if (DCA_WITH_SINGLE_PRECISION_TP_MEASUREMENTS) set(TP_ACCUMULATION_SCALAR float) else() set(TP_ACCUMULATION_SCALAR double) endif() option(DCA_WITH_MANAGED_MEMORY "Use managed memory allocator." OFF) mark_as_advanced(DCA_WITH_MANAGED_MEMORY) if (DCA_WITH_MANAGED_MEMORY) Loading @@ -291,8 +292,8 @@ else() set(TWO_PARTICLE_ALLOCATOR "dca::linalg::util::DeviceAllocator<T>") endif() configure_file("${PROJECT_SOURCE_DIR}/include/dca/config/accumulation_options.hpp.in" "${CMAKE_BINARY_DIR}/include/dca/config/accumulation_options.hpp" @ONLY) configure_file("${PROJECT_SOURCE_DIR}/include/dca/config/mc_options.hpp.in" "${CMAKE_BINARY_DIR}/include/dca/config/mc_options.hpp" @ONLY) ################################################################################ Loading include/dca/config/cmake_options.hpp +1 −0 Original line number Diff line number Diff line Loading @@ -40,6 +40,7 @@ struct CMakeOptions { static const std::string dca_profiler; static const std::string dca_with_autotuning; static const std::string dca_with_gnuplot; static const std::string dca_with_single_precision_mc; static const std::string dca_with_single_precision_tp_measurements; static const std::string dca_with_memory_savings; static const std::string dca_with_managed_memory; Loading include/dca/config/accumulation_options.hpp.in→include/dca/config/mc_options.hpp.in +8 −7 Original line number Diff line number Diff line Loading @@ -9,20 +9,21 @@ // // This class stores compile time options for the MC accumulation. #ifndef DCA_CONFIG_ACCUMULATION_OPTIONS_HPP #define DCA_CONFIG_ACCUMULATION_OPTIONS_HPP #ifndef DCA_CONFIG_MC_OPTIONS_HPP #define DCA_CONFIG_MC_OPTIONS_HPP #ifdef DCA_HAVE_CUDA #include "dca/linalg/util/allocators/device_allocator.hpp" #include "dca/linalg/util/allocators/managed_allocator.hpp" #endif // DCA_HAVE_CUDA namespace dca { namespace config { // dca::config:: struct AccumulationOptions { struct McOptions { using MCScalar = @MC_SCALAR@; using TPAccumulationScalar = @TP_ACCUMULATION_SCALAR@; static constexpr bool memory_savings = @MEMORY_SAVINGS@; Loading @@ -33,7 +34,7 @@ struct AccumulationOptions { #endif // DCA_HAVE_CUDA }; } // config } // dca } // namespace config } // namespace dca #endif // DCA_CONFIG_ACCUMULATION_OPTIONS_HPP #endif // DCA_CONFIG_MC_OPTIONS_HPP include/dca/function/function.hpp +14 −0 Original line number Diff line number Diff line Loading @@ -77,6 +77,8 @@ public: // the other function's construction. // Postcondition: The function's name is unchanged. function<scalartype, domain>& operator=(const function<scalartype, domain>& other); template <typename Scalar2> function<scalartype, domain>& operator=(const function<Scalar2, domain>& other); // Move assignment operator // Replaces the function's elements with those of other using move semantics. Loading Loading @@ -345,6 +347,18 @@ function<scalartype, domain>& function<scalartype, domain>::operator=( return *this; } template <typename Scalar, class domain> template <typename Scalar2> function<Scalar, domain>& function<Scalar, domain>::operator=(const function<Scalar2, domain>& other) { if (size() != other.size()) { throw(std::logic_error("Function size does not match.")); } std::copy_n(other.values(), Nb_elements, fnc_values); return *this; } template <typename scalartype, class domain> function<scalartype, domain>& function<scalartype, domain>::operator=( function<scalartype, domain>&& other) { Loading include/dca/io/hdf5/hdf5_reader.hpp +13 −9 Original line number Diff line number Diff line Loading @@ -15,6 +15,7 @@ #include <complex> #include <string> #include <vector> #include <type_traits> #include "H5Cpp.h" Loading Loading @@ -271,22 +272,25 @@ bool HDF5Reader::execute(std::string name, dca::linalg::Matrix<scalar_type, dca: open_group(name); bool success = true; try { try {std::vector<int> size(2); execute("current-size", size); A.resizeNoCopy(std::make_pair(size[0], size[1])); std::vector<scalar_type> a_compressed(size[0] * size[1]); std::string full_name = get_path() + "/data"; H5::DataSet dataset = my_file->openDataSet(full_name.c_str()); H5::DataSpace dataspace = dataset.getSpace(); // These 2 lines fix the bug of reading into a matrix which has been resized to a smaller size // hsize_t global_size[2] = {A.nrCols(), A.nrRows()}; // HDF5 use row // major data distribution // hsize_t global_size[2] = {A.capacity().second, A.capacity().first}; // HDF5 use // row major data distribution // dataspace.setExtentSimple(2, &global_size[0], NULL); H5Dread(dataset.getId(), HDF5_TYPE<scalar_type>::get(), dataspace.getId(), H5S_ALL, H5P_DEFAULT, &A(0, 0)); a_compressed.data()); unsigned index = 0; for (int j = 0; j < A.nrCols(); ++j) for (int i = 0; i < A.nrRows(); ++i) A(i, j) = a_compressed[index++]; } catch (const H5::FileIException& err) { std::cout << "\n\n\t the function (" + name + ") does not exist in path : " + get_path() + Loading Loading
cmake/dca_config.cmake +15 −14 Original line number Diff line number Diff line Loading @@ -235,16 +235,6 @@ if (DCA_WITH_QMC_BIT) dca_add_config_define(DCA_WITH_QMC_BIT) endif() ################################################################################ # Single precision measurements # TODO: maybe change to ON by default. option(DCA_WITH_SINGLE_PRECISION_TP_MEASUREMENTS "Measure in single precision." OFF) mark_as_advanced(DCA_WITH_SINGLE_PRECISION_TP_MEASUREMENTS) if (DCA_WITH_SINGLE_PRECISION_TP_MEASUREMENTS) dca_add_config_define(DCA_WITH_SINGLE_PRECISION_TP_MEASUREMENTS) endif() ################################################################################ # Gnuplot option(DCA_WITH_GNUPLOT "Enable Gnuplot." OFF) Loading @@ -267,7 +257,7 @@ else() endif() ################################################################################ # Accumulation options. # MC options. option(DCA_WITH_MEMORY_SAVINGS "Save memory in the two particle accumulation at a slight performance cost." OFF) mark_as_advanced(DCA_WITH_MEMORY_SAVINGS) Loading @@ -277,12 +267,23 @@ else() set(MEMORY_SAVINGS false) endif() if (DCA_WITH_SINGLE_PRECISION_MEASUREMENTS) option(DCA_WITH_SINGLE_PRECISION_MC "Perform Monte Carlo and measurements in single precision." OFF) option(DCA_WITH_SINGLE_PRECISION_TP_MEASUREMENTS "Measure two particle function in single precision." OFF) if (DCA_WITH_SINGLE_PRECISION_MC) set(DCA_WITH_SINGLE_PRECISION_TP_MEASUREMENTS ON CACHE BOOL "Measure two particle function in single precision." FORCE) set(MC_SCALAR float) else() set(MC_SCALAR double) endif() if (DCA_WITH_SINGLE_PRECISION_TP_MEASUREMENTS) set(TP_ACCUMULATION_SCALAR float) else() set(TP_ACCUMULATION_SCALAR double) endif() option(DCA_WITH_MANAGED_MEMORY "Use managed memory allocator." OFF) mark_as_advanced(DCA_WITH_MANAGED_MEMORY) if (DCA_WITH_MANAGED_MEMORY) Loading @@ -291,8 +292,8 @@ else() set(TWO_PARTICLE_ALLOCATOR "dca::linalg::util::DeviceAllocator<T>") endif() configure_file("${PROJECT_SOURCE_DIR}/include/dca/config/accumulation_options.hpp.in" "${CMAKE_BINARY_DIR}/include/dca/config/accumulation_options.hpp" @ONLY) configure_file("${PROJECT_SOURCE_DIR}/include/dca/config/mc_options.hpp.in" "${CMAKE_BINARY_DIR}/include/dca/config/mc_options.hpp" @ONLY) ################################################################################ Loading
include/dca/config/cmake_options.hpp +1 −0 Original line number Diff line number Diff line Loading @@ -40,6 +40,7 @@ struct CMakeOptions { static const std::string dca_profiler; static const std::string dca_with_autotuning; static const std::string dca_with_gnuplot; static const std::string dca_with_single_precision_mc; static const std::string dca_with_single_precision_tp_measurements; static const std::string dca_with_memory_savings; static const std::string dca_with_managed_memory; Loading
include/dca/config/accumulation_options.hpp.in→include/dca/config/mc_options.hpp.in +8 −7 Original line number Diff line number Diff line Loading @@ -9,20 +9,21 @@ // // This class stores compile time options for the MC accumulation. #ifndef DCA_CONFIG_ACCUMULATION_OPTIONS_HPP #define DCA_CONFIG_ACCUMULATION_OPTIONS_HPP #ifndef DCA_CONFIG_MC_OPTIONS_HPP #define DCA_CONFIG_MC_OPTIONS_HPP #ifdef DCA_HAVE_CUDA #include "dca/linalg/util/allocators/device_allocator.hpp" #include "dca/linalg/util/allocators/managed_allocator.hpp" #endif // DCA_HAVE_CUDA namespace dca { namespace config { // dca::config:: struct AccumulationOptions { struct McOptions { using MCScalar = @MC_SCALAR@; using TPAccumulationScalar = @TP_ACCUMULATION_SCALAR@; static constexpr bool memory_savings = @MEMORY_SAVINGS@; Loading @@ -33,7 +34,7 @@ struct AccumulationOptions { #endif // DCA_HAVE_CUDA }; } // config } // dca } // namespace config } // namespace dca #endif // DCA_CONFIG_ACCUMULATION_OPTIONS_HPP #endif // DCA_CONFIG_MC_OPTIONS_HPP
include/dca/function/function.hpp +14 −0 Original line number Diff line number Diff line Loading @@ -77,6 +77,8 @@ public: // the other function's construction. // Postcondition: The function's name is unchanged. function<scalartype, domain>& operator=(const function<scalartype, domain>& other); template <typename Scalar2> function<scalartype, domain>& operator=(const function<Scalar2, domain>& other); // Move assignment operator // Replaces the function's elements with those of other using move semantics. Loading Loading @@ -345,6 +347,18 @@ function<scalartype, domain>& function<scalartype, domain>::operator=( return *this; } template <typename Scalar, class domain> template <typename Scalar2> function<Scalar, domain>& function<Scalar, domain>::operator=(const function<Scalar2, domain>& other) { if (size() != other.size()) { throw(std::logic_error("Function size does not match.")); } std::copy_n(other.values(), Nb_elements, fnc_values); return *this; } template <typename scalartype, class domain> function<scalartype, domain>& function<scalartype, domain>::operator=( function<scalartype, domain>&& other) { Loading
include/dca/io/hdf5/hdf5_reader.hpp +13 −9 Original line number Diff line number Diff line Loading @@ -15,6 +15,7 @@ #include <complex> #include <string> #include <vector> #include <type_traits> #include "H5Cpp.h" Loading Loading @@ -271,22 +272,25 @@ bool HDF5Reader::execute(std::string name, dca::linalg::Matrix<scalar_type, dca: open_group(name); bool success = true; try { try {std::vector<int> size(2); execute("current-size", size); A.resizeNoCopy(std::make_pair(size[0], size[1])); std::vector<scalar_type> a_compressed(size[0] * size[1]); std::string full_name = get_path() + "/data"; H5::DataSet dataset = my_file->openDataSet(full_name.c_str()); H5::DataSpace dataspace = dataset.getSpace(); // These 2 lines fix the bug of reading into a matrix which has been resized to a smaller size // hsize_t global_size[2] = {A.nrCols(), A.nrRows()}; // HDF5 use row // major data distribution // hsize_t global_size[2] = {A.capacity().second, A.capacity().first}; // HDF5 use // row major data distribution // dataspace.setExtentSimple(2, &global_size[0], NULL); H5Dread(dataset.getId(), HDF5_TYPE<scalar_type>::get(), dataspace.getId(), H5S_ALL, H5P_DEFAULT, &A(0, 0)); a_compressed.data()); unsigned index = 0; for (int j = 0; j < A.nrCols(); ++j) for (int i = 0; i < A.nrRows(); ++i) A(i, j) = a_compressed[index++]; } catch (const H5::FileIException& err) { std::cout << "\n\n\t the function (" + name + ") does not exist in path : " + get_path() + Loading