Commit a779f570 authored by gbalduzz's avatar gbalduzz
Browse files

Merge remote-tracking branch 'origin/master' into generic_container

parents 7fbf673d ee0de8cf
Loading
Loading
Loading
Loading
+43 −26
Original line number Diff line number Diff line
################################################################################
# Author: Urs R. Haehner (haehneru@itp.phys.ethz.ch)
#         Giovanni Badlduzzi (gbalduzz@itp.phys.ethz.ch)
#
# Build options for DCA++.

@@ -53,8 +54,8 @@ endif()
# TODO: Add more point groups and lattices.

# Point group
set(DCA_POINT_GROUP "D4" CACHE STRING "Point group symmetry, options are: C6 | D4.")
set_property(CACHE DCA_POINT_GROUP PROPERTY STRINGS C6 D4)
set(DCA_POINT_GROUP "D4" CACHE STRING "Point group symmetry, options are: C6 | D4 | no_symmetry<2>.")
set_property(CACHE DCA_POINT_GROUP PROPERTY STRINGS C6 D4 no_symmetry<2>)

if (DCA_POINT_GROUP STREQUAL "C6")
  set(DCA_POINT_GROUP_INCLUDE
@@ -63,14 +64,18 @@ if (DCA_POINT_GROUP STREQUAL "C6")
elseif (DCA_POINT_GROUP STREQUAL "D4")
  set(DCA_POINT_GROUP_INCLUDE "dca/phys/domains/cluster/symmetries/point_groups/2d/2d_square.hpp")

elseif (DCA_POINT_GROUP STREQUAL "no_symmetry<2>")
  set(DCA_POINT_GROUP_INCLUDE "dca/phys/domains/cluster/symmetries/point_groups/no_symmetry.hpp")

else()
  message(FATAL_ERROR "Please set DCA_POINT_GROUP to a valid option: C6 | D4.")
endif()

# Lattice type
set(DCA_LATTICE "square" CACHE STRING
    "Lattice type, options are: bilayer | square | triangular | twoband_chain | singleband_chain.")
set_property(CACHE DCA_LATTICE PROPERTY STRINGS bilayer square triangular twoband_chain singleband_chain)
set(DCA_LATTICE "square" CACHE STRING "Lattice type, options are: bilayer | square | triangular |
    hund | twoband_Cu | threeband | FeAs.")
set_property(CACHE DCA_LATTICE PROPERTY STRINGS bilayer square triangular hund twoband_Cu threeband
             FeAs)

if (DCA_LATTICE STREQUAL "bilayer")
  set(DCA_LATTICE_TYPE dca::phys::models::bilayer_lattice<PointGroup>)
@@ -86,19 +91,30 @@ elseif (DCA_LATTICE STREQUAL "triangular")
  set(DCA_LATTICE_TYPE dca::phys::models::triangular_lattice<PointGroup>)
  set(DCA_LATTICE_INCLUDE
    "dca/phys/models/analytic_hamiltonians/triangular_lattice.hpp")
elseif (DCA_LATTICE STREQUAL "hund")
  set(DCA_LATTICE_TYPE dca::phys::models::HundLattice<PointGroup>)

elseif (DCA_LATTICE STREQUAL "threeband")
  set(DCA_LATTICE_TYPE dca::phys::models::ThreebandHubbard<PointGroup>)
  set(DCA_LATTICE_INCLUDE
    "dca/phys/models/analytic_hamiltonians/threeband_hubbard.hpp")

elseif (DCA_LATTICE STREQUAL "twoband_chain")
  set(DCA_LATTICE_TYPE dca::phys::models::twoband_chain<dca::phys::domains::no_symmetry<1>>)
  set(DCA_LATTICE_INCLUDE
      "dca/phys/models/analytic_hamiltonians/twoband_chain.hpp")

elseif (DCA_LATTICE STREQUAL "singleband_chain")
  set(DCA_LATTICE_TYPE dca::phys::models::singleband_chain<dca::phys::domains::no_symmetry<1>>)
      "dca/phys/models/analytic_hamiltonians/hund_lattice.hpp")
elseif (DCA_LATTICE STREQUAL "FeAs")
  set(DCA_LATTICE_TYPE dca::phys::models::FeAsLattice<PointGroup>)
  set(DCA_LATTICE_INCLUDE
      "dca/phys/models/analytic_hamiltonians/fe_as_lattice.hpp")
elseif (DCA_LATTICE STREQUAL "twoband_Cu")
  set(DCA_LATTICE_TYPE dca::phys::models::TwoBandCu<PointGroup>)
  set(DCA_LATTICE_INCLUDE
      "dca/phys/models/analytic_hamiltonians/singleband_chain.hpp")
      "dca/phys/models/analytic_hamiltonians/twoband_Cu.hpp")

else()
  message(FATAL_ERROR
          "Please set DCA_LATTICE to a valid option: bilayer | square | triangular | twoband_chain | singleband_chain.")
  message(FATAL_ERROR "Please set DCA_LATTICE to a valid option: bilayer | square | triangular |
          hund | twoband_Cu | threeband | FeAs.")
endif()

# Model type
@@ -235,16 +251,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)
@@ -267,7 +273,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)
@@ -277,12 +283,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)
@@ -291,8 +308,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)


################################################################################
+1 −0
Original line number Diff line number Diff line
@@ -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;
+8 −7
Original line number Diff line number Diff line
@@ -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@;
@@ -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
+3 −3
Original line number Diff line number Diff line
@@ -37,7 +37,7 @@ public:
    return parameters::get_size();
  }

  static std::vector<element_type>& get_elements() {
  static const std::vector<element_type>& get_elements() {
    return parameters::get_elements();
  }

@@ -75,7 +75,7 @@ void dmn_0<parameters>::reset() {
  dmn_0::initialize();
}

}  // func
}  // dca
}  // namespace func
}  // namespace dca

#endif  // DCA_FUNCTION_DOMAINS_DMN_0_HPP
+14 −0
Original line number Diff line number Diff line
@@ -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.
@@ -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