Commit d48b4660 authored by gbalduzz's avatar gbalduzz
Browse files

Option to run CT-AUX in single precision

parent e988798a
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -21,7 +21,7 @@
set(DCA_WARNINGS -Wall -Wextra -Wpedantic -Wno-sign-compare -Wno-dangling-else)

# Languange standard
set(DCA_STD_FLAG -std=c++17)
set(DCA_STD_FLAG -std=c++14)

# Set C and CXX flags.
add_compile_options(${DCA_WARNINGS})
+40 −0
Original line number Diff line number Diff line
// Copyright (C) 2018 ETH Zurich
// Copyright (C) 2018 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)
//
// This class stores compile time options for the MC accumulation.

#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 McOptions {
  using MCScalar = @MC_SCALAR@;

  using TPAccumulationScalar = @TP_ACCUMULATION_SCALAR@;

  static constexpr bool memory_savings = @MEMORY_SAVINGS@;

#ifdef DCA_HAVE_CUDA
  template <typename T>
  using TpAllocator = @TWO_PARTICLE_ALLOCATOR@;
#endif  // DCA_HAVE_CUDA
};

}  // namespace config
}  // namespace dca

#endif  // DCA_CONFIG_MC_OPTIONS_HPP
+1 −12
Original line number Diff line number Diff line
@@ -347,19 +347,8 @@ private:

    matrix_type& T = basis_transformation_type::get_transformation_matrix();

    // TODO make better
    if constexpr (std::is_same<float, scalartype_input>::value &&
                  std::is_same<float, scalartype_output>::value) {
      func::function<double, domain_input> f_copy;
      f_copy = f_input;
      func::function<double, domain_output> f_out_cpy;
      TRANSFORM_DOMAIN_PROCEDURE<DMN_INDEX>::transform(f_copy, f_out_cpy, T);
      f_output = f_out_cpy;
    }
    else {
    TRANSFORM_DOMAIN_PROCEDURE<DMN_INDEX>::transform(f_input, f_output, T);
  }
  }
};

//
+12 −54
Original line number Diff line number Diff line
@@ -12,6 +12,8 @@
#ifndef DCA_MATH_FUNCTION_TRANSFORM_TRANSFORM_DOMAIN_PROCEDURE_HPP
#define DCA_MATH_FUNCTION_TRANSFORM_TRANSFORM_DOMAIN_PROCEDURE_HPP

#include <type_traits>

