Loading applications/dca/CMakeLists.txt +1 −1 Original line number Diff line number Diff line Loading @@ -8,5 +8,5 @@ if (DCA_BUILD_DCA) target_link_libraries(main_dca PRIVATE ${DCA_GPU_LIBS}) endif() target_link_libraries(main_dca PRIVATE signals ${DCA_LIBS}) target_link_libraries(main_dca PUBLIC signals ${DCA_LIBS}) endif() cmake/dca_config.cmake +1 −0 Original line number Diff line number Diff line Loading @@ -85,6 +85,7 @@ endif() option(DCA_WITH_ADIOS2 "Enable ADIOS2 support." OFF) if (DCA_WITH_ADIOS2) dca_add_config_define(DCA_WITH_ADIOS2) dca_add_haves_define(DCA_HAVE_ADIOS2) endif() ################################################################################ # Select the point group, the lattice type, and the model type. Loading cmake/dca_external_libs.cmake +0 −11 Original line number Diff line number Diff line Loading @@ -9,9 +9,6 @@ set(DCA_EXTERNAL_LIBS "" CACHE INTERNAL "") set(DCA_EXTERNAL_INCLUDE_DIRS "" CACHE INTERNAL "") set(DCA_EXTERNAL_IO_LIBS "" CACHE INTERNAL "") set(DCA_EXTERNAL_IO_INCLUDE_DIRS "" CACHE INTERNAL "") ################################################################################ # Lapack if (NOT DCA_HAVE_LAPACK) Loading Loading @@ -44,9 +41,6 @@ list(APPEND DCA_EXTERNAL_LIBS ${LAPACK_LIBRARIES}) # HDF5 find_package(HDF5 REQUIRED COMPONENTS C CXX) # append the library target not HDF_LIBRARIES, in modern cmake you need the target. # on spock this is all that will work with cray's hdf5 list(APPEND DCA_EXTERNAL_IO_LIBS hdf5::hdf5_cpp) ################################################################################ # ADIOS2 Loading @@ -54,8 +48,6 @@ if (DCA_WITH_ADIOS2) set(DCA_HAVE_ADIOS2 FALSE CACHE INTERNAL "") find_package(ADIOS2) if (ADIOS2_FOUND) list(APPEND DCA_EXTERNAL_IO_LIBS ${ADIOS2_LIBRARIES}) list(APPEND DCA_EXTERNAL_IO_INCLUDE_DIRS ${ADIOS2_INCLUDE_DIRS}) set(DCA_HAVE_ADIOS2 TRUE CACHE INTERNAL "") #message("ADIOS2: libraries ${ADIOS2_LIBRARIES}") endif() Loading @@ -80,8 +72,5 @@ add_subdirectory(${PROJECT_SOURCE_DIR}/libs/simplex_gm_rule) list(APPEND DCA_EXTERNAL_LIBS ${GNUPLOT_INTERFACE_LIBRARY}) list(APPEND DCA_EXTERNAL_INCLUDE_DIRS ${GNUPLOT_INTERFACE_INCLUDE_DIR}) list(APPEND DCA_EXTERNAL_LIBS ${DCA_EXTERNAL_IO_LIBS}) list(APPEND DCA_EXTERNAL_INCLUDE_DIRS ${DCA_EXTERNAL_IO_INCLUDE_DIRS}) message("DCA_EXTERNAL_LIBS = ${DCA_EXTERNAL_LIBS}") message("DCA_EXTERNAL_INCLUDE_DIRS = ${DCA_EXTERNAL_INCLUDE_DIRS}") include/dca/io/adios2/adios2_reader.hpp +6 −1 Original line number Diff line number Diff line Loading @@ -46,6 +46,10 @@ public: ADIOS2Reader(adios2::ADIOS& adios, const CT* concurrency, bool verbose = false); /** maybe this one uses a singleton adios2::ADIOS accessor */ ADIOS2Reader(const CT* concurrency, bool verbose = false); ~ADIOS2Reader(); constexpr bool is_reader() { Loading Loading @@ -171,8 +175,9 @@ template <class CT> template <typename Scalar> bool ADIOS2Reader<CT>::execute(const std::string& name, std::vector<Scalar>& value) { std::string full_name = get_path(name); if (!exists(full_name)) { if(verbose_) std::cout << "ADIOS2Reader variable: " << full_name << " not found\n"; return false; } Loading include/dca/io/adios2/adios2_writer.hpp +44 −10 Original line number Diff line number Diff line // Copyright (C) 2020 ETH Zurich // Copyright (C) 2020 UT-Battelle, LLC // Copyright (C) 2021 ETH Zurich // Copyright (C) 2021 UT-Battelle, LLC // All rights reserved. // // See LICENSE for terms of usage. Loading Loading @@ -45,6 +45,7 @@ public: public: ADIOS2Writer() = delete; ADIOS2Writer(const CT* concurrency, bool verbose = false); // In: verbose. If true, the writer outputs a short log whenever it is executed. ADIOS2Writer(adios2::ADIOS& adios, const CT* concurrency, bool verbose = false); ~ADIOS2Writer(); Loading @@ -62,12 +63,18 @@ public: void open_group(const std::string& new_path); void close_group(); void begin_step(); void end_step(); std::string get_path(const std::string& name = ""); template <typename arbitrary_struct_t> static void to_file(adios2::ADIOS& adios, const arbitrary_struct_t& arbitrary_struct, const std::string& file_name); void erase(const std::string& name); void execute(const std::string& name, bool value); template <typename Scalar> void execute(const std::string& name, Scalar value); Loading Loading @@ -149,9 +156,13 @@ public: mutex_.unlock(); } void set_verbose(bool verbose) { verbose_ = verbose; } private: adios2::ADIOS& adios_; const bool verbose_; bool verbose_; const CT* concurrency_; template <typename Scalar> Loading @@ -164,6 +175,9 @@ private: void write(const std::string& name, const std::vector<size_t>& size, const Scalar* data, const std::vector<size_t>& start, const std::vector<size_t>& count); template <typename T, typename... Args> void getVariable(const std::string& name, adios2::Variable<T>& var, const Args&... args); template <typename Scalar> void addAttribute(const std::string& set, const std::string& name, const std::vector<size_t>& size, const Scalar* data); Loading @@ -185,6 +199,17 @@ private: std::vector<size_t> size_check_; }; template <class CT> template <typename T, typename... Args> void ADIOS2Writer<CT>::getVariable(const std::string& name, adios2::Variable<T>& var, const Args&... args) { adios2::Variable<T> var_temp = io_.InquireVariable<T>(name); if (static_cast<bool>(var_temp) == false) var = io_.DefineVariable<T>(name, args...); else var = var_temp; } template <class CT> template <typename arbitrary_struct_t> void ADIOS2Writer<CT>::to_file(adios2::ADIOS& adios, const arbitrary_struct_t& arbitrary_struct, Loading @@ -204,6 +229,14 @@ void ADIOS2Writer<CT>::execute(const std::string& name, Scalar value) { write<Scalar>(full_name, dims, &value); } template <class CT> void ADIOS2Writer<CT>::execute(const std::string& name, bool value) { const std::string full_name = get_path(name); std::vector<size_t> dims{1}; int int_value = value; write<int>(full_name, dims, &int_value); } template <class CT> template <typename Scalar> void ADIOS2Writer<CT>::execute(const std::string& name, const std::pair<Scalar, Scalar>& value) { Loading Loading @@ -253,7 +286,7 @@ void ADIOS2Writer<CT>::execute(const std::string& name, adios2::Dims dims{nTotal}; adios2::Variable<Scalar> vVecs; adios2::Dims start{0}; vVecs = io_.DefineVariable<Scalar>(full_name, dims, start, dims); getVariable<Scalar>(full_name, vVecs, dims, start, dims); typename adios2::Variable<Scalar>::Span span = file_.Put(vVecs); size_t pos = 0; Loading @@ -279,7 +312,7 @@ void ADIOS2Writer<CT>::execute(const std::string& name, adios2::Dims dims{value.size(), n}; adios2::Variable<Scalar> v; adios2::Dims start{0, 0}; v = io_.DefineVariable<Scalar>(full_name, dims, start, dims); getVariable(full_name, v, dims, start, dims); typename adios2::Variable<Scalar>::Span span = file_.Put(v); Loading Loading @@ -518,11 +551,11 @@ void ADIOS2Writer<CT>::write(const std::string& name, const std::vector<size_t>& size_t ndim = size.size(); adios2::Variable<Scalar> v; if (ndim == 0) { v = io_.DefineVariable<Scalar>(name); getVariable<Scalar>(name, v); } else { std::vector<size_t> start(ndim, 0); v = io_.DefineVariable<Scalar>(name, size, start, size); getVariable<Scalar>(name, v, size, start, size); } file_.Put(v, data, adios2::Mode::Sync); } Loading @@ -535,10 +568,10 @@ void ADIOS2Writer<CT>::write(const std::string& name, const std::vector<size_t>& size_t ndim = size.size(); adios2::Variable<Scalar> v; if (ndim == 0) { v = io_.DefineVariable<Scalar>(name); getVariable<Scalar>(name, v); } else { v = io_.DefineVariable<Scalar>(name, size, start, count); getVariable<Scalar>(name, v, size, start, count); } file_.Put(v, data, adios2::Mode::Sync); } Loading Loading @@ -575,8 +608,9 @@ std::string ADIOS2Writer<CT>::VectorToString(const std::vector<T>& v) { } extern template class ADIOS2Writer<dca::parallel::NoConcurrency>; #ifdef DCA_HAVE_MPI extern template class ADIOS2Writer<dca::parallel::MPIConcurrency>; #endif } // namespace io } // namespace dca Loading Loading
applications/dca/CMakeLists.txt +1 −1 Original line number Diff line number Diff line Loading @@ -8,5 +8,5 @@ if (DCA_BUILD_DCA) target_link_libraries(main_dca PRIVATE ${DCA_GPU_LIBS}) endif() target_link_libraries(main_dca PRIVATE signals ${DCA_LIBS}) target_link_libraries(main_dca PUBLIC signals ${DCA_LIBS}) endif()
cmake/dca_config.cmake +1 −0 Original line number Diff line number Diff line Loading @@ -85,6 +85,7 @@ endif() option(DCA_WITH_ADIOS2 "Enable ADIOS2 support." OFF) if (DCA_WITH_ADIOS2) dca_add_config_define(DCA_WITH_ADIOS2) dca_add_haves_define(DCA_HAVE_ADIOS2) endif() ################################################################################ # Select the point group, the lattice type, and the model type. Loading
cmake/dca_external_libs.cmake +0 −11 Original line number Diff line number Diff line Loading @@ -9,9 +9,6 @@ set(DCA_EXTERNAL_LIBS "" CACHE INTERNAL "") set(DCA_EXTERNAL_INCLUDE_DIRS "" CACHE INTERNAL "") set(DCA_EXTERNAL_IO_LIBS "" CACHE INTERNAL "") set(DCA_EXTERNAL_IO_INCLUDE_DIRS "" CACHE INTERNAL "") ################################################################################ # Lapack if (NOT DCA_HAVE_LAPACK) Loading Loading @@ -44,9 +41,6 @@ list(APPEND DCA_EXTERNAL_LIBS ${LAPACK_LIBRARIES}) # HDF5 find_package(HDF5 REQUIRED COMPONENTS C CXX) # append the library target not HDF_LIBRARIES, in modern cmake you need the target. # on spock this is all that will work with cray's hdf5 list(APPEND DCA_EXTERNAL_IO_LIBS hdf5::hdf5_cpp) ################################################################################ # ADIOS2 Loading @@ -54,8 +48,6 @@ if (DCA_WITH_ADIOS2) set(DCA_HAVE_ADIOS2 FALSE CACHE INTERNAL "") find_package(ADIOS2) if (ADIOS2_FOUND) list(APPEND DCA_EXTERNAL_IO_LIBS ${ADIOS2_LIBRARIES}) list(APPEND DCA_EXTERNAL_IO_INCLUDE_DIRS ${ADIOS2_INCLUDE_DIRS}) set(DCA_HAVE_ADIOS2 TRUE CACHE INTERNAL "") #message("ADIOS2: libraries ${ADIOS2_LIBRARIES}") endif() Loading @@ -80,8 +72,5 @@ add_subdirectory(${PROJECT_SOURCE_DIR}/libs/simplex_gm_rule) list(APPEND DCA_EXTERNAL_LIBS ${GNUPLOT_INTERFACE_LIBRARY}) list(APPEND DCA_EXTERNAL_INCLUDE_DIRS ${GNUPLOT_INTERFACE_INCLUDE_DIR}) list(APPEND DCA_EXTERNAL_LIBS ${DCA_EXTERNAL_IO_LIBS}) list(APPEND DCA_EXTERNAL_INCLUDE_DIRS ${DCA_EXTERNAL_IO_INCLUDE_DIRS}) message("DCA_EXTERNAL_LIBS = ${DCA_EXTERNAL_LIBS}") message("DCA_EXTERNAL_INCLUDE_DIRS = ${DCA_EXTERNAL_INCLUDE_DIRS}")
include/dca/io/adios2/adios2_reader.hpp +6 −1 Original line number Diff line number Diff line Loading @@ -46,6 +46,10 @@ public: ADIOS2Reader(adios2::ADIOS& adios, const CT* concurrency, bool verbose = false); /** maybe this one uses a singleton adios2::ADIOS accessor */ ADIOS2Reader(const CT* concurrency, bool verbose = false); ~ADIOS2Reader(); constexpr bool is_reader() { Loading Loading @@ -171,8 +175,9 @@ template <class CT> template <typename Scalar> bool ADIOS2Reader<CT>::execute(const std::string& name, std::vector<Scalar>& value) { std::string full_name = get_path(name); if (!exists(full_name)) { if(verbose_) std::cout << "ADIOS2Reader variable: " << full_name << " not found\n"; return false; } Loading
include/dca/io/adios2/adios2_writer.hpp +44 −10 Original line number Diff line number Diff line // Copyright (C) 2020 ETH Zurich // Copyright (C) 2020 UT-Battelle, LLC // Copyright (C) 2021 ETH Zurich // Copyright (C) 2021 UT-Battelle, LLC // All rights reserved. // // See LICENSE for terms of usage. Loading Loading @@ -45,6 +45,7 @@ public: public: ADIOS2Writer() = delete; ADIOS2Writer(const CT* concurrency, bool verbose = false); // In: verbose. If true, the writer outputs a short log whenever it is executed. ADIOS2Writer(adios2::ADIOS& adios, const CT* concurrency, bool verbose = false); ~ADIOS2Writer(); Loading @@ -62,12 +63,18 @@ public: void open_group(const std::string& new_path); void close_group(); void begin_step(); void end_step(); std::string get_path(const std::string& name = ""); template <typename arbitrary_struct_t> static void to_file(adios2::ADIOS& adios, const arbitrary_struct_t& arbitrary_struct, const std::string& file_name); void erase(const std::string& name); void execute(const std::string& name, bool value); template <typename Scalar> void execute(const std::string& name, Scalar value); Loading Loading @@ -149,9 +156,13 @@ public: mutex_.unlock(); } void set_verbose(bool verbose) { verbose_ = verbose; } private: adios2::ADIOS& adios_; const bool verbose_; bool verbose_; const CT* concurrency_; template <typename Scalar> Loading @@ -164,6 +175,9 @@ private: void write(const std::string& name, const std::vector<size_t>& size, const Scalar* data, const std::vector<size_t>& start, const std::vector<size_t>& count); template <typename T, typename... Args> void getVariable(const std::string& name, adios2::Variable<T>& var, const Args&... args); template <typename Scalar> void addAttribute(const std::string& set, const std::string& name, const std::vector<size_t>& size, const Scalar* data); Loading @@ -185,6 +199,17 @@ private: std::vector<size_t> size_check_; }; template <class CT> template <typename T, typename... Args> void ADIOS2Writer<CT>::getVariable(const std::string& name, adios2::Variable<T>& var, const Args&... args) { adios2::Variable<T> var_temp = io_.InquireVariable<T>(name); if (static_cast<bool>(var_temp) == false) var = io_.DefineVariable<T>(name, args...); else var = var_temp; } template <class CT> template <typename arbitrary_struct_t> void ADIOS2Writer<CT>::to_file(adios2::ADIOS& adios, const arbitrary_struct_t& arbitrary_struct, Loading @@ -204,6 +229,14 @@ void ADIOS2Writer<CT>::execute(const std::string& name, Scalar value) { write<Scalar>(full_name, dims, &value); } template <class CT> void ADIOS2Writer<CT>::execute(const std::string& name, bool value) { const std::string full_name = get_path(name); std::vector<size_t> dims{1}; int int_value = value; write<int>(full_name, dims, &int_value); } template <class CT> template <typename Scalar> void ADIOS2Writer<CT>::execute(const std::string& name, const std::pair<Scalar, Scalar>& value) { Loading Loading @@ -253,7 +286,7 @@ void ADIOS2Writer<CT>::execute(const std::string& name, adios2::Dims dims{nTotal}; adios2::Variable<Scalar> vVecs; adios2::Dims start{0}; vVecs = io_.DefineVariable<Scalar>(full_name, dims, start, dims); getVariable<Scalar>(full_name, vVecs, dims, start, dims); typename adios2::Variable<Scalar>::Span span = file_.Put(vVecs); size_t pos = 0; Loading @@ -279,7 +312,7 @@ void ADIOS2Writer<CT>::execute(const std::string& name, adios2::Dims dims{value.size(), n}; adios2::Variable<Scalar> v; adios2::Dims start{0, 0}; v = io_.DefineVariable<Scalar>(full_name, dims, start, dims); getVariable(full_name, v, dims, start, dims); typename adios2::Variable<Scalar>::Span span = file_.Put(v); Loading Loading @@ -518,11 +551,11 @@ void ADIOS2Writer<CT>::write(const std::string& name, const std::vector<size_t>& size_t ndim = size.size(); adios2::Variable<Scalar> v; if (ndim == 0) { v = io_.DefineVariable<Scalar>(name); getVariable<Scalar>(name, v); } else { std::vector<size_t> start(ndim, 0); v = io_.DefineVariable<Scalar>(name, size, start, size); getVariable<Scalar>(name, v, size, start, size); } file_.Put(v, data, adios2::Mode::Sync); } Loading @@ -535,10 +568,10 @@ void ADIOS2Writer<CT>::write(const std::string& name, const std::vector<size_t>& size_t ndim = size.size(); adios2::Variable<Scalar> v; if (ndim == 0) { v = io_.DefineVariable<Scalar>(name); getVariable<Scalar>(name, v); } else { v = io_.DefineVariable<Scalar>(name, size, start, count); getVariable<Scalar>(name, v, size, start, count); } file_.Put(v, data, adios2::Mode::Sync); } Loading Loading @@ -575,8 +608,9 @@ std::string ADIOS2Writer<CT>::VectorToString(const std::vector<T>& v) { } extern template class ADIOS2Writer<dca::parallel::NoConcurrency>; #ifdef DCA_HAVE_MPI extern template class ADIOS2Writer<dca::parallel::MPIConcurrency>; #endif } // namespace io } // namespace dca Loading