Loading applications/dca/main_dca.cpp +16 −15 Original line number Diff line number Diff line Loading @@ -74,21 +74,22 @@ int main(int argc, char** argv) { dca::DistType distribution = parameters.get_g4_distribution(); switch (distribution) { case dca::DistType::MPI: { #ifdef DCA_HAVE_MPI case dca::DistType::MPI: { DCALoopDispatch<dca::DistType::MPI> dca_loop_dispatch; dca_loop_dispatch(parameters, dca_data, concurrency); } break; case dca::DistType::NONE: { } break; #else case dca::DistType::MPI: { throw std::runtime_error( "Input calls for function MPI distribution but DCA is not built with MPI."); } break; #endif case dca::DistType::NONE: { DCALoopDispatch<dca::DistType::NONE> dca_loop_dispatch; dca_loop_dispatch(parameters, dca_data, concurrency); } break; } break; } } catch (const std::exception& err) { std::cout << "Unhandled exception in main function:\n\t" << err.what(); Loading include/dca/distribution/dist_types.hpp +6 −0 Original line number Diff line number Diff line Loading @@ -6,14 +6,20 @@ // See CITATION.md for citation guidelines, if DCA++ is used for scientific publications. // // Author: Peter Doak (doakpw@ornl.gov) // Giovanni Balduzzi (gbalduzz@itp.phys.ethz.ch) // // This file provides distribution strategy tags #ifndef DCA_DIST_TYPE_HPP #define DCA_DIST_TYPE_HPP #include <string> namespace dca { enum class DistType { NONE, MPI }; DistType stringToDistType(const std::string& name); std::string toString(DistType type); } // namespace dca #endif // DCA_DIST_TYPE_HPP include/dca/function/function.hpp +7 −1 Original line number Diff line number Diff line Loading @@ -30,11 +30,14 @@ #include "dca/distribution/dist_types.hpp" #include "dca/function/scalar_cast.hpp" #include "dca/function/set_to_zero.hpp" #include "dca/util/ignore.hpp" #include "dca/util/pack_operations.hpp" #include "dca/util/type_utils.hpp" #include "dca/parallel/util/get_workload.hpp" #ifdef DCA_HAVE_MPI #include "mpi.h" #endif namespace dca { namespace func { Loading Loading @@ -302,12 +305,15 @@ function<scalartype, domain>::function(const std::string& name, DistType dist) size_sbdm(dmn.get_leaf_domain_sizes()), step_sbdm(dmn.get_leaf_domain_steps()), fnc_values(nullptr) { if (name.substr(0, 2) == "G4" && dist == DistType::MPI) { dca::util::ignoreUnused(dist); #ifdef DCA_HAVE_MPI if (dist == DistType::MPI) { int my_rank, mpi_size; MPI_Comm_size(MPI_COMM_WORLD, &mpi_size); MPI_Comm_rank(MPI_COMM_WORLD, &my_rank); nb_elements_ = dca::parallel::util::getWorkload(dmn.get_size(), mpi_size, my_rank); } #endif // DCA_HAVE_MPI fnc_values = new scalartype[nb_elements_]; for (int linind = 0; linind < nb_elements_; ++linind) setToZero(fnc_values[linind]); Loading include/dca/parallel/no_concurrency/serial_gather.hpp +0 −4 Original line number Diff line number Diff line Loading @@ -14,12 +14,8 @@ #include <vector> #include <mpi.h> #include "dca/function/domains.hpp" #include "dca/function/function.hpp" #include "dca/parallel/mpi_concurrency/mpi_gang.hpp" #include "dca/parallel/mpi_concurrency/mpi_type_map.hpp" #include "dca/util/integer_division.hpp" namespace dca { Loading include/dca/phys/dca_step/cluster_solver/ctaux/ctaux_accumulator.hpp +4 −3 Original line number Diff line number Diff line Loading @@ -43,17 +43,18 @@ #ifdef DCA_HAVE_CUDA #include "dca/phys/dca_step/cluster_solver/shared_tools/accumulation/sp/sp_accumulator_gpu.hpp" #include "dca/phys/dca_step/cluster_solver/shared_tools/accumulation/tp/tp_accumulator_gpu.hpp" #endif // DCA_HAVE_CUDA #ifdef DCA_HAVE_MPI #include "dca/phys/dca_step/cluster_solver/shared_tools/accumulation/tp/tp_accumulator_mpi_gpu.hpp" #endif // DCA_HAVE_MPI #endif // DCA_HAVE_CUDA namespace dca { namespace phys { namespace solver { namespace ctaux { // dca::phys::solver::ctaux:: template <dca::linalg::DeviceType device_t, class Parameters, class Data, DistType DIST, typename Real = double> template <dca::linalg::DeviceType device_t, class Parameters, class Data, DistType DIST = dca::DistType::NONE, typename Real = double> class CtauxAccumulator : public MC_accumulator_data { public: using this_type = CtauxAccumulator<device_t, Parameters, Data, DIST, Real>; Loading Loading @@ -162,7 +163,7 @@ public: } static std::size_t staticDeviceFingerprint() { return accumulator::TpAccumulator<Parameters, device_t>::staticDeviceFingerprint(); return accumulator::TpAccumulator<Parameters, device_t, DIST>::staticDeviceFingerprint(); } private: Loading Loading
applications/dca/main_dca.cpp +16 −15 Original line number Diff line number Diff line Loading @@ -74,21 +74,22 @@ int main(int argc, char** argv) { dca::DistType distribution = parameters.get_g4_distribution(); switch (distribution) { case dca::DistType::MPI: { #ifdef DCA_HAVE_MPI case dca::DistType::MPI: { DCALoopDispatch<dca::DistType::MPI> dca_loop_dispatch; dca_loop_dispatch(parameters, dca_data, concurrency); } break; case dca::DistType::NONE: { } break; #else case dca::DistType::MPI: { throw std::runtime_error( "Input calls for function MPI distribution but DCA is not built with MPI."); } break; #endif case dca::DistType::NONE: { DCALoopDispatch<dca::DistType::NONE> dca_loop_dispatch; dca_loop_dispatch(parameters, dca_data, concurrency); } break; } break; } } catch (const std::exception& err) { std::cout << "Unhandled exception in main function:\n\t" << err.what(); Loading
include/dca/distribution/dist_types.hpp +6 −0 Original line number Diff line number Diff line Loading @@ -6,14 +6,20 @@ // See CITATION.md for citation guidelines, if DCA++ is used for scientific publications. // // Author: Peter Doak (doakpw@ornl.gov) // Giovanni Balduzzi (gbalduzz@itp.phys.ethz.ch) // // This file provides distribution strategy tags #ifndef DCA_DIST_TYPE_HPP #define DCA_DIST_TYPE_HPP #include <string> namespace dca { enum class DistType { NONE, MPI }; DistType stringToDistType(const std::string& name); std::string toString(DistType type); } // namespace dca #endif // DCA_DIST_TYPE_HPP
include/dca/function/function.hpp +7 −1 Original line number Diff line number Diff line Loading @@ -30,11 +30,14 @@ #include "dca/distribution/dist_types.hpp" #include "dca/function/scalar_cast.hpp" #include "dca/function/set_to_zero.hpp" #include "dca/util/ignore.hpp" #include "dca/util/pack_operations.hpp" #include "dca/util/type_utils.hpp" #include "dca/parallel/util/get_workload.hpp" #ifdef DCA_HAVE_MPI #include "mpi.h" #endif namespace dca { namespace func { Loading Loading @@ -302,12 +305,15 @@ function<scalartype, domain>::function(const std::string& name, DistType dist) size_sbdm(dmn.get_leaf_domain_sizes()), step_sbdm(dmn.get_leaf_domain_steps()), fnc_values(nullptr) { if (name.substr(0, 2) == "G4" && dist == DistType::MPI) { dca::util::ignoreUnused(dist); #ifdef DCA_HAVE_MPI if (dist == DistType::MPI) { int my_rank, mpi_size; MPI_Comm_size(MPI_COMM_WORLD, &mpi_size); MPI_Comm_rank(MPI_COMM_WORLD, &my_rank); nb_elements_ = dca::parallel::util::getWorkload(dmn.get_size(), mpi_size, my_rank); } #endif // DCA_HAVE_MPI fnc_values = new scalartype[nb_elements_]; for (int linind = 0; linind < nb_elements_; ++linind) setToZero(fnc_values[linind]); Loading
include/dca/parallel/no_concurrency/serial_gather.hpp +0 −4 Original line number Diff line number Diff line Loading @@ -14,12 +14,8 @@ #include <vector> #include <mpi.h> #include "dca/function/domains.hpp" #include "dca/function/function.hpp" #include "dca/parallel/mpi_concurrency/mpi_gang.hpp" #include "dca/parallel/mpi_concurrency/mpi_type_map.hpp" #include "dca/util/integer_division.hpp" namespace dca { Loading
include/dca/phys/dca_step/cluster_solver/ctaux/ctaux_accumulator.hpp +4 −3 Original line number Diff line number Diff line Loading @@ -43,17 +43,18 @@ #ifdef DCA_HAVE_CUDA #include "dca/phys/dca_step/cluster_solver/shared_tools/accumulation/sp/sp_accumulator_gpu.hpp" #include "dca/phys/dca_step/cluster_solver/shared_tools/accumulation/tp/tp_accumulator_gpu.hpp" #endif // DCA_HAVE_CUDA #ifdef DCA_HAVE_MPI #include "dca/phys/dca_step/cluster_solver/shared_tools/accumulation/tp/tp_accumulator_mpi_gpu.hpp" #endif // DCA_HAVE_MPI #endif // DCA_HAVE_CUDA namespace dca { namespace phys { namespace solver { namespace ctaux { // dca::phys::solver::ctaux:: template <dca::linalg::DeviceType device_t, class Parameters, class Data, DistType DIST, typename Real = double> template <dca::linalg::DeviceType device_t, class Parameters, class Data, DistType DIST = dca::DistType::NONE, typename Real = double> class CtauxAccumulator : public MC_accumulator_data { public: using this_type = CtauxAccumulator<device_t, Parameters, Data, DIST, Real>; Loading Loading @@ -162,7 +163,7 @@ public: } static std::size_t staticDeviceFingerprint() { return accumulator::TpAccumulator<Parameters, device_t>::staticDeviceFingerprint(); return accumulator::TpAccumulator<Parameters, device_t, DIST>::staticDeviceFingerprint(); } private: Loading