#include "dca/function/function.hpp"
#include "dca/function/util/real_complex_conversion.hpp"
#include "dca/linalg/linalg.hpp"
@@ -28,12 +30,6 @@ public:
  static void characterize_transformation(const f_input_t& f_input, const f_output_t& f_output,
                                          int& M, int& K, int& N, int& P);

  template <typename scalartype_1, class domain_input, typename scalartype_2, class domain_output,
            typename scalartype_3>
  static void transform(const func::function<scalartype_1, domain_input>& f_input,
                        func::function<scalartype_2, domain_output>& f_output,
                        const linalg::Matrix<scalartype_3, linalg::CPU>& T);

  template <typename scalartype, class domain_input, class domain_output>
  static void transform(const func::function<scalartype, domain_input>& f_input,
                        func::function<scalartype, domain_output>& f_output,
@@ -44,20 +40,11 @@ public:
                        func::function<std::complex<scalartype>, domain_output>& f_output,
                        const linalg::Matrix<scalartype, linalg::CPU>& T);

  template <typename scalartype, class domain_input, class domain_output>
  static void transform(const func::function<scalartype, domain_input>& f_input,
                        func::function<scalartype, domain_output>& f_output,
                        const linalg::Matrix<std::complex<scalartype>, linalg::CPU>& T);

  template <class domain_input, class domain_output>
  static void transform(const func::function<float, domain_input>& f_input,
                        func::function<float, domain_output>& f_output,
                        const linalg::Matrix<double, linalg::CPU>& T);

  template <class domain_input, class domain_output>
  static void transform(const func::function<std::complex<float>, domain_input>& f_input,
                        func::function<std::complex<float>, domain_output>& f_output,
                        const linalg::Matrix<std::complex<double>, linalg::CPU>& T);
  template <typename Scalartype, typename Scalartype2, class DomainInput, class DomainOutput,
            class = std::enable_if_t<std::is_scalar<Scalartype>::value>>
  static void transform(const func::function<Scalartype, DomainInput>& f_input,
                        func::function<Scalartype, DomainOutput>& f_output,
                        const linalg::Matrix<std::complex<Scalartype2>, linalg::CPU>& T);

  template <typename scalartype, class domain_input, class domain_output>
  static void transform(const func::function<scalartype, domain_output>& f_input,
@@ -138,12 +125,12 @@ void TRANSFORM_DOMAIN_PROCEDURE<DMN_INDEX>::transform(
}

template <int DMN_INDEX>
template <typename scalartype, class domain_input, class domain_output>
template <typename Scalartype, typename Scalartype2, class DomainInput, class DomainOutput, class>
void TRANSFORM_DOMAIN_PROCEDURE<DMN_INDEX>::transform(
    const func::function<scalartype, domain_input>& f_input,
    func::function<scalartype, domain_output>& f_output,
    const linalg::Matrix<std::complex<scalartype>, linalg::CPU>& T) {
  linalg::Matrix<scalartype, linalg::CPU> T_re("T_re", T.size());
    const func::function<Scalartype, DomainInput>& f_input,
    func::function<Scalartype, DomainOutput>& f_output,
    const linalg::Matrix<std::complex<Scalartype2>, linalg::CPU>& T) {
  linalg::Matrix<Scalartype, linalg::CPU> T_re("T_re", T.size());

  for (int j = 0; j < T.size().second; j++)
    for (int i = 0; i < T.size().first; i++)
@@ -152,35 +139,6 @@ void TRANSFORM_DOMAIN_PROCEDURE<DMN_INDEX>::transform(
  transform(f_input, f_output, T_re);
}

template <int DMN_INDEX>
template <class domain_input, class domain_output>
void TRANSFORM_DOMAIN_PROCEDURE<DMN_INDEX>::transform(const func::function<float, domain_input>& f_input,
                                                      func::function<float, domain_output>& f_output,
                                                      const linalg::Matrix<double, linalg::CPU>& T) {
  linalg::Matrix<float, linalg::CPU> T_float("T_re", T.size());

  for (int j = 0; j < T.size().second; j++)
    for (int i = 0; i < T.size().first; i++)
      T_float(i, j) = T(i, j);

  transform(f_input, f_output, T_float);
}

template <int DMN_INDEX>
template <class domain_input, class domain_output>
void TRANSFORM_DOMAIN_PROCEDURE<DMN_INDEX>::transform(
    const func::function<std::complex<float>, domain_input>& f_input,
    func::function<std::complex<float>, domain_output>& f_output,
    const linalg::Matrix<std::complex<double>, linalg::CPU>& T) {
  linalg::Matrix<std::complex<float>, linalg::CPU> T_float("T_re", T.size());

  for (int j = 0; j < T.size().second; j++)
    for (int i = 0; i < T.size().first; i++)
      T_float(i, j) = T(i, j);

  transform(f_input, f_output, T_float);
}

template <int DMN_INDEX>
template <typename scalartype, class domain_input, class domain_output>
void TRANSFORM_DOMAIN_PROCEDURE<DMN_INDEX>::transform(
+3 −2
Original line number Diff line number Diff line
@@ -41,6 +41,9 @@ class SpAccumulator;

template <class Parameters, typename Real>
class SpAccumulator<Parameters, linalg::CPU, Real> {
public:
    using Profiler = typename Parameters::profiler_type;
    using Scalar = Real;
protected:
  using TDmn = func::dmn_0<domains::time_domain>;
  using WDmn = func::dmn_0<domains::frequency_domain>;
@@ -51,8 +54,6 @@ protected:
  using NuDmn = func::dmn_variadic<BDmn, SDmn>;  // orbital-spin index
  using PDmn = func::dmn_variadic<BDmn, BDmn, RDmn>;

  using Profiler = typename Parameters::profiler_type;

public:
  SpAccumulator(/*const*/ Parameters& parameters_ref, bool accumulate_m_squared = false);

Loading