Loading include/dca/parallel/mpi_concurrency/mpi_collective_sum.hpp +5 −2 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ #include "dca/linalg/vector.hpp" #include "dca/parallel/mpi_concurrency/mpi_processor_grouping.hpp" #include "dca/parallel/mpi_concurrency/mpi_type_map.hpp" #include "dca/util/type_utils.hpp" namespace dca { namespace parallel { Loading Loading @@ -508,8 +509,10 @@ std::vector<Scalar> MPICollectiveSum::avgNormalizedMomenta(const func::function< template <typename T> void MPICollectiveSum::sum(const T* in, T* out, std::size_t n) const { // On summit large messages hangs even if the size is lower than 2^31-1. constexpr std::size_t max_size = std::numeric_limits<int>::max() / 10; // On summit large messages hangs if sizeof(floating point type) type * message_size > 2^31-1. constexpr std::size_t max_size = dca::util::IsComplex<T>::value ? 2 * (std::numeric_limits<int>::max() / sizeof(T)) : std::numeric_limits<int>::max() / sizeof(T); for (std::size_t start = 0; start < n; start += max_size) { const int msg_size = std::min(n - start, max_size); Loading include/dca/util/type_utils.hpp +12 −0 Original line number Diff line number Diff line Loading @@ -6,6 +6,7 @@ // See CITATION.md for citation guidelines, if DCA++ is used for scientific publications. // // Author: John Biddiscombe (john.biddiscombe@cscs.ch) // Giovanni Balduzzi (gbalduzz@itp.phys.ethz.ch) // // This file provides utility functions that operate on types. // Loading @@ -14,6 +15,7 @@ #ifndef DCA_UTIL_TYPE_UTILS_HPP #define DCA_UTIL_TYPE_UTILS_HPP #include <complex> #include <memory> #include <string> #include <type_traits> Loading Loading @@ -163,6 +165,16 @@ struct print_type<dca::util::Typelist<Domain, Domains...>> { } }; // Determine if a type is complex or not. template <class T> struct IsComplex { constexpr static bool value = 0; }; template <class T> struct IsComplex<std::complex<T>> { constexpr static bool value = 1; }; } // util } // dca Loading Loading
include/dca/parallel/mpi_concurrency/mpi_collective_sum.hpp +5 −2 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ #include "dca/linalg/vector.hpp" #include "dca/parallel/mpi_concurrency/mpi_processor_grouping.hpp" #include "dca/parallel/mpi_concurrency/mpi_type_map.hpp" #include "dca/util/type_utils.hpp" namespace dca { namespace parallel { Loading Loading @@ -508,8 +509,10 @@ std::vector<Scalar> MPICollectiveSum::avgNormalizedMomenta(const func::function< template <typename T> void MPICollectiveSum::sum(const T* in, T* out, std::size_t n) const { // On summit large messages hangs even if the size is lower than 2^31-1. constexpr std::size_t max_size = std::numeric_limits<int>::max() / 10; // On summit large messages hangs if sizeof(floating point type) type * message_size > 2^31-1. constexpr std::size_t max_size = dca::util::IsComplex<T>::value ? 2 * (std::numeric_limits<int>::max() / sizeof(T)) : std::numeric_limits<int>::max() / sizeof(T); for (std::size_t start = 0; start < n; start += max_size) { const int msg_size = std::min(n - start, max_size); Loading
include/dca/util/type_utils.hpp +12 −0 Original line number Diff line number Diff line Loading @@ -6,6 +6,7 @@ // See CITATION.md for citation guidelines, if DCA++ is used for scientific publications. // // Author: John Biddiscombe (john.biddiscombe@cscs.ch) // Giovanni Balduzzi (gbalduzz@itp.phys.ethz.ch) // // This file provides utility functions that operate on types. // Loading @@ -14,6 +15,7 @@ #ifndef DCA_UTIL_TYPE_UTILS_HPP #define DCA_UTIL_TYPE_UTILS_HPP #include <complex> #include <memory> #include <string> #include <type_traits> Loading Loading @@ -163,6 +165,16 @@ struct print_type<dca::util::Typelist<Domain, Domains...>> { } }; // Determine if a type is complex or not. template <class T> struct IsComplex { constexpr static bool value = 0; }; template <class T> struct IsComplex<std::complex<T>> { constexpr static bool value = 1; }; } // util } // dca Loading