diff --git a/CMakeLists.txt b/CMakeLists.txt index 874ef37fbc5ff05792703b722f2e87bd76922c3a..bbf244496dd5c2b5cba43cd19fc2f001e3e9872f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -38,6 +38,11 @@ endif() # Top level options #------------------------------------------------------------------------------# +# Default to a debug build if not specified +if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Choose the type of build." FORCE) +endif() + # Force C++11 set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED True) @@ -61,6 +66,10 @@ if(ADIOS_ENABLE_PIC) endif() option(ADIOS_USE_MPI "Enable the MPI version of ADIOS" ON) +if(ADIOS_USE_MPI) + # Workaround for OpenMPI forcing th elink of C++ bindings + add_definitions(-DOMPI_SKIP_MPICXX) +endif() option(ADIOS_USE_BZip2 "Enable support for BZip2 transforms" ON) option(ADIOS_USE_ADIOS1 "Enable support for the ADIOS 1 engine" OFF) option(ADIOS_USE_DataMan "Enable support for the DataMan engine" OFF) @@ -68,8 +77,9 @@ option(ADIOS_USE_DataMan "Enable support for the DataMan engine" OFF) #------------------------------------------------------------------------------# # Third party libraries #------------------------------------------------------------------------------# -option(ADIOS_BUILD_TESTING "Build ADIOS tests" OFF) -set(BUILD_TESTING ${ADIOS_BUILD_TESTING} CACHE INTERNAL "") +option(ADIOS_BUILD_TESTING "Build ADIOS tests" ON) +set(BUILD_TESTING ${ADIOS_BUILD_TESTING}) +mark_as_advanced(BUILD_TESTING) include(CTest) add_subdirectory(thirdparty) @@ -113,10 +123,11 @@ message("") message(" Installation prefix: ${CMAKE_INSTALL_PREFIX}") message(" Features:") if(BUILD_SHARED_LIBS) - message(" Type: shared") + message(" Library Type: shared") else() - message(" Type: static") + message(" Library Type: static") endif() +message(" Build Type: ${CMAKE_BUILD_TYPE}") message(" Testing: ${BUILD_TESTING}") message(" MPI: ${ADIOS_USE_MPI}") message(" BZip2: ${ADIOS_USE_BZip2}") diff --git a/examples/heatTransfer/IO_adios2.cpp b/examples/heatTransfer/IO_adios2.cpp index 49e9c58602b8dd5bcf05d4c2502746af42b14e54..5cfb9ae8807c611cc8c81836b012cddef763acd2 100644 --- a/examples/heatTransfer/IO_adios2.cpp +++ b/examples/heatTransfer/IO_adios2.cpp @@ -28,7 +28,7 @@ IO::IO(const Settings &s, MPI_Comm comm) // 1. Get method def from config file or define new one adios::Method &bpWriterSettings = ad->DeclareMethod("output"); - if (!bpWriterSettings.isUserDefined()) + if (!bpWriterSettings.IsUserDefined()) { // if not defined by user, we can change the default settings bpWriterSettings.SetEngine("BP"); // BP is the default engine @@ -37,8 +37,8 @@ IO::IO(const Settings &s, MPI_Comm comm) bpWriterSettings.AddTransport( "File", "lucky=yes"); // ISO-POSIX file is the default transport // Passing parameters to the transport - bpWriterSettings.SetParameters("have_metadata_file", - "yes"); // Passing parameters to the engine + bpWriterSettings.SetParameters( + "have_metadata_file=yes"); // Passing parameters to the engine bpWriterSettings.SetParameters( "Aggregation", std::to_string((s.nproc + 1) / 2)); // number of aggregators @@ -56,8 +56,7 @@ IO::IO(const Settings &s, MPI_Comm comm) // varT.AddTransform( tr, "" ); // varT.AddTransform( tr,"accuracy=0.001" ); // for ZFP - bpWriter = ad->Open(m_outputfilename, "w", comm, bpWriterSettings, - adios::IOMode::COLLECTIVE); + bpWriter = ad->Open(m_outputfilename, "w", comm, bpWriterSettings); if (bpWriter == nullptr) throw std::ios_base::failure("ERROR: failed to open ADIOS bpWriter\n"); diff --git a/examples/hello/bpWriter/CMakeLists.txt b/examples/hello/bpWriter/CMakeLists.txt index 3518b42787191b823fce4f840f9275693867b8f3..67e193342b05fe0c7d99881038a69e5233706fda 100644 --- a/examples/hello/bpWriter/CMakeLists.txt +++ b/examples/hello/bpWriter/CMakeLists.txt @@ -8,7 +8,16 @@ if(ADIOS_USE_MPI) add_executable(hello_bpWriter helloBPWriter.cpp) target_include_directories(hello_bpWriter PRIVATE ${MPI_C_INCLUDE_PATH}) target_link_libraries(hello_bpWriter adios2 ${MPI_C_LIBRARIES}) + + if(ADIOS_BUILD_TESTING) + add_test( NAME Example::hello::bpWriter COMMAND hello_bpWriter) + endif() +else() + add_executable(hello_bpWriter_nompi helloBPWriter_nompi.cpp) + target_link_libraries(hello_bpWriter_nompi adios2) + + if(ADIOS_BUILD_TESTING) + add_test( NAME Example::hello::bpWriter_nompi COMMAND hello_bpWriter_nompi) + endif() endif() -add_executable(hello_bpWriter_nompi helloBPWriter_nompi.cpp) -target_link_libraries(hello_bpWriter_nompi adios2) diff --git a/examples/hello/bpWriter/helloBPWriter.cpp b/examples/hello/bpWriter/helloBPWriter.cpp index 1be2cececb66a16a6c09d2b5b050bc019f53fe05..7281aca901c1522f18b1aa074ea98e50cd006e53 100644 --- a/examples/hello/bpWriter/helloBPWriter.cpp +++ b/examples/hello/bpWriter/helloBPWriter.cpp @@ -11,9 +11,7 @@ #include <iostream> #include <vector> -#define OMPI_SKIP_MPICXX 1 // workaround for OpenMPI forcing C++ bindings #include <mpi.h> -#undef OMPI_SKIP_MPICXX #include "ADIOS_CPP.h" @@ -68,8 +66,7 @@ int main(int argc, char *argv[]) // Create engine smart pointer due to polymorphism, // Open returns a smart pointer to Engine containing the Derived class // Writer - auto bpWriter = adios.Open("myDoubles.bp", "w", bpWriterSettings, - adios::IOMode::COLLECTIVE); + auto bpWriter = adios.Open("myDoubles.bp", "w", bpWriterSettings); if (bpWriter == nullptr) throw std::ios_base::failure("ERROR: couldn't create bpWriter at Open\n"); diff --git a/examples/hello/bpWriter/helloBPWriter_nompi.cpp b/examples/hello/bpWriter/helloBPWriter_nompi.cpp index edb09e086fd8a8d9b20c8b3a04ea51070e5135d8..6c62e53b0aed54f866a7a5040cc2abe131d20765 100644 --- a/examples/hello/bpWriter/helloBPWriter_nompi.cpp +++ b/examples/hello/bpWriter/helloBPWriter_nompi.cpp @@ -8,12 +8,14 @@ * Author: wfg */ +#include <ios> #include <iostream> +#include <stdexcept> #include <vector> #include "ADIOS_CPP.h" -int main(int argc, char *argv[]) +int main(int /*argc*/, char ** /*argv*/) { const bool adiosDebug = true; adios::ADIOS adios(adios::Verbose::WARN, adiosDebug); @@ -25,7 +27,6 @@ int main(int argc, char *argv[]) const std::size_t rows = 3; const std::size_t columns = 3; std::vector<float> myMatrix = {1, 2, 3, 4, 5, 6, 7, 8, 9}; - std::vector<float> myMatrix2 = {-1, -2, -3, -4, -5, -6, -7, -8, -9}; try @@ -51,11 +52,12 @@ int main(int argc, char *argv[]) // Create engine smart pointer due to polymorphism, // Open returns a smart pointer to Engine containing the Derived class // Writer - auto bpFileWriter = adios.Open("myDoubles_nompi.bp", "w", bpWriterSettings, - adios::IOMode::COLLECTIVE); + auto bpFileWriter = adios.Open("myDoubles_nompi.bp", "w", bpWriterSettings); if (bpFileWriter == nullptr) + { throw std::ios_base::failure("ERROR: couldn't create bpWriter at Open\n"); + } bpFileWriter->Write<double>( ioMyDoubles, myDoubles.data()); // Base class Engine own the Write<T> diff --git a/examples/hello/datamanReader/CMakeLists.txt b/examples/hello/datamanReader/CMakeLists.txt index f32a2283869203b1157cdb67dc540fe19b7ef90d..3aa3e264ad829cf697e9cd91a6336d6fcf8b668d 100644 --- a/examples/hello/datamanReader/CMakeLists.txt +++ b/examples/hello/datamanReader/CMakeLists.txt @@ -3,8 +3,26 @@ # accompanying file Copyright.txt for details. #------------------------------------------------------------------------------# -add_executable(hello_datamanReader helloDataManReader.cpp) -target_link_libraries(hello_datamanReader adios2) +if(ADIOS_USE_MPI) + find_package(MPI COMPONENTS C REQUIRED) -add_executable(hello_datamanReader_nompi helloDataManReader_nompi.cpp) -target_link_libraries(hello_datamanReader_nompi adios2) + add_executable(hello_datamanReader helloDataManReader.cpp) + target_link_libraries(hello_datamanReader adios2) + target_include_directories(hello_datamanReader PRIVATE ${MPI_C_INCLUDE_PATH}) + target_link_libraries(hello_datamanReader adios2 ${MPI_C_LIBRARIES}) + + if(ADIOS_BUILD_TESTING) + add_test(NAME Example::hello::datamanReader COMMAND hello_datamanReader) + endif() +else() + add_executable(hello_datamanReader_nompi helloDataManReader_nompi.cpp) + target_link_libraries(hello_datamanReader_nompi adios2) + + if(ADIOS_BUILD_TESTING) + add_test( + NAME Example::hello::datamanReader_nompi + COMMAND hello_datamanReader_nompi + ) + endif() +endif() + diff --git a/examples/hello/datamanWriter/CMakeLists.txt b/examples/hello/datamanWriter/CMakeLists.txt index dee5f38e1823c4a55f22d53954d09c440e1c6ff4..7defd6c40b3bd2eba1802a4e6e99dd41f5de1697 100644 --- a/examples/hello/datamanWriter/CMakeLists.txt +++ b/examples/hello/datamanWriter/CMakeLists.txt @@ -3,8 +3,26 @@ # accompanying file Copyright.txt for details. #------------------------------------------------------------------------------# -add_executable(hello_datamanWriter helloDataManWriter.cpp) -target_link_libraries(hello_datamanWriter adios2) +if(ADIOS_USE_MPI) + find_package(MPI COMPONENTS C REQUIRED) + + add_executable(hello_datamanWriter helloDataManWriter.cpp) + target_link_libraries(hello_datamanWriter adios2) + target_include_directories(hello_datamanWriter PRIVATE ${MPI_C_INCLUDE_PATH}) + target_link_libraries(hello_datamanWriter adios2 ${MPI_C_LIBRARIES}) + + if(ADIOS_BUILD_TESTING) + add_test(NAME Example::hello::datamanWriter COMMAND hello_datamanWriter) + endif() +else() + add_executable(hello_datamanWriter_nompi helloDataManWriter_nompi.cpp) + target_link_libraries(hello_datamanWriter_nompi adios2) + + if(ADIOS_BUILD_TESTING) + add_test( + NAME Example::hello::datamanWriter_nompi + COMMAND hello_datamanWriter_nompi + ) + endif() +endif() -add_executable(hello_datamanWriter_nompi helloDataManWriter_nompi.cpp) -target_link_libraries(hello_datamanWriter_nompi adios2) diff --git a/examples/hello/timeBP/CMakeLists.txt b/examples/hello/timeBP/CMakeLists.txt index a0e38282532c2bf6cd2c2c726a809e2dd2ea2cac..d86828c90625a3a4e34952730fcd6ed9631c2949 100644 --- a/examples/hello/timeBP/CMakeLists.txt +++ b/examples/hello/timeBP/CMakeLists.txt @@ -9,8 +9,18 @@ if(ADIOS_USE_MPI) target_link_libraries(hello_timeBPWriter adios2) target_include_directories(hello_timeBPWriter PRIVATE ${MPI_C_INCLUDE_PATH}) target_link_libraries(hello_timeBPWriter adios2 ${MPI_C_LIBRARIES}) -endif() + if(ADIOS_BUILD_TESTING) + add_test(NAME Example::hello::timeBPWriter COMMAND hello_timeBPWriter) + endif() +else() + add_executable(hello_timeBPWriter_nompi timeBPWriter_nompi.cpp) + target_link_libraries(hello_timeBPWriter_nompi adios2) -add_executable(hello_timeBPWriter_nompi timeBPWriter_nompi.cpp) -target_link_libraries(hello_timeBPWriter_nompi adios2) + if(ADIOS_BUILD_TESTING) + add_test( + NAME Example::hello::timeBPWriter_nompi + COMMAND hello_timeBPWriter_nompi + ) + endif() +endif() diff --git a/examples/hello/timeBP/timeBPWriter.cpp b/examples/hello/timeBP/timeBPWriter.cpp index 846151357b20798aa26070aa8e6044267558bb30..280e97e1e7eb08761a1b7ce5f0eba11bb4ed66e6 100644 --- a/examples/hello/timeBP/timeBPWriter.cpp +++ b/examples/hello/timeBP/timeBPWriter.cpp @@ -11,9 +11,7 @@ #include <iostream> #include <vector> -#define OMPI_SKIP_MPICXX 1 // workaround for OpenMPI forcing C++ bindings #include <mpi.h> -#undef OMPI_SKIP_MPICXX #include "ADIOS_CPP.h" diff --git a/examples/hello/timeBP/timeBPWriter_nompi.cpp b/examples/hello/timeBP/timeBPWriter_nompi.cpp index dc4135216764e46c753656f5cac4a3f4a1fdc4d9..48fdd2bbf3111f3c36b550c927d03b475893bf4e 100644 --- a/examples/hello/timeBP/timeBPWriter_nompi.cpp +++ b/examples/hello/timeBP/timeBPWriter_nompi.cpp @@ -13,7 +13,7 @@ #include "ADIOS_CPP.h" -int main(int argc, char *argv[]) +int main(int /*argc*/, char ** /*argv*/) { const bool adiosDebug = true; adios::ADIOS adios(adios::Verbose::ERROR, adiosDebug); diff --git a/include/ADIOS.h b/include/ADIOS.h index 85bd4825950c9fceb4865a906c5bdd4cea3d48a5..e0a42c05aa45d8d21add357ae69d5c5aace3e38f 100644 --- a/include/ADIOS.h +++ b/include/ADIOS.h @@ -60,11 +60,11 @@ public: /** * @brief Serial constructor for config file, only allowed and compiled in * libadios_nompi.a - * @param config XML config file + * @param config XML config file name * @param debugMode true: on throws exceptions and do additional checks, * false: off (faster, but unsafe) */ - ADIOS(std::string config, const Verbose verbose = Verbose::WARN, + ADIOS(const std::string config, const Verbose verbose = Verbose::WARN, const bool debugMode = false); /** @@ -74,7 +74,7 @@ public: * @param debugMode true: on, false: off (faster, but unsafe) */ - ADIOS(std::string config, MPI_Comm mpiComm, + ADIOS(const std::string config, MPI_Comm mpiComm, const Verbose verbose = Verbose::WARN, const bool debugMode = false); /** @@ -98,7 +98,7 @@ public: * @return */ template <class T> - inline Variable<T> &DefineVariable(const std::string &name, + inline Variable<T> &DefineVariable(const std::string name, const Dims dimensions = Dims{1}, const Dims globalDimensions = Dims(), const Dims globalOffsets = Dims()) @@ -107,14 +107,14 @@ public: name + " in call to DefineVariable\n"); } - template <class T> inline Variable<T> &GetVariable(const std::string &name) + template <class T> inline Variable<T> &GetVariable(const std::string name) { throw std::invalid_argument("ERROR: type not supported for variable " + name + " in call to GetVariable\n"); } template <class T> - VariableCompound &DefineVariableCompound(const std::string &name, + VariableCompound &DefineVariableCompound(const std::string name, const Dims dimensions = Dims{1}, const Dims globalDimensions = Dims(), const Dims globalOffsets = Dims()) @@ -128,7 +128,7 @@ public: return m_Compound.at(size); } - VariableCompound &GetVariableCompound(const std::string &name); + VariableCompound &GetVariableCompound(const std::string name); /** * Declares a new method. If the method is defined in the user config file, @@ -139,7 +139,7 @@ public: * Use method.isUserDefined() to distinguish between the two cases. * @param methodName must be unique */ - Method &DeclareMethod(const std::string &methodName); + Method &DeclareMethod(const std::string methodName); /** * @brief Open to Write, Read. Creates a new engine from previously defined @@ -157,11 +157,9 @@ public: * @return Derived class of base Engine depending on Method parameters, * shared_ptr for potential flexibility */ - std::shared_ptr<Engine> Open(const std::string &streamName, - const std::string &accessMode, MPI_Comm mpiComm, - const Method &method, - const IOMode iomode = IOMode::INDEPENDENT, - const float timeout_sec = 0.0); + std::shared_ptr<Engine> Open(const std::string streamName, + const std::string accessMode, MPI_Comm mpiComm, + const Method &method); /** * @brief Open to Write, Read. Creates a new engine from previously defined @@ -178,11 +176,9 @@ public: * @return Derived class of base Engine depending on Method parameters, * shared_ptr for potential flexibility */ - std::shared_ptr<Engine> Open(const std::string &streamName, - const std::string &accessMode, - const Method &method, - const IOMode iomode = IOMode::INDEPENDENT, - const float timeout_sec = 0.0); + std::shared_ptr<Engine> Open(std::string streamName, + const std::string accessMode, + const Method &method); /** * Version required by the XML config file implementation, searches method @@ -198,11 +194,9 @@ public: * @return Derived class of base Engine depending on Method parameters, * shared_ptr for potential flexibility */ - std::shared_ptr<Engine> Open(const std::string &streamName, - const std::string &accessMode, MPI_Comm mpiComm, - const std::string &methodName, - const IOMode iomode = IOMode::INDEPENDENT, - const float timeout_sec = 0.0); + std::shared_ptr<Engine> Open(const std::string streamName, + const std::string accessMode, MPI_Comm mpiComm, + const std::string methodName); /** * Version required by the XML config file implementation, searches method @@ -218,11 +212,9 @@ public: * @return Derived class of base Engine depending on Method parameters, * shared_ptr for potential flexibility */ - std::shared_ptr<Engine> Open(const std::string &streamName, - const std::string &accessMode, - const std::string &methodName, - const IOMode iomode = IOMode::INDEPENDENT, - const float timeout_sec = 0.0); + std::shared_ptr<Engine> Open(const std::string streamName, + const std::string accessMode, + const std::string methodName); /** * @brief Open to Read all steps from a file. No streaming, advancing is @@ -238,10 +230,9 @@ public: * @return Derived class of base Engine depending on Method parameters, * shared_ptr for potential flexibility */ - std::shared_ptr<Engine> - OpenFileReader(const std::string &fileName, MPI_Comm mpiComm, - const Method &method, - const IOMode iomode = IOMode::INDEPENDENT); + std::shared_ptr<Engine> OpenFileReader(const std::string fileName, + MPI_Comm mpiComm, + const Method &method); /** * @brief Open to Read all steps from a file. No streaming, advancing is @@ -258,10 +249,9 @@ public: * @return Derived class of base Engine depending on Method parameters, * shared_ptr for potential flexibility */ - std::shared_ptr<Engine> - OpenFileReader(const std::string &fileName, MPI_Comm mpiComm, - const std::string &methodName, - const IOMode iomode = IOMode::INDEPENDENT); + std::shared_ptr<Engine> OpenFileReader(const std::string fileName, + MPI_Comm mpiComm, + const std::string methodName); /** * @brief Dumps groups information to a file stream or standard output. @@ -322,8 +312,7 @@ protected: // no const to allow default empty and copy constructors * @param groupName unique name, passed for thrown exception only * @param hint adds information to thrown exception */ - void CheckVariableInput(const std::string &name, - const Dims &dimensions) const; + void CheckVariableInput(const std::string name, const Dims &dimensions) const; /** * Checks for variable name, if not found throws an invalid exception @@ -334,7 +323,7 @@ protected: // no const to allow default empty and copy constructors void CheckVariableName( std::map<std::string, std::pair<std::string, unsigned int>>::const_iterator itVariable, - const std::string &name, const std::string &hint) const; + const std::string name, const std::string hint) const; /** * @brief Checks for method existence in m_Methods, if failed throws @@ -344,10 +333,9 @@ protected: // no const to allow default empty and copy constructors * @param hint adds information to thrown exception */ void CheckMethod(std::map<std::string, Method>::const_iterator itMethod, - const std::string &methodName, - const std::string &hint) const; + const std::string methodName, const std::string hint) const; - template <class T> unsigned int GetVariableIndex(const std::string &name) + template <class T> unsigned int GetVariableIndex(const std::string name) { auto itVariable = m_Variables.find(name); CheckVariableName( @@ -361,7 +349,7 @@ protected: // no const to allow default empty and copy constructors // template specializations of DefineVariable: template <> inline Variable<char> & -ADIOS::DefineVariable(const std::string &name, const Dims dimensions, +ADIOS::DefineVariable(const std::string name, const Dims dimensions, const Dims globalDimensions, const Dims globalOffsets) { CheckVariableInput(name, dimensions); @@ -374,7 +362,7 @@ ADIOS::DefineVariable(const std::string &name, const Dims dimensions, template <> inline Variable<unsigned char> & -ADIOS::DefineVariable(const std::string &name, const Dims dimensions, +ADIOS::DefineVariable(const std::string name, const Dims dimensions, const Dims globalDimensions, const Dims globalOffsets) { CheckVariableInput(name, dimensions); @@ -388,7 +376,7 @@ ADIOS::DefineVariable(const std::string &name, const Dims dimensions, template <> inline Variable<short> & -ADIOS::DefineVariable(const std::string &name, const Dims dimensions, +ADIOS::DefineVariable(const std::string name, const Dims dimensions, const Dims globalDimensions, const Dims globalOffsets) { CheckVariableInput(name, dimensions); @@ -401,7 +389,7 @@ ADIOS::DefineVariable(const std::string &name, const Dims dimensions, template <> inline Variable<unsigned short> & -ADIOS::DefineVariable(const std::string &name, const Dims dimensions, +ADIOS::DefineVariable(const std::string name, const Dims dimensions, const Dims globalDimensions, const Dims globalOffsets) { CheckVariableInput(name, dimensions); @@ -415,7 +403,7 @@ ADIOS::DefineVariable(const std::string &name, const Dims dimensions, template <> inline Variable<int> & -ADIOS::DefineVariable(const std::string &name, const Dims dimensions, +ADIOS::DefineVariable(const std::string name, const Dims dimensions, const Dims globalDimensions, const Dims globalOffsets) { CheckVariableInput(name, dimensions); @@ -428,7 +416,7 @@ ADIOS::DefineVariable(const std::string &name, const Dims dimensions, template <> inline Variable<unsigned int> & -ADIOS::DefineVariable(const std::string &name, const Dims dimensions, +ADIOS::DefineVariable(const std::string name, const Dims dimensions, const Dims globalDimensions, const Dims globalOffsets) { CheckVariableInput(name, dimensions); @@ -442,7 +430,7 @@ ADIOS::DefineVariable(const std::string &name, const Dims dimensions, template <> inline Variable<long int> & -ADIOS::DefineVariable(const std::string &name, const Dims dimensions, +ADIOS::DefineVariable(const std::string name, const Dims dimensions, const Dims globalDimensions, const Dims globalOffsets) { CheckVariableInput(name, dimensions); @@ -455,7 +443,7 @@ ADIOS::DefineVariable(const std::string &name, const Dims dimensions, template <> inline Variable<unsigned long int> & -ADIOS::DefineVariable(const std::string &name, const Dims dimensions, +ADIOS::DefineVariable(const std::string name, const Dims dimensions, const Dims globalDimensions, const Dims globalOffsets) { CheckVariableInput(name, dimensions); @@ -469,7 +457,7 @@ ADIOS::DefineVariable(const std::string &name, const Dims dimensions, template <> inline Variable<long long int> & -ADIOS::DefineVariable(const std::string &name, const Dims dimensions, +ADIOS::DefineVariable(const std::string name, const Dims dimensions, const Dims globalDimensions, const Dims globalOffsets) { CheckVariableInput(name, dimensions); @@ -483,7 +471,7 @@ ADIOS::DefineVariable(const std::string &name, const Dims dimensions, template <> inline Variable<unsigned long long int> & -ADIOS::DefineVariable(const std::string &name, const Dims dimensions, +ADIOS::DefineVariable(const std::string name, const Dims dimensions, const Dims globalDimensions, const Dims globalOffsets) { CheckVariableInput(name, dimensions); @@ -498,7 +486,7 @@ ADIOS::DefineVariable(const std::string &name, const Dims dimensions, template <> inline Variable<float> & -ADIOS::DefineVariable(const std::string &name, const Dims dimensions, +ADIOS::DefineVariable(const std::string name, const Dims dimensions, const Dims globalDimensions, const Dims globalOffsets) { CheckVariableInput(name, dimensions); @@ -511,7 +499,7 @@ ADIOS::DefineVariable(const std::string &name, const Dims dimensions, template <> inline Variable<double> & -ADIOS::DefineVariable(const std::string &name, const Dims dimensions, +ADIOS::DefineVariable(const std::string name, const Dims dimensions, const Dims globalDimensions, const Dims globalOffsets) { CheckVariableInput(name, dimensions); @@ -524,7 +512,7 @@ ADIOS::DefineVariable(const std::string &name, const Dims dimensions, template <> inline Variable<long double> & -ADIOS::DefineVariable(const std::string &name, const Dims dimensions, +ADIOS::DefineVariable(const std::string name, const Dims dimensions, const Dims globalDimensions, const Dims globalOffsets) { CheckVariableInput(name, dimensions); @@ -538,7 +526,7 @@ ADIOS::DefineVariable(const std::string &name, const Dims dimensions, template <> inline Variable<std::complex<float>> & -ADIOS::DefineVariable(const std::string &name, const Dims dimensions, +ADIOS::DefineVariable(const std::string name, const Dims dimensions, const Dims globalDimensions, const Dims globalOffsets) { CheckVariableInput(name, dimensions); @@ -546,6 +534,7 @@ ADIOS::DefineVariable(const std::string &name, const Dims dimensions, m_CFloat.emplace( size, Variable<std::complex<float>>(name, dimensions, globalDimensions, globalOffsets, m_DebugMode)); + m_Variables.emplace(name, std::make_pair(GetType<std::complex<float>>(), size)); return m_CFloat.at(size); @@ -553,7 +542,7 @@ ADIOS::DefineVariable(const std::string &name, const Dims dimensions, template <> inline Variable<std::complex<double>> & -ADIOS::DefineVariable(const std::string &name, const Dims dimensions, +ADIOS::DefineVariable(const std::string name, const Dims dimensions, const Dims globalDimensions, const Dims globalOffsets) { CheckVariableInput(name, dimensions); @@ -568,7 +557,7 @@ ADIOS::DefineVariable(const std::string &name, const Dims dimensions, template <> inline Variable<std::complex<long double>> & -ADIOS::DefineVariable(const std::string &name, const Dims dimensions, +ADIOS::DefineVariable(const std::string name, const Dims dimensions, const Dims globalDimensions, const Dims globalOffsets) { CheckVariableInput(name, dimensions); @@ -582,97 +571,96 @@ ADIOS::DefineVariable(const std::string &name, const Dims dimensions, } // Get template specialization -template <> inline Variable<char> &ADIOS::GetVariable(const std::string &name) +template <> inline Variable<char> &ADIOS::GetVariable(const std::string name) { return m_Char.at(GetVariableIndex<char>(name)); } template <> -inline Variable<unsigned char> &ADIOS::GetVariable(const std::string &name) +inline Variable<unsigned char> &ADIOS::GetVariable(const std::string name) { return m_UChar.at(GetVariableIndex<unsigned char>(name)); } -template <> inline Variable<short> &ADIOS::GetVariable(const std::string &name) +template <> inline Variable<short> &ADIOS::GetVariable(const std::string name) { return m_Short.at(GetVariableIndex<short>(name)); } template <> -inline Variable<unsigned short> &ADIOS::GetVariable(const std::string &name) +inline Variable<unsigned short> &ADIOS::GetVariable(const std::string name) { return m_UShort.at(GetVariableIndex<unsigned short>(name)); } -template <> inline Variable<int> &ADIOS::GetVariable(const std::string &name) +template <> inline Variable<int> &ADIOS::GetVariable(const std::string name) { return m_Int.at(GetVariableIndex<int>(name)); } template <> -inline Variable<unsigned int> &ADIOS::GetVariable(const std::string &name) +inline Variable<unsigned int> &ADIOS::GetVariable(const std::string name) { return m_UInt.at(GetVariableIndex<unsigned int>(name)); } template <> -inline Variable<long int> &ADIOS::GetVariable(const std::string &name) +inline Variable<long int> &ADIOS::GetVariable(const std::string name) { return m_LInt.at(GetVariableIndex<unsigned int>(name)); } template <> -inline Variable<unsigned long int> &ADIOS::GetVariable(const std::string &name) +inline Variable<unsigned long int> &ADIOS::GetVariable(const std::string name) { return m_ULInt.at(GetVariableIndex<unsigned long int>(name)); } template <> -inline Variable<long long int> &ADIOS::GetVariable(const std::string &name) +inline Variable<long long int> &ADIOS::GetVariable(const std::string name) { return m_LLInt.at(GetVariableIndex<long long int>(name)); } template <> inline Variable<unsigned long long int> & -ADIOS::GetVariable(const std::string &name) +ADIOS::GetVariable(const std::string name) { return m_ULLInt.at(GetVariableIndex<unsigned long long int>(name)); } -template <> inline Variable<float> &ADIOS::GetVariable(const std::string &name) +template <> inline Variable<float> &ADIOS::GetVariable(const std::string name) { return m_Float.at(GetVariableIndex<float>(name)); } -template <> inline Variable<double> &ADIOS::GetVariable(const std::string &name) +template <> inline Variable<double> &ADIOS::GetVariable(const std::string name) { return m_Double.at(GetVariableIndex<double>(name)); } template <> -inline Variable<long double> &ADIOS::GetVariable(const std::string &name) +inline Variable<long double> &ADIOS::GetVariable(const std::string name) { return m_LDouble.at(GetVariableIndex<long double>(name)); } template <> -inline Variable<std::complex<float>> & -ADIOS::GetVariable(const std::string &name) +inline Variable<std::complex<float>> &ADIOS::GetVariable(const std::string name) { return m_CFloat.at(GetVariableIndex<std::complex<float>>(name)); } template <> inline Variable<std::complex<double>> & -ADIOS::GetVariable(const std::string &name) +ADIOS::GetVariable(const std::string name) { return m_CDouble.at(GetVariableIndex<std::complex<double>>(name)); } template <> inline Variable<std::complex<long double>> & -ADIOS::GetVariable(const std::string &name) +ADIOS::GetVariable(const std::string name) { return m_CLDouble.at(GetVariableIndex<std::complex<long double>>(name)); } diff --git a/include/capsule/heap/STLVector.h b/include/capsule/heap/STLVector.h index b548a64d640a3072d55b9d923174df62fc845eb7..7e83a09d9a5ee4b7ff9177895746fca683f97719 100644 --- a/include/capsule/heap/STLVector.h +++ b/include/capsule/heap/STLVector.h @@ -40,7 +40,8 @@ public: * @param rankMPI MPI rank * @param debugMode true: extra checks, slower */ - STLVector(std::string accessMode, int rankMPI, bool debugMode = false); + STLVector(const std::string accessMode, const int rankMPI, + const bool debugMode = false); ~STLVector() = default; diff --git a/include/core/Capsule.h b/include/core/Capsule.h index 815c8542363f614be1c61e4023b7a9d8ffa779af..715cdc1cbc9279b6188d77d074d46d9614de49d3 100644 --- a/include/core/Capsule.h +++ b/include/core/Capsule.h @@ -30,12 +30,11 @@ public: const std::string m_Type; ///< buffer type const std::string m_AccessMode; ///< 'w': write, 'r': read, 'a': append - size_t m_DataPosition = 0; ///< position in current data buffer (not - /// included data flushed to transports) - size_t m_DataAbsolutePosition = - 0; ///< includes the data flushed to transports + std::size_t m_DataPosition = 0; ///< position in current data buffer (not + /// included data flushed to transports) + std::size_t m_DataAbsolutePosition = 0; ///< include bytes flushed - size_t m_MetadataPosition = 0; ///< position in metadata buffer + std::size_t m_MetadataPosition = 0; ///< position in metadata buffer /** * Base class constructor providing type from derived class and accessMode @@ -44,8 +43,8 @@ public: * @param rankMPI current MPI rank * @param debugMode */ - Capsule(std::string type, std::string accessMode, int rankMPI, - bool debugMode); + Capsule(const std::string type, const std::string accessMode, + const int rankMPI, const bool debugMode); virtual ~Capsule() = default; @@ -53,12 +52,11 @@ public: virtual char * GetMetadata() = 0; ///< return the pointer to the raw metadata buffer - virtual size_t GetDataSize() const = 0; ///< get current data buffer size - virtual size_t - GetMetadataSize() const = 0; ///< get current metadata buffer size + virtual std::size_t GetDataSize() const = 0; ///< data buffer size + virtual std::size_t GetMetadataSize() const = 0; ///< metadata buffer size - virtual void ResizeData(size_t size); ///< resize data buffer - virtual void ResizeMetadata(size_t size); ///< resize metadata buffer + virtual void ResizeData(std::size_t size); ///< resize data buffer + virtual void ResizeMetadata(std::size_t size); ///< resize metadata buffer protected: const int m_RankMPI = 0; ///< current MPI rank diff --git a/include/core/Engine.h b/include/core/Engine.h index eb943b0707acd31adf47120b3ca6a126480198ae..f6c714aebab39ef520693f1c24f8b2bc7202b3fe 100644 --- a/include/core/Engine.h +++ b/include/core/Engine.h @@ -75,7 +75,7 @@ public: */ Engine(ADIOS &adios, const std::string engineType, const std::string name, const std::string accessMode, MPI_Comm mpiComm, const Method &method, - std::string endMessage); + const std::string endMessage); virtual ~Engine() = default; diff --git a/include/core/Method.h b/include/core/Method.h index 37eae8f741836215e8970854e010d5c7cbfa3067..96f2862bb7e7a6df35542a902d06fdb6d0390f98 100644 --- a/include/core/Method.h +++ b/include/core/Method.h @@ -44,10 +44,12 @@ class Method public: const std::string m_Name; ///< Method name (as defined in XML) const bool m_DebugMode = false; ///< true: on, throws exceptions and do - /// additional checks, false: off, faster, but + /// additional checks, false: off, faster /// unsafe std::string m_Type; ///< Method's engine type - unsigned int m_nThreads; + unsigned int m_nThreads = 1; + adios::IOMode m_IOMode = adios::IOMode::INDEPENDENT; + std::map<std::string, std::string> m_Parameters; ///< method parameters std::vector<std::map<std::string, std::string>> m_TransportParameters; ///< each is a separate Transport containing their @@ -60,13 +62,13 @@ public: */ Method(const std::string name, const bool debugMode = false); - ~Method(); + ~Method() = default; /** Check if the method was defined by the user in the config file. * @return true if the method was user-defined, false otherwise when method is * set with default parameters */ - bool isUserDefined(); + bool IsUserDefined(); /** * Define the engine type @@ -135,6 +137,6 @@ private: const std::vector<std::string> ¶meters); }; -} // end namespace +} // end namespace adios #endif /* METHOD_H_ */ diff --git a/include/core/Support.h b/include/core/Support.h index 481f8fb4185ec57f73c60369a1fc8a019152d1af..bb9b451e842f07afbe38d9d3b36da864594e0c65 100644 --- a/include/core/Support.h +++ b/include/core/Support.h @@ -51,6 +51,6 @@ struct Support }; }; -} // end namespace +} // end namespace adios #endif /* SUPPORT_H_ */ diff --git a/include/core/Transform.h b/include/core/Transform.h index 190541dac62c8c84f93abf05eb20d9a6e65194fd..a6a6dc75ab80f232f8f08e724837d6b83655b7e2 100644 --- a/include/core/Transform.h +++ b/include/core/Transform.h @@ -33,9 +33,9 @@ public: * Initialize parent method * @param method zlib, bzip2, szip */ - Transform(const std::string method); + Transform(std::string method); - virtual ~Transform(); + virtual ~Transform() = default; virtual void Compress(const std::vector<char> &bufferIn, std::vector<char> &bufferOut); @@ -44,5 +44,5 @@ public: std::vector<char> &bufferOut); }; -} // end namespace +} // end namespace adios #endif /* TRANSFORM_H_ */ diff --git a/include/core/Transport.h b/include/core/Transport.h index cc803a6da687cc32801bbe1a9db02323d00cef00..12bbb6ae22aa5156c9ec6f4a1e17f3afd1a57d40 100644 --- a/include/core/Transport.h +++ b/include/core/Transport.h @@ -14,11 +14,12 @@ /// \cond EXCLUDE_FROM_DOXYGEN #include <string> #include <vector> + +#include "../utilities/profiling/iochrono/IOChrono.h" /// \endcond #include "ADIOS_MPI.h" -#include "packages/profiling/iochrono/IOChrono.h" namespace adios { @@ -44,9 +45,9 @@ public: * @param mpiComm passed to m_MPIComm * @param debugMode passed to m_DebugMode */ - Transport(const std::string type, MPI_Comm mpiComm, const bool debugMode); + Transport(std::string type, MPI_Comm mpiComm, bool debugMode); - virtual ~Transport(); ///< empty destructor, using STL for memory management + virtual ~Transport() = default; /** * Open Output file accesing a mode @@ -87,6 +88,6 @@ protected: const bool m_DebugMode = false; ///< if true: additional checks and exceptions }; -} // end namespace +} // end namespace adios #endif /* TRANSPORT_H_ */ diff --git a/include/engine/bp/BPFileReader.h b/include/engine/bp/BPFileReader.h index 2b4f756af68c3deb2c373d98a6d9b7e964fd302d..0d975e859c2fa58cd5c0a9197a551ca6168c2dbc 100644 --- a/include/engine/bp/BPFileReader.h +++ b/include/engine/bp/BPFileReader.h @@ -15,7 +15,6 @@ #include "core/Engine.h" -// supported capsules #include "capsule/heap/STLVector.h" namespace adios @@ -39,7 +38,7 @@ public: const std::string accessMode, MPI_Comm mpiComm, const Method &method); - ~BPFileReader(); + virtual ~BPFileReader() = default; Variable<void> *InquireVariable(const std::string name, const bool readIn = true); diff --git a/include/engine/bp/BPFileWriter.h b/include/engine/bp/BPFileWriter.h index 3f04ee7be44e98bdfd5bf98644fb4033b0825759..ca0353cad321d41f37dafffc7ccf95180fa1bcfa 100644 --- a/include/engine/bp/BPFileWriter.h +++ b/include/engine/bp/BPFileWriter.h @@ -11,11 +11,9 @@ #ifndef BPFILEWRITER_H_ #define BPFILEWRITER_H_ -#include "core/Engine.h" -#include "packages/format/bp1/BP1.h" - -// supported capsules #include "capsule/heap/STLVector.h" +#include "core/Engine.h" +#include "utilities/format/bp1/BP1.h" namespace adios { diff --git a/include/engine/dataman/DataManWriter.h b/include/engine/dataman/DataManWriter.h index 8245c00a4cab1816e0f64d21b905c4876fec0c88..5eafb3e7ec4247ada6ff60a94691b838ee3c3f17 100644 --- a/include/engine/dataman/DataManWriter.h +++ b/include/engine/dataman/DataManWriter.h @@ -14,10 +14,8 @@ #include <iostream> //std::cout must be removed, only used for hello example #include <unistd.h> //sleep must be removed +#include "../../utilities/format/bp1/BP1Writer.h" #include "core/Engine.h" -#include "packages/format/bp1/BP1Writer.h" - -// supported capsules #include "capsule/heap/STLVector.h" #include "DataManager.h" //here comes your DataMan header diff --git a/include/mpidummy.h b/include/mpidummy.h index 65b380f5cd4a229e87ddffad8bb24c806bf452a6..86122ede8af34481a719166a9df32f9cddacd835 100644 --- a/include/mpidummy.h +++ b/include/mpidummy.h @@ -73,34 +73,35 @@ int MPI_Comm_size(MPI_Comm comm, int *size); int MPI_Comm_free(MPI_Comm *comm); MPI_Comm MPI_Comm_f2c(MPI_Fint comm); -int MPI_Gather(void *sendbuf, int sendcnt, MPI_Datatype sendtype, void *recvbuf, - int recvcnt, MPI_Datatype recvtype, int root, MPI_Comm comm); -int MPI_Gatherv(void *sendbuf, int sendcnt, MPI_Datatype sendtype, - void *recvbuf, int *recvcnts, int *displs, +int MPI_Gather(const void *sendbuf, int sendcount, MPI_Datatype sendtype, + void *recvbuf, int recvcount, MPI_Datatype recvtype, int root, + MPI_Comm comm); +int MPI_Gatherv(const void *sendbuf, int sendcount, MPI_Datatype sendtype, + void *recvbuf, const int *recvcounts, const int *displs, MPI_Datatype recvtype, int root, MPI_Comm comm); -int MPI_Allgather(void *sendbuf, int sendcount, MPI_Datatype sendtype, +int MPI_Allgather(const void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype, MPI_Comm comm); -int MPI_Scatter(void *sendbuf, int sendcnt, MPI_Datatype sendtype, - void *recvbuf, int recvcnt, MPI_Datatype recvtype, int root, +int MPI_Scatter(const void *sendbuf, int sendcount, MPI_Datatype sendtype, + void *recvbuf, int recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm); -int MPI_Scatterv(void *sendbuf, int *sendcnts, int *displs, - MPI_Datatype sendtype, void *recvbuf, int recvcnt, +int MPI_Scatterv(const void *sendbuf, const int *sendcounts, const int *displs, + MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm); -int MPI_Recv(void *recvbuffer, int count, MPI_Datatype type, int source, - int tag, MPI_Comm comm, MPI_Status *status); -int MPI_Irecv(void *recvbuffer, int count, MPI_Datatype type, int source, - int tag, MPI_Comm comm, MPI_Request *request); -int MPI_Send(void *sendbuffer, int count, MPI_Datatype type, int destination, +int MPI_Recv(void *buf, int count, MPI_Datatype datatype, int source, int tag, + MPI_Comm comm, MPI_Status *status); +int MPI_Irecv(void *buf, int count, MPI_Datatype datatype, int source, int tag, + MPI_Comm comm, MPI_Request *request); +int MPI_Send(const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm); -int MPI_Isend(void *recvbuffer, int count, MPI_Datatype type, int source, +int MPI_Isend(const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request *request); int MPI_Wait(MPI_Request *request, MPI_Status *status); -int MPI_File_open(MPI_Comm comm, char *filename, int amode, MPI_Info info, +int MPI_File_open(MPI_Comm comm, const char *filename, int amode, MPI_Info info, MPI_File *fh); int MPI_File_close(MPI_File *fh); int MPI_File_get_size(MPI_File fh, MPI_Offset *size); @@ -108,7 +109,7 @@ int MPI_File_read(MPI_File fh, void *buf, int count, MPI_Datatype datatype, MPI_Status *status); int MPI_File_seek(MPI_File fh, MPI_Offset offset, int whence); -int MPI_Get_count(MPI_Status *status, MPI_Datatype datatype, int *count); +int MPI_Get_count(const MPI_Status *status, MPI_Datatype datatype, int *count); int MPI_Error_string(int errorcode, char *string, int *resultlen); int MPI_Comm_split(MPI_Comm comm, int color, int key, MPI_Comm *comm_out); diff --git a/include/transport/file/FStream.h b/include/transport/file/FStream.h index 163b96478e23334fcf2fc0ab8afe1b824789d9f2..8553c35981ebdb87048631033f293404f3774f88 100644 --- a/include/transport/file/FStream.h +++ b/include/transport/file/FStream.h @@ -31,7 +31,7 @@ class FStream : public Transport public: FStream(MPI_Comm mpiComm, const bool debugMode); - ~FStream(); + virtual ~FStream() = default; void Open(const std::string name, const std::string accessMode); @@ -48,6 +48,6 @@ private: }; } // end namespace transport -} // end namespace +} // end namespace adios #endif /* FSTREAM_H_ */ diff --git a/include/packages/format/bp1/BP1.h b/include/utilities/format/bp1/BP1.h similarity index 60% rename from include/packages/format/bp1/BP1.h rename to include/utilities/format/bp1/BP1.h index 1e0aebd1ba2dc6692912742d08707598fadbc1e4..d1b394088ed27a85e9d7a9cd2a448a9cbd986146 100644 --- a/include/packages/format/bp1/BP1.h +++ b/include/utilities/format/bp1/BP1.h @@ -11,9 +11,8 @@ #ifndef BP1_H_ #define BP1_H_ -#include "packages/format/bp1/BP1Structs.h" -#include "packages/format/bp1/BP1Writer.h" -// will add Reader later -#include "packages/format/bp1/BP1Aggregator.h" +#include "utilities/format/bp1/BP1Aggregator.h" +#include "utilities/format/bp1/BP1Structs.h" +#include "utilities/format/bp1/BP1Writer.h" #endif /* BP1_H_ */ diff --git a/include/packages/format/bp1/BP1Aggregator.h b/include/utilities/format/bp1/BP1Aggregator.h similarity index 100% rename from include/packages/format/bp1/BP1Aggregator.h rename to include/utilities/format/bp1/BP1Aggregator.h diff --git a/include/packages/format/bp1/BP1Base.h b/include/utilities/format/bp1/BP1Base.h similarity index 100% rename from include/packages/format/bp1/BP1Base.h rename to include/utilities/format/bp1/BP1Base.h diff --git a/include/packages/format/bp1/BP1Structs.h b/include/utilities/format/bp1/BP1Structs.h similarity index 87% rename from include/packages/format/bp1/BP1Structs.h rename to include/utilities/format/bp1/BP1Structs.h index 8c6365933f69cefa5877db519d565b27a9051ec1..10ca50eaee4cc189962c1655780a33c228c1bc3c 100644 --- a/include/packages/format/bp1/BP1Structs.h +++ b/include/utilities/format/bp1/BP1Structs.h @@ -18,7 +18,7 @@ #include <vector> /// \endcond -#include "packages/profiling/iochrono/IOChrono.h" +#include "utilities/profiling/iochrono/IOChrono.h" namespace adios { @@ -54,8 +54,8 @@ struct BP1MetadataSet BP1Index PGIndex = BP1Index(0); ///< single buffer for PGIndex // no priority for now - std::unordered_map<std::string, BP1Index> - VarsIndices; ///< key: variable name, value: bp metadata variable index + /** @brief key: variable name, value: bp metadata variable index */ + std::unordered_map<std::string, BP1Index> VarsIndices; std::unordered_map<std::string, BP1Index> AttributesIndices; ///< key: name, value: attribute bp index @@ -68,9 +68,13 @@ struct BP1MetadataSet /// position, needs to be updated in /// every advance step or init std::uint32_t DataPGVarsCount = 0; ///< variables in current PG + + /** + * current PG variable count ( relative ) position, needs to be + * updated in very Advance + */ std::size_t DataPGVarsCountPosition = 0; - ///< current PG variable count ( relative ) position, needs to be - /// updated in every advance step or init + bool DataPGIsOpen = false; profiling::IOChrono Log; ///< object that takes buffering profiling info diff --git a/include/packages/format/bp1/BP1Writer.h b/include/utilities/format/bp1/BP1Writer.h similarity index 99% rename from include/packages/format/bp1/BP1Writer.h rename to include/utilities/format/bp1/BP1Writer.h index 9295251dbf7372a6c4fbf7794390be8e2f5adcf9..fa4382cf9c19fa0b850a4e72d4ac26f1cd882d4c 100644 --- a/include/packages/format/bp1/BP1Writer.h +++ b/include/utilities/format/bp1/BP1Writer.h @@ -15,14 +15,15 @@ #include <algorithm> //std::count, std::copy, std::for_each #include <cmath> //std::ceil #include <cstring> //std::memcpy + +#include "utilities/format/bp1/BP1Base.h" +#include "utilities/format/bp1/BP1Structs.h" /// \endcond #include "capsule/heap/STLVector.h" #include "core/Variable.h" #include "functions/adiosFunctions.h" #include "functions/adiosTemplates.h" -#include "packages/format/bp1/BP1Base.h" -#include "packages/format/bp1/BP1Structs.h" namespace adios { diff --git a/include/packages/profiling/iochrono/IOChrono.h b/include/utilities/profiling/iochrono/IOChrono.h similarity index 93% rename from include/packages/profiling/iochrono/IOChrono.h rename to include/utilities/profiling/iochrono/IOChrono.h index 442a8df8ca5eaadcfb8c6088c08e731316e62793..fed27a79a6cb3ee0486ebff2cf2169765634e80d 100644 --- a/include/packages/profiling/iochrono/IOChrono.h +++ b/include/utilities/profiling/iochrono/IOChrono.h @@ -15,7 +15,7 @@ #include <vector> /// \endcond -#include "packages/profiling/iochrono/Timer.h" +#include "profiling/iochrono/Timer.h" namespace adios { diff --git a/include/packages/profiling/iochrono/Timer.h b/include/utilities/profiling/iochrono/Timer.h similarity index 100% rename from include/packages/profiling/iochrono/Timer.h rename to include/utilities/profiling/iochrono/Timer.h diff --git a/source/ADIOS.cpp b/source/ADIOS.cpp index efd3e2eac459425b04661ada7f740ee910e1b5ad..5fd0fbf366ae0ae74958ad7ea65c3d78f1dc9e5d 100644 --- a/source/ADIOS.cpp +++ b/source/ADIOS.cpp @@ -10,12 +10,14 @@ /// \cond EXCLUDE_FROM_DOXYGEN #include <fstream> +#include <ios> //std::ios_base::failure #include <iostream> #include <sstream> #include <utility> /// \endcond #include "ADIOS.h" + #include "functions/adiosFunctions.h" // Engines @@ -41,17 +43,17 @@ ADIOS::ADIOS(const Verbose /*verbose*/, const bool debugMode) InitMPI(); } -ADIOS::ADIOS(std::string config, const Verbose /*verbose*/, +ADIOS::ADIOS(const std::string config, const Verbose /*verbose*/, const bool debugMode) -: m_ConfigFile{std::move(config)}, m_DebugMode{debugMode} +: m_ConfigFile{config}, m_DebugMode{debugMode} { InitMPI(); // InitXML( m_ConfigFile, m_MPIComm, m_DebugMode, m_Transforms ); } -ADIOS::ADIOS(std::string config, MPI_Comm mpiComm, const Verbose /*verbose*/, - const bool debugMode) -: m_MPIComm{mpiComm}, m_ConfigFile{std::move(config)}, m_DebugMode{debugMode} +ADIOS::ADIOS(const std::string config, MPI_Comm mpiComm, + const Verbose /*verbose*/, const bool debugMode) +: m_MPIComm{mpiComm}, m_ConfigFile{config}, m_DebugMode{debugMode} { InitMPI(); // InitXML( m_XMLConfigFile, m_MPIComm, m_DebugMode, m_HostLanguage, @@ -82,7 +84,7 @@ void ADIOS::InitMPI() MPI_Comm_size(m_MPIComm, &m_SizeMPI); } -Method &ADIOS::DeclareMethod(const std::string &methodName) +Method &ADIOS::DeclareMethod(const std::string methodName) { if (m_DebugMode == true) { @@ -96,11 +98,9 @@ Method &ADIOS::DeclareMethod(const std::string &methodName) return m_Methods.at(methodName); } -std::shared_ptr<Engine> ADIOS::Open(const std::string &name, - const std::string &accessMode, - MPI_Comm mpiComm, const Method &method, - const IOMode iomode, - const float timeout_sec) +std::shared_ptr<Engine> ADIOS::Open(const std::string name, + const std::string accessMode, + MPI_Comm mpiComm, const Method &method) { if (m_DebugMode == true) { @@ -190,18 +190,17 @@ std::shared_ptr<Engine> ADIOS::Open(const std::string &name, return nullptr; // if debug mode is off } -std::shared_ptr<Engine> ADIOS::Open(const std::string &streamName, - const std::string &accessMode, - const Method &method, const IOMode iomode, - const float timeout_sec) +std::shared_ptr<Engine> ADIOS::Open(const std::string name, + const std::string accessMode, + const Method &method) { - return Open(streamName, accessMode, m_MPIComm, method, iomode, timeout_sec); + return Open(name, accessMode, m_MPIComm, method); } -std::shared_ptr<Engine> -ADIOS::Open(const std::string &name, const std::string &accessMode, - MPI_Comm mpiComm, const std::string &methodName, - const IOMode iomode, const float timeout_sec) +std::shared_ptr<Engine> ADIOS::Open(const std::string name, + const std::string accessMode, + MPI_Comm mpiComm, + const std::string methodName) { auto itMethod = m_Methods.find(methodName); @@ -210,30 +209,26 @@ ADIOS::Open(const std::string &name, const std::string &accessMode, CheckMethod(itMethod, methodName, " in call to Open\n"); } - return Open(name, accessMode, mpiComm, itMethod->second, iomode, timeout_sec); + return Open(name, accessMode, mpiComm, itMethod->second); } -std::shared_ptr<Engine> ADIOS::Open(const std::string &name, - const std::string &accessMode, - const std::string &methodName, - const IOMode iomode, - const float timeout_sec) +std::shared_ptr<Engine> ADIOS::Open(const std::string name, + const std::string accessMode, + const std::string methodName) { - return Open(name, accessMode, m_MPIComm, methodName, iomode, timeout_sec); + return Open(name, accessMode, m_MPIComm, methodName); } -std::shared_ptr<Engine> ADIOS::OpenFileReader(const std::string &name, - MPI_Comm /*mpiComm*/, - const Method &method, - const IOMode iomode) +std::shared_ptr<Engine> ADIOS::OpenFileReader(const std::string name, + MPI_Comm mpiComm, + const Method &method) { - return Open(name, "r", m_MPIComm, method, iomode); + return Open(name, "r", mpiComm, method); } -std::shared_ptr<Engine> ADIOS::OpenFileReader(const std::string &name, - MPI_Comm /*mpiComm*/, - const std::string &methodName, - const IOMode iomode) +std::shared_ptr<Engine> ADIOS::OpenFileReader(const std::string name, + MPI_Comm mpiComm, + const std::string methodName) { auto itMethod = m_Methods.find(methodName); @@ -242,10 +237,10 @@ std::shared_ptr<Engine> ADIOS::OpenFileReader(const std::string &name, CheckMethod(itMethod, methodName, " in call to Open\n"); } - return Open(name, "r", m_MPIComm, itMethod->second, iomode); + return Open(name, "r", m_MPIComm, itMethod->second); } -VariableCompound &ADIOS::GetVariableCompound(const std::string &name) +VariableCompound &ADIOS::GetVariableCompound(const std::string name) { return m_Compound.at(GetVariableIndex<void>(name)); } @@ -327,7 +322,7 @@ void ADIOS::MonitorVariables(std::ostream &logStream) } // PRIVATE FUNCTIONS BELOW -void ADIOS::CheckVariableInput(const std::string &name, +void ADIOS::CheckVariableInput(const std::string name, const Dims &dimensions) const { if (m_DebugMode == true) @@ -351,7 +346,7 @@ void ADIOS::CheckVariableInput(const std::string &name, void ADIOS::CheckVariableName( std::map<std::string, std::pair<std::string, unsigned int>>::const_iterator itVariable, - const std::string &name, const std::string &hint) const + const std::string name, const std::string hint) const { if (m_DebugMode == true) { @@ -364,8 +359,8 @@ void ADIOS::CheckVariableName( } void ADIOS::CheckMethod(std::map<std::string, Method>::const_iterator itMethod, - const std::string &methodName, - const std::string &hint) const + const std::string methodName, + const std::string hint) const { if (itMethod == m_Methods.end()) { diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index 731a1153f54c68bdecd076b3db6a54d5a3e183ff..e6f56432a41ceaec549dc5a37ed582ec1559e907 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -20,11 +20,11 @@ add_library(adios2 engine/bp/BPFileReader.cpp engine/bp/BPFileWriter.cpp - packages/format/bp1/BP1Base.cpp - packages/format/bp1/BP1Aggregator.cpp - packages/format/bp1/BP1Writer.cpp + utilities/format/bp1/BP1Base.cpp + utilities/format/bp1/BP1Aggregator.cpp + utilities/format/bp1/BP1Writer.cpp - packages/profiling/iochrono/Timer.cpp + utilities/profiling/iochrono/Timer.cpp functions/adiosFunctions.cpp diff --git a/source/core/Capsule.cpp b/source/core/Capsule.cpp index 0b268a37065238800c19cdad2336774a2c553774..b30603ab42bc0137b0803d802a01e67b937eb7c0 100644 --- a/source/core/Capsule.cpp +++ b/source/core/Capsule.cpp @@ -15,8 +15,8 @@ namespace adios { -Capsule::Capsule(std::string type, std::string accessMode, int rankMPI, - bool debugMode) +Capsule::Capsule(const std::string type, const std::string accessMode, + int rankMPI, bool debugMode) : m_Type{std::move(type)}, m_AccessMode{std::move(accessMode)}, m_RankMPI{rankMPI}, m_DebugMode{debugMode} { diff --git a/source/core/Engine.cpp b/source/core/Engine.cpp index df35828eb6598bf1a692c52ed8988efdc9a1a0a6..a27a1c2863c71a063e966e8a44951b8d5a4316f5 100644 --- a/source/core/Engine.cpp +++ b/source/core/Engine.cpp @@ -8,6 +8,8 @@ * Author: wfg */ +#include <ios> //std::ios_base::failure + #include "core/Engine.h" #include "core/Support.h" #include "functions/adiosFunctions.h" @@ -17,7 +19,8 @@ namespace adios Engine::Engine(ADIOS &adios, const std::string engineType, const std::string name, const std::string accessMode, - MPI_Comm mpiComm, const Method &method, std::string endMessage) + MPI_Comm mpiComm, const Method &method, + const std::string endMessage) : m_MPIComm{mpiComm}, m_EngineType{std::move(engineType)}, m_Name{std::move(name)}, m_AccessMode{std::move(accessMode)}, m_Method{method}, m_ADIOS(adios), m_EndMessage(std::move(endMessage)), diff --git a/source/core/Method.cpp b/source/core/Method.cpp index ee22d5bdc1471a6bda652a36416d98ec218bd13c..41397d5e5802352b05cf3c9b919fa2d58f98f2ed 100644 --- a/source/core/Method.cpp +++ b/source/core/Method.cpp @@ -8,6 +8,8 @@ * Author: wfg */ +#include <utility> + #include "core/Method.h" #include "functions/adiosFunctions.h" @@ -17,15 +19,11 @@ namespace adios Method::Method(const std::string name, const bool debugMode) : m_Name{name}, m_DebugMode{debugMode} { - // m_Type can stay empty (forcing the choice of the default engine) - m_nThreads = 1; } -Method::~Method() {} - -bool Method::isUserDefined() +bool Method::IsUserDefined() { - return false; // TODO: check if XML has the method defined + return false; // TODO(wfg): check if XML has the method defined } void Method::SetEngine(const std::string type) { m_Type = type; } @@ -33,9 +31,13 @@ void Method::SetEngine(const std::string type) { m_Type = type; } void Method::AllowThreads(const unsigned int nThreads) { if (nThreads > 1) + { m_nThreads = nThreads; + } else + { m_nThreads = 1; + } } // PRIVATE Functions @@ -45,8 +47,10 @@ void Method::AddTransportParameters(const std::string type, if (m_DebugMode == true) { if (type.empty() || type.find("=") != type.npos) + { throw std::invalid_argument("ERROR: first argument in AddTransport must " "be a single word for transport\n"); + } } std::map<std::string, std::string> mapParameters = @@ -54,13 +58,15 @@ void Method::AddTransportParameters(const std::string type, if (m_DebugMode == true) { if (mapParameters.count("transport") == 1) + { std::invalid_argument( "ERROR: transport can't be redefined with \"transport=type\", " "type must be the first argument\n"); + } } mapParameters["transport"] = type; m_TransportParameters.push_back(mapParameters); } -} // end namespace +} // end namespace adios diff --git a/source/core/Support.cpp b/source/core/Support.cpp index 02be66d86108af579eeafd5805adad1e5a1537b4..65cac135af7ca6a6b428ba5fb5c3a15aedbf7324 100644 --- a/source/core/Support.cpp +++ b/source/core/Support.cpp @@ -19,10 +19,9 @@ const std::string Support::Version{"2.00"}; const std::set<std::string> Support::HostLanguages{{"C++", "C", "Fortran"}}; const std::set<std::string> Support::Transports{ - {"NULL", "POSIX", "FStream", - "MdtmMan"} // "MPI", "MPI_LUSTRE", "MPI_AGGREGATE", "DATASPACES", "DIMES", - // "FLEXPATH", "PHDF5", "NC4", "ICEE" } -}; + {"NULL", "POSIX", "FStream", "MdtmMan"}}; +// TODO(chuckatkins): Add transports MPI, MPI_LUSTRE, MPI_AGGREGATE, +// DATASPACES, DIMES, FLEXPATH, PHDF5, NC4, ICEE const std::set<std::string> Support::Transforms{ {"none", "identity", "bzip2", "isobar", "szip", "zlib"}}; @@ -90,4 +89,4 @@ const std::map<std::string, std::set<std::string>> Support::DatatypesAliases{ const std::set<std::string> Support::FileTransports{ {"POSIX", "File", "FStream", "MPIFile"}}; -} // end namespace +} // end namespace adios diff --git a/source/core/Transform.cpp b/source/core/Transform.cpp index 0b719ccc86bcdf858a93c1417f662982817e45c3..7549342b26640480331644a5bdcc0adaded88a55 100644 --- a/source/core/Transform.cpp +++ b/source/core/Transform.cpp @@ -7,24 +7,23 @@ * Created on: Dec 5, 2016 * Author: wfg */ +#include <utility> #include "core/Transform.h" namespace adios { -Transform::Transform(const std::string method) : m_Method(method) {} +Transform::Transform(std::string method) : m_Method(std::move(method)) {} -Transform::~Transform() {} - -void Transform::Compress(const std::vector<char> &bufferIn, - std::vector<char> &bufferOut) +void Transform::Compress(const std::vector<char> & /*bufferIn*/, + std::vector<char> & /*bufferOut*/) { } -void Transform::Decompress(const std::vector<char> &bufferIn, - std::vector<char> &bufferOut) +void Transform::Decompress(const std::vector<char> & /*bufferIn*/, + std::vector<char> & /*bufferOut*/) { } -} // end namespace +} // end namespace adios diff --git a/source/core/Transport.cpp b/source/core/Transport.cpp index 42fcb79ee4331ae0e468aca768284eca63e066ba..a1f12ac44a993c13e449b3acac971a47e79bf20c 100644 --- a/source/core/Transport.cpp +++ b/source/core/Transport.cpp @@ -8,22 +8,21 @@ * Author: wfg */ +#include <utility> + #include "core/Transport.h" namespace adios { -Transport::Transport(const std::string type, MPI_Comm mpiComm, - const bool debugMode) +Transport::Transport(std::string type, MPI_Comm mpiComm, bool debugMode) : m_Type{type}, m_MPIComm{mpiComm}, m_DebugMode{debugMode} { MPI_Comm_rank(m_MPIComm, &m_RankMPI); MPI_Comm_size(m_MPIComm, &m_SizeMPI); } -Transport::~Transport() {} - -void Transport::SetBuffer(char *buffer, size_t size) {} +void Transport::SetBuffer(char * /*buffer*/, size_t /*size*/) {} void Transport::Flush() {} @@ -49,4 +48,4 @@ void Transport::InitProfiler(const std::string accessMode, m_Profiler.IsActive = true; } -} // end namespace +} // end namespace adios diff --git a/source/engine/adios1/ADIOS1Reader.cpp b/source/engine/adios1/ADIOS1Reader.cpp index 406c752d39d2e8357c1a0a008c2d2a975cf80425..0d666ec9cf6142011f726f8941bae08053be9eb5 100644 --- a/source/engine/adios1/ADIOS1Reader.cpp +++ b/source/engine/adios1/ADIOS1Reader.cpp @@ -8,26 +8,21 @@ * Author: wfg */ -#include "engine/bp/BPFileReader.h" - #include "core/Support.h" -#include "functions/adiosFunctions.h" //CSVToVector +#include "engine/bp/BPFileReader.h" +#include "functions/adiosFunctions.h" // CSVToVector +#include "transport/file/FStream.h" // uses C++ fstream #include "transport/file/FileDescriptor.h" // uses POSIX #include "transport/file/FilePointer.h" // uses C FILE* -// supported transports -#include "transport/file/FStream.h" // uses C++ fstream - namespace adios { BPFileReader::BPFileReader(ADIOS &adios, const std::string name, const std::string accessMode, MPI_Comm mpiComm, - const Method &method, const IOMode iomode, - const float timeout_sec, const bool debugMode, - const unsigned int nthreads) -: Engine(adios, "BPFileReader", name, accessMode, mpiComm, method, debugMode, - nthreads, " BPFileReader constructor (or call to ADIOS Open).\n"), + const Method &method) +: Engine(adios, "BPFileReader", name, accessMode, mpiComm, method, + " BPFileReader constructor (or call to ADIOS Open).\n"), m_Buffer(accessMode, m_RankMPI, m_DebugMode) { Init(); diff --git a/source/engine/bp/BPFileReader.cpp b/source/engine/bp/BPFileReader.cpp index 4a542c4a9546bbec4219d7d9c6f0579afd838c9f..5adce59e69caa432227c35c08f46e23a2478f9bd 100644 --- a/source/engine/bp/BPFileReader.cpp +++ b/source/engine/bp/BPFileReader.cpp @@ -11,13 +11,11 @@ #include "engine/bp/BPFileReader.h" #include "core/Support.h" -#include "functions/adiosFunctions.h" //CSVToVector +#include "functions/adiosFunctions.h" // CSVToVector +#include "transport/file/FStream.h" // uses C++ fstream #include "transport/file/FileDescriptor.h" // uses POSIX #include "transport/file/FilePointer.h" // uses C FILE* -// supported transports -#include "transport/file/FStream.h" // uses C++ fstream - namespace adios { @@ -31,12 +29,10 @@ BPFileReader::BPFileReader(ADIOS &adios, const std::string name, Init(); } -BPFileReader::~BPFileReader() {} - -Variable<void> * -BPFileReader::InquireVariable(const std::string name, - const bool readIn) // not yet implemented +Variable<void> *BPFileReader::InquireVariable(const std::string /*name*/, + const bool /*readIn*/) { + // not yet implemented return nullptr; } @@ -136,13 +132,14 @@ BPFileReader::InquireVariableCLDouble(const std::string name, const bool readIn) return InquireVariableCommon<std::complex<long double>>(name, readIn); } -VariableCompound *BPFileReader::InquireVariableCompound(const std::string name, - const bool readIn) +VariableCompound * +BPFileReader::InquireVariableCompound(const std::string /*name*/, + const bool /*readIn*/) { return nullptr; } -void BPFileReader::Close(const int transportIndex) {} +void BPFileReader::Close(const int /*transportIndex*/) {} // PRIVATE void BPFileReader::Init() @@ -150,9 +147,11 @@ void BPFileReader::Init() if (m_DebugMode == true) { if (m_AccessMode != "r" && m_AccessMode != "read") + { throw std::invalid_argument( "ERROR: BPFileReader doesn't support access mode " + m_AccessMode + ", in call to ADIOS Open or BPFileReader constructor\n"); + } } InitCapsules(); @@ -212,19 +211,23 @@ void BPFileReader::InitTransports() // maybe move this? else { if (m_DebugMode == true) + { throw std::invalid_argument( "ERROR: file transport library " + itLibrary->second + " not supported, in " + m_Name + m_EndMessage); + } } } else { if (m_DebugMode == true) + { throw std::invalid_argument("ERROR: transport " + itTransport->second + " (you mean File?) not supported, in " + m_Name + m_EndMessage); + } } } } -} // end namespace +} // end namespace adios diff --git a/source/engine/bp/BPFileWriter.cpp b/source/engine/bp/BPFileWriter.cpp index 09d6a90c87dc577dae38150a29fbf4cb3c9227c5..414deec61b3092c06b83d6f6567b28abe80e676b 100644 --- a/source/engine/bp/BPFileWriter.cpp +++ b/source/engine/bp/BPFileWriter.cpp @@ -32,7 +32,7 @@ BPFileWriter::BPFileWriter(ADIOS &adios, const std::string name, Init(); } -BPFileWriter::~BPFileWriter() {} +BPFileWriter::~BPFileWriter() = default; void BPFileWriter::Init() { @@ -131,7 +131,10 @@ void BPFileWriter::Write(Variable<std::complex<long double>> &variable, WriteVariableCommon(variable, values); } -void BPFileWriter::Write(VariableCompound &variable, const void *values) {} +void BPFileWriter::Write(VariableCompound & /*variable*/, + const void * /*values*/) +{ +} // String version void BPFileWriter::Write(const std::string variableName, const char *values) @@ -230,12 +233,12 @@ void BPFileWriter::Write(const std::string variableName, m_ADIOS.GetVariable<std::complex<long double>>(variableName), values); } -void BPFileWriter::Write(const std::string variableName, - const void *values) // Compound type +void BPFileWriter::Write(const std::string /*variableName*/, + const void * /*values*/) // Compound type { } -void BPFileWriter::Advance(float timeout_sec) +void BPFileWriter::Advance(float /*timeout_sec*/) { m_BP1Writer.Advance(m_MetadataSet, m_Buffer); } @@ -245,10 +248,11 @@ void BPFileWriter::Close(const int transportIndex) CheckTransportIndex(transportIndex); if (transportIndex == -1) { - for (auto &transport : - m_Transports) // by reference or value or it doesn't matter? + for (auto &transport : m_Transports) + { // by reference or value or it doesn't matter? m_BP1Writer.Close(m_MetadataSet, m_Buffer, *transport, m_IsFirstClose, false); // false: not using aggregation for now + } } else { @@ -290,9 +294,11 @@ void BPFileWriter::InitParameters() if (m_DebugMode == true) { if (growthFactor == 1.f) + { throw std::invalid_argument( "ERROR: buffer_growth argument can't be less of equal than 1, in " + m_EndMessage + "\n"); + } } m_BP1Writer.m_GrowthFactor = growthFactor; @@ -305,9 +311,11 @@ void BPFileWriter::InitParameters() if (m_DebugMode == true) { if (m_GrowthFactor <= 1.f) + { throw std::invalid_argument("ERROR: Method buffer_growth argument " "can't be less of equal than 1, in " + m_EndMessage + "\n"); + } } m_MaxBufferSize = std::stoul(itMaxBufferSize->second) * @@ -321,9 +329,11 @@ void BPFileWriter::InitParameters() if (m_DebugMode == true) { if (verbosity < 0 || verbosity > 5) + { throw std::invalid_argument("ERROR: Method verbose argument must be an " "integer in the range [0,5], in call to " "Open or Engine constructor\n"); + } } m_BP1Writer.m_Verbosity = verbosity; } @@ -335,24 +345,22 @@ void BPFileWriter::InitParameters() if (itProfile->second == "mus" || itProfile->second == "microseconds") profiler.Timers.emplace_back("buffering", Support::Resolutions::mus); - else if (itProfile->second == "ms" || itProfile->second == "milliseconds") profiler.Timers.emplace_back("buffering", Support::Resolutions::ms); - else if (itProfile->second == "s" || itProfile->second == "seconds") profiler.Timers.emplace_back("buffering", Support::Resolutions::s); - else if (itProfile->second == "min" || itProfile->second == "minutes") profiler.Timers.emplace_back("buffering", Support::Resolutions::m); - else if (itProfile->second == "h" || itProfile->second == "hours") profiler.Timers.emplace_back("buffering", Support::Resolutions::h); else { if (m_DebugMode == true) + { throw std::invalid_argument("ERROR: Method profile_buffering_units " "argument must be mus, ms, s, min or h, in " "call to Open or Engine constructor\n"); + } } profiler.IsActive = true; @@ -381,26 +389,33 @@ void BPFileWriter::InitTransports() if (itProfile != parameters.end()) { if (itProfile->second == "mus" || itProfile->second == "microseconds") + { resolution = Support::Resolutions::mus; - + } else if (itProfile->second == "ms" || itProfile->second == "milliseconds") + { resolution = Support::Resolutions::ms; - + } else if (itProfile->second == "s" || itProfile->second == "seconds") + { resolution = Support::Resolutions::s; - + } else if (itProfile->second == "min" || itProfile->second == "minutes") + { resolution = Support::Resolutions::m; - + } else if (itProfile->second == "h" || itProfile->second == "hours") + { resolution = Support::Resolutions::h; - + } else { if (m_DebugMode == true) + { throw std::invalid_argument("ERROR: Transport profile_units argument " "must be mus, ms, s, min or h " + m_EndMessage); + } } doProfiling = true; } @@ -416,7 +431,9 @@ void BPFileWriter::InitTransports() auto file = std::make_shared<transport::FileDescriptor>(m_MPIComm, m_DebugMode); if (doProfiling == true) + { file->InitProfiler(m_AccessMode, resolution); + } m_BP1Writer.OpenRankFiles(m_Name, m_AccessMode, *file); m_Transports.push_back(std::move(file)); @@ -426,7 +443,9 @@ void BPFileWriter::InitTransports() auto file = std::make_shared<transport::FilePointer>(m_MPIComm, m_DebugMode); if (doProfiling == true) + { file->InitProfiler(m_AccessMode, resolution); + } m_BP1Writer.OpenRankFiles(m_Name, m_AccessMode, *file); m_Transports.push_back(std::move(file)); @@ -438,7 +457,9 @@ void BPFileWriter::InitTransports() std::make_shared<transport::FStream>(m_MPIComm, m_DebugMode); if (doProfiling == true) + { file->InitProfiler(m_AccessMode, resolution); + } m_BP1Writer.OpenRankFiles(m_Name, m_AccessMode, *file); m_Transports.push_back(std::move(file)); @@ -449,23 +470,28 @@ void BPFileWriter::InitTransports() else { if (m_DebugMode == true) + { throw std::invalid_argument( "ERROR: file transport library " + itLibrary->second + " not supported, in " + m_Name + m_EndMessage); + } } } else { if (m_DebugMode == true) + { throw std::invalid_argument("ERROR: transport " + itTransport->second + " (you mean File?) not supported, in " + m_Name + m_EndMessage); + } } } } void BPFileWriter::InitProcessGroup() { + if (m_MetadataSet.Log.IsActive == true) m_MetadataSet.Log.Timers[0].SetInitialTime(); diff --git a/source/functions/adiosFunctions.cpp b/source/functions/adiosFunctions.cpp index 0886e029ad14a4e6fc4dd8b04b296071175d3678..78393c641f2c502c35728c46e590252ff8580749 100644 --- a/source/functions/adiosFunctions.cpp +++ b/source/functions/adiosFunctions.cpp @@ -37,10 +37,12 @@ void DumpFileToString(const std::string fileName, std::string &fileContent) { std::ifstream fileStream(fileName); - if (fileStream.good() == false) // check file + if (fileStream.good() == false) + { // check file throw std::ios_base::failure( "ERROR: file " + fileName + " could not be opened. Check permissions or file existence\n"); + } std::ostringstream fileSS; fileSS << fileStream.rdbuf(); @@ -48,7 +50,9 @@ void DumpFileToString(const std::string fileName, std::string &fileContent) fileContent = fileSS.str(); // convert to string and check if (fileContent.empty()) + { throw std::invalid_argument("ERROR: file " + fileName + " is empty\n"); + } } void GetSubString(const std::string initialTag, const std::string finalTag, @@ -101,25 +105,35 @@ void GetSubString(const std::string initialTag, const std::string finalTag, (singleQuotePosition == content.npos && end < doubleQuotePosition) || (doubleQuotePosition == content.npos && end < singleQuotePosition) || (end < singleQuotePosition && end < doubleQuotePosition)) + { break; + } // find the closing corresponding quote std::string::size_type closingQuotePosition; - if (singleQuotePosition == content.npos) // no ' anywhere + if (singleQuotePosition == content.npos) + { // no ' anywhere lf_SetPositions('\"', doubleQuotePosition, content, currentPosition, closingQuotePosition); - else if (doubleQuotePosition == content.npos) // no " anywhere + } + else if (doubleQuotePosition == content.npos) + { // no " anywhere lf_SetPositions('\'', singleQuotePosition, content, currentPosition, closingQuotePosition); + } else { if (singleQuotePosition < doubleQuotePosition) + { lf_SetPositions('\'', singleQuotePosition, content, currentPosition, closingQuotePosition); - else // find the closing " + } + else + { // find the closing " lf_SetPositions('\"', doubleQuotePosition, content, currentPosition, closingQuotePosition); + } } if (closingQuotePosition == @@ -132,7 +146,9 @@ void GetSubString(const std::string initialTag, const std::string finalTag, currentPosition = closingQuotePosition + 1; if (closingQuotePosition < end) + { continue; + } // if this point is reached it means it's a value inside " " or ' ', move to // the next end @@ -151,8 +167,10 @@ void GetQuotedValue(const char quote, auto nextQuotePosition = currentTag.find(quote); if (nextQuotePosition == currentTag.npos) + { throw std::invalid_argument("ERROR: Invalid attribute in..." + currentTag + "...check XML file\n"); + } value = currentTag.substr(0, nextQuotePosition); currentTag = currentTag.substr(nextQuotePosition + 1); @@ -201,8 +219,10 @@ void GetPairsFromTag( ">"); // check for closing tagName if (fileContent.find(closingTagName) == fileContent.npos) + { throw std::invalid_argument("ERROR: closing tag " + closingTagName + " missing, check XML file\n"); + } GetPairs(tag, pairs); } @@ -411,7 +431,9 @@ std::size_t GetTotalSize(const std::vector<std::size_t> &dimensions) std::size_t product = 1; for (const auto dimension : dimensions) + { product *= dimension; + } return product; } @@ -420,13 +442,17 @@ void CreateDirectory(const std::string fullPath) noexcept { auto lf_Mkdir = [](const std::string directory, struct stat &st) { if (stat(directory.c_str(), &st) == -1) + { mkdir(directory.c_str(), 0777); + } }; auto directoryPosition = fullPath.find("/"); - if (fullPath[0] == '/' || fullPath[0] == '.') // find the second '/' + if (fullPath[0] == '/' || fullPath[0] == '.') + { // find the second '/' directoryPosition = fullPath.find("/", directoryPosition + 1); + } struct stat st = {0}; if (directoryPosition == fullPath.npos) // no subdirectories @@ -464,9 +490,11 @@ void SetTransformsHelper(const std::vector<std::string> &transformNames, if (debugMode == true) { if (colonPosition == transformName.size() - 1) + { throw std::invalid_argument("ERROR: wrong format for transform " + transformName + ", in call to SetTransform\n"); + } } transformMethod = transformName.substr(0, colonPosition); @@ -528,14 +556,18 @@ BuildParametersMap(const std::vector<std::string> ¶meters, if (debugMode == true) { if (equalPosition == parameter.npos) + { throw std::invalid_argument("ERROR: wrong format for parameter " + parameter + ", format must be field=value \n"); + } if (equalPosition == parameter.size() - 1) + { throw std::invalid_argument("ERROR: empty value in parameter " + parameter + ", format must be field=value \n"); + } } field = parameter.substr(0, equalPosition); @@ -553,8 +585,10 @@ BuildParametersMap(const std::vector<std::string> ¶meters, if (debugMode == true) { if (parametersOutput.count(field) == 1) + { throw std::invalid_argument("ERROR: parameter " + field + " already exists, must be unique\n"); + } } parametersOutput[field] = value; @@ -567,7 +601,9 @@ std::vector<int> CSVToVectorInt(const std::string csv) { std::vector<int> numbers; if (csv.empty()) + { return numbers; + } if (csv.find(",") == csv.npos) // check if no commas, one int { @@ -600,7 +636,9 @@ bool CheckBufferAllocation(const std::size_t newSize, const float growthFactor, bool doTransportsFlush = (requiredDataSize > maxBufferSize) ? true : false; if (GrowBuffer(requiredDataSize, growthFactor, buffer) == -1) + { doTransportsFlush = true; + } return doTransportsFlush; } @@ -639,8 +677,8 @@ int GrowBuffer(const std::size_t incomingDataSize, const float growthFactor, bool IsLittleEndian() noexcept { - std::uint16_t hexa = 0x1234; - return *reinterpret_cast<std::uint8_t *>(&hexa) != 0x12; + uint16_t hexa = 0x1234; + return *reinterpret_cast<uint8_t *>(&hexa) != 0x12; // NOLINT } -} // end namespace +} // namespace adios diff --git a/source/mpidummy.cpp b/source/mpidummy.cpp index a0675138b3bf50af3f0a9e1108da5734207f9289..f85e40a44a64c84718691452db59a420e1b8f369 100644 --- a/source/mpidummy.cpp +++ b/source/mpidummy.cpp @@ -20,9 +20,10 @@ #include <cstring> //#define _LARGEFILE64_SOURCE +#include <unistd.h> + #include <sys/time.h> #include <sys/types.h> -#include <unistd.h> /// \endcond #include "mpidummy.h" @@ -95,8 +96,9 @@ int MPI_Comm_free(MPI_Comm *comm) MPI_Comm MPI_Comm_f2c(MPI_Fint comm) { return comm; } -int MPI_Gather(void *sendbuf, int sendcnt, MPI_Datatype sendtype, void *recvbuf, - int recvcnt, MPI_Datatype recvtype, int root, MPI_Comm comm) +int MPI_Gather(const void *sendbuf, int sendcnt, MPI_Datatype sendtype, + void *recvbuf, int recvcnt, MPI_Datatype recvtype, int root, + MPI_Comm comm) { int ier = MPI_SUCCESS; size_t n = 0, nsent = 0, nrecv = 0; @@ -146,8 +148,8 @@ int MPI_Gather(void *sendbuf, int sendcnt, MPI_Datatype sendtype, void *recvbuf, return ier; } -int MPI_Gatherv(void *sendbuf, int sendcnt, MPI_Datatype sendtype, - void *recvbuf, int *recvcnts, int *displs, +int MPI_Gatherv(const void *sendbuf, int sendcnt, MPI_Datatype sendtype, + void *recvbuf, const int *recvcnts, const int *displs, MPI_Datatype recvtype, int root, MPI_Comm comm) { int ier = MPI_SUCCESS; @@ -165,7 +167,7 @@ int MPI_Gatherv(void *sendbuf, int sendcnt, MPI_Datatype sendtype, return ier; } -int MPI_Allgather(void *sendbuf, int sendcount, MPI_Datatype sendtype, +int MPI_Allgather(const void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype, MPI_Comm comm) { @@ -173,7 +175,7 @@ int MPI_Allgather(void *sendbuf, int sendcount, MPI_Datatype sendtype, 0, comm); } -int MPI_Scatter(void *sendbuf, int sendcnt, MPI_Datatype sendtype, +int MPI_Scatter(const void *sendbuf, int sendcnt, MPI_Datatype sendtype, void *recvbuf, int recvcnt, MPI_Datatype recvtype, int root, MPI_Comm comm) { @@ -216,7 +218,7 @@ int MPI_Scatter(void *sendbuf, int sendcnt, MPI_Datatype sendtype, if (ier == MPI_SUCCESS) { - memcpy(sendbuf, recvbuf, nsent); + memcpy(recvbuf, sendbuf, nsent); } else { @@ -226,7 +228,7 @@ int MPI_Scatter(void *sendbuf, int sendcnt, MPI_Datatype sendtype, return ier; } -int MPI_Scatterv(void *sendbuf, int *sendcnts, int *displs, +int MPI_Scatterv(const void *sendbuf, const int *sendcnts, const int *displs, MPI_Datatype sendtype, void *recvbuf, int recvcnt, MPI_Datatype recvtype, int root, MPI_Comm comm) { @@ -260,13 +262,13 @@ int MPI_Irecv(void * /*recvbuffer*/, int /*count*/, MPI_Datatype /*type*/, return 0; } -int MPI_Send(void * /*sendbuffer*/, int /*count*/, MPI_Datatype /*type*/, +int MPI_Send(const void * /*sendbuffer*/, int /*count*/, MPI_Datatype /*type*/, int /*destination*/, int /*tag*/, MPI_Comm /*comm*/) { return 0; } -int MPI_Isend(void * /*recvbuffer*/, int /*count*/, MPI_Datatype /*type*/, +int MPI_Isend(const void * /*recvbuffer*/, int /*count*/, MPI_Datatype /*type*/, int /*source*/, int /*tag*/, MPI_Comm /*comm*/, MPI_Request * /*request*/) { @@ -275,7 +277,7 @@ int MPI_Isend(void * /*recvbuffer*/, int /*count*/, MPI_Datatype /*type*/, int MPI_Wait(MPI_Request * /*request*/, MPI_Status * /*status*/) { return 0; } -int MPI_File_open(MPI_Comm /*comm*/, char *filename, int amode, +int MPI_File_open(MPI_Comm /*comm*/, const char *filename, int amode, MPI_Info /*info*/, MPI_File *fh) { *fh = open64(filename, amode); @@ -327,7 +329,7 @@ int MPI_File_seek(MPI_File fh, MPI_Offset offset, int whence) return MPI_SUCCESS; } -int MPI_Get_count(MPI_Status *status, MPI_Datatype, int *count) +int MPI_Get_count(const MPI_Status *status, MPI_Datatype, int *count) { *count = static_cast<int>(*status); return MPI_SUCCESS; diff --git a/source/transform/BZip2.cpp b/source/transform/BZip2.cpp index 646b8bc6c75ba201e575cf245c54380eff9e712f..c267af7540249968dd42d9e9bb210b2917661150 100644 --- a/source/transform/BZip2.cpp +++ b/source/transform/BZip2.cpp @@ -17,15 +17,15 @@ namespace transform BZIP2::BZIP2() : Transform("bzip2") {} -BZIP2::~BZIP2() {} +BZIP2::~BZIP2() = default; -void BZIP2::Compress(const std::vector<char> &bufferIn, - std::vector<char> &bufferOut) +void BZIP2::Compress(const std::vector<char> & /*bufferIn*/, + std::vector<char> & /*bufferOut*/) { } -void BZIP2::Decompress(const std::vector<char> &bufferIn, - std::vector<char> &bufferOut) +void BZIP2::Decompress(const std::vector<char> & /*bufferIn*/, + std::vector<char> & /*bufferOut*/) { } diff --git a/source/transport/file/FStream.cpp b/source/transport/file/FStream.cpp index 15bf60b58072ae17c4fa5fe171ef65789ea1c395..2a404ae6a96a10471e5ccd97acd547617a73fdb0 100644 --- a/source/transport/file/FStream.cpp +++ b/source/transport/file/FStream.cpp @@ -9,6 +9,7 @@ */ /// \cond EXCLUDED_FROM_DOXYGEN +#include <ios> // std::ios_base::failure #include <stdexcept> /// \endcond @@ -19,33 +20,37 @@ namespace adios namespace transport { -FStream::FStream(MPI_Comm mpiComm, const bool debugMode) +FStream::FStream(MPI_Comm mpiComm, bool debugMode) : Transport("fstream", mpiComm, debugMode) { } -FStream::~FStream() {} - void FStream::Open(const std::string name, const std::string accessMode) { m_Name = name; m_AccessMode = accessMode; if (accessMode == "w" || accessMode == "write") + { m_FStream.open(name, std::fstream::out); - + } else if (accessMode == "a" || accessMode == "append") + { m_FStream.open(name, std::fstream::out | std::fstream::app); - + } else if (accessMode == "r" || accessMode == "read") + { m_FStream.open(name, std::fstream::in); + } if (m_DebugMode == true) { if (!m_FStream) + { throw std::ios_base::failure( "ERROR: couldn't open file " + name + ", in call to Open from FStream transport\n"); + } } } @@ -61,8 +66,10 @@ void FStream::Write(const char *buffer, std::size_t size) if (m_DebugMode == true) { if (!m_FStream) + { throw std::ios_base::failure("ERROR: couldn't write to file " + m_Name + ", in call to FStream write\n"); + } } } @@ -71,4 +78,4 @@ void FStream::Flush() { m_FStream.flush(); } void FStream::Close() { m_FStream.close(); } } // end namespace transport -} // end namespace +} // end namespace adios diff --git a/source/transport/file/FileDescriptor.cpp b/source/transport/file/FileDescriptor.cpp index e64446e49a771620be22b5d6faad919046e83ad7..d469f017286e8dde70925f6da8c6ebb6dc61308c 100644 --- a/source/transport/file/FileDescriptor.cpp +++ b/source/transport/file/FileDescriptor.cpp @@ -54,6 +54,7 @@ void FileDescriptor::Open(const std::string name, const std::string accessMode) } else if (accessMode == "a" || accessMode == "append") { + if (m_Profiler.IsActive == true) m_Profiler.Timers[0].SetInitialTime(); @@ -65,6 +66,7 @@ void FileDescriptor::Open(const std::string name, const std::string accessMode) } else if (accessMode == "r" || accessMode == "read") { + if (m_Profiler.IsActive == true) m_Profiler.Timers[0].SetInitialTime(); @@ -77,14 +79,17 @@ void FileDescriptor::Open(const std::string name, const std::string accessMode) if (m_DebugMode == true) { if (m_FileDescriptor == -1) + { throw std::ios_base::failure("ERROR: couldn't open file " + m_Name + ", from call to Open in FD transport using " "POSIX open. Does file exists?\n"); + } } } void FileDescriptor::Write(const char *buffer, std::size_t size) { + if (m_Profiler.IsActive == true) m_Profiler.Timers[1].SetInitialTime(); @@ -96,14 +101,18 @@ void FileDescriptor::Write(const char *buffer, std::size_t size) if (m_DebugMode == true) { if (writtenSize == -1) + { throw std::ios_base::failure("ERROR: couldn't write to file " + m_Name + ", in call to POSIX write\n"); + } if (static_cast<std::size_t>(writtenSize) != size) + { throw std::ios_base::failure( "ERROR: written size + " + std::to_string(writtenSize) + " is not equal to intended size " + std::to_string(size) + " in file " + m_Name + ", in call to POSIX write\n"); + } } } @@ -120,12 +129,14 @@ void FileDescriptor::Close() if (m_DebugMode == true) { if (status == -1) + { throw std::ios_base::failure("ERROR: couldn't close file " + m_Name + ", in call to POSIX write\n"); + } } m_IsOpen = false; } } // end namespace transport -} // end namespace +} // namespace adios diff --git a/source/transport/file/FilePointer.cpp b/source/transport/file/FilePointer.cpp index 704b93f08d55ad410d25f9a04a501c73d60d49a7..1ba57204e6a6827c7454c688b37b8e2f1d62e2c9 100644 --- a/source/transport/file/FilePointer.cpp +++ b/source/transport/file/FilePointer.cpp @@ -26,8 +26,10 @@ FilePointer::FilePointer(MPI_Comm mpiComm, const bool debugMode) FilePointer::~FilePointer() { - if (m_File != NULL) + if (m_File != nullptr) + { fclose(m_File); + } } void FilePointer::Open(const std::string name, const std::string accessMode) @@ -36,20 +38,26 @@ void FilePointer::Open(const std::string name, const std::string accessMode) m_AccessMode = accessMode; if (accessMode == "w" || accessMode == "write") + { m_File = fopen(name.c_str(), "w"); - + } else if (accessMode == "a" || accessMode == "append") + { m_File = fopen(name.c_str(), "a"); - + } else if (accessMode == "r" || accessMode == "read") + { m_File = fopen(name.c_str(), "r"); + } if (m_DebugMode == true) { - if (m_File == NULL) + if (m_File == nullptr) + { throw std::ios_base::failure("ERROR: couldn't open file " + name + ", " "in call to Open from File* transport\n"); + } } } @@ -60,8 +68,10 @@ void FilePointer::SetBuffer(char *buffer, std::size_t size) if (m_DebugMode == true) { if (status == 1) + { throw std::ios_base::failure("ERROR: could not set buffer in rank " + std::to_string(m_RankMPI) + "\n"); + } } } @@ -72,8 +82,10 @@ void FilePointer::Write(const char *buffer, std::size_t size) if (m_DebugMode == true) { if (ferror(m_File)) + { throw std::ios_base::failure("ERROR: couldn't write to file " + m_Name + ", in call to File* write\n"); + } } } @@ -87,4 +99,4 @@ void FilePointer::Close() } } // end namespace transport -} // end namespace +} // namespace adios diff --git a/source/packages/format/bp1/BP1Aggregator.cpp b/source/utilities/format/bp1/BP1Aggregator.cpp similarity index 98% rename from source/packages/format/bp1/BP1Aggregator.cpp rename to source/utilities/format/bp1/BP1Aggregator.cpp index aa6a5d2f61dd63e49541d06bd63cd2b7320f13fb..2d2ff740a29c7b62e01bf78578495f7b875ddb71 100644 --- a/source/packages/format/bp1/BP1Aggregator.cpp +++ b/source/utilities/format/bp1/BP1Aggregator.cpp @@ -9,13 +9,13 @@ */ /// \cond EXCLUDE_FROM_DOXYGEN +#include "utilities/format/bp1/BP1Aggregator.h" + #include <fstream> #include <stdexcept> #include <vector> /// \endcond -#include "packages/format/bp1/BP1Aggregator.h" - namespace adios { namespace format diff --git a/source/packages/format/bp1/BP1Base.cpp b/source/utilities/format/bp1/BP1Base.cpp similarity index 91% rename from source/packages/format/bp1/BP1Base.cpp rename to source/utilities/format/bp1/BP1Base.cpp index ddb0b042e356ce9137396ccf5379dab32b8ae9f2..b6eea6a7fbb8ff4b7727450dc9c287a1f0521391 100644 --- a/source/packages/format/bp1/BP1Base.cpp +++ b/source/utilities/format/bp1/BP1Base.cpp @@ -8,7 +8,7 @@ * Author: wfg */ -#include "packages/format/bp1/BP1Base.h" +#include "utilities/format/bp1/BP1Base.h" #include "functions/adiosFunctions.h" namespace adios @@ -39,8 +39,8 @@ void BP1Base::OpenRankFiles(const std::string name, std::string fileName(directory + "/" + directory + "." + std::to_string(file.m_RankMPI)); file.Open(fileName, accessMode); // opens a file transport under - // name.bp.dir/name.bp.rank reserve that - // location fro writing + // name.bp/name.bp.rank reserve that + // location for writing } std::vector<std::uint8_t> BP1Base::GetMethodIDs( diff --git a/source/packages/format/bp1/BP1Writer.cpp b/source/utilities/format/bp1/BP1Writer.cpp similarity index 99% rename from source/packages/format/bp1/BP1Writer.cpp rename to source/utilities/format/bp1/BP1Writer.cpp index 4f908f293203713785f7a433e6742c22361115ce..db59eb9eef83d1b8739635956444a762386b355e 100644 --- a/source/packages/format/bp1/BP1Writer.cpp +++ b/source/utilities/format/bp1/BP1Writer.cpp @@ -9,12 +9,12 @@ */ /// \cond EXCLUDE_FROM_DOXYGEN +#include "utilities/format/bp1/BP1Writer.h" + #include <string> #include <vector> /// \endcond -#include "packages/format/bp1/BP1Writer.h" - namespace adios { namespace format diff --git a/source/packages/profiling/iochrono/Timer.cpp b/source/utilities/profiling/iochrono/Timer.cpp similarity index 98% rename from source/packages/profiling/iochrono/Timer.cpp rename to source/utilities/profiling/iochrono/Timer.cpp index 9f6356f4a3412841e16848dfc1ae2999435534c6..7aab0c5a09b34fcb274fc3f337a04747cb943dc5 100644 --- a/source/packages/profiling/iochrono/Timer.cpp +++ b/source/utilities/profiling/iochrono/Timer.cpp @@ -8,7 +8,7 @@ * Author: wfg */ -#include "packages/profiling/iochrono/Timer.h" +#include "utilities/profiling/iochrono/Timer.h" namespace adios { diff --git a/thirdparty/CMakeLists.txt b/thirdparty/CMakeLists.txt index 0825c4704eca3867613ee2f58fdd5636d2fdee5b..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 --- a/thirdparty/CMakeLists.txt +++ b/thirdparty/CMakeLists.txt @@ -1,41 +0,0 @@ -#------------------------------------------------------------------------------# -# Distributed under the OSI-approved Apache License, Version 2.0. See -# accompanying file Copyright.txt for details. -#------------------------------------------------------------------------------# - -set(ADIOS_THIRDPARTY_DOWNLOAD_DIR ${CMAKE_CURRENT_BINARY_DIR}/downloads - CACHE PATH "Download directory for third party dependencies") - -include(ExternalProject) - -# Boilerplate settings for a common external project infrastructure -set(EP_ARGS - DOWNLOAD_DIR ${ADIOS_THIRDPARTY_DOWNLOAD_DIR} - PREFIX . - SOURCE_DIR source - BINARY_DIR build - STAMP_DIR stamp - INSTALL_DIR install) - -# Use Google Test for a unit testing framework -cmake_dependent_option(ADIOS_USE_SYSTEM_GOOGLETEST - "Use a system-supplied Google Test framework" ON - "BUILD_TESTING" OFF) -if(BUILD_TESTING) - if(ADIOS_USE_SYSTEM_GOOGLETEST) - find_package(GTest REQUIRED) - if(NOT GTEST_FOUND) - message(WARNING - "Unable to find Google Test framework. " - "Using an internal version") - set(ADIOS_USE_SYSTEM_GOOGLETEST OFF - CACHE BOOL "Use a system-supplied Google Test framework" FORCE) - endif() - endif() - if(NOT ADIOS_USE_SYSTEM_GOOGLETEST) - add_subdirectory(googletest) - find_package(GTest REQUIRED) - add_dependencies(GTest::GTest googletest) - add_dependencies(GTest::Main googletest) - endif() -endif() diff --git a/thirdparty/googletest/CMakeLists.txt b/thirdparty/googletest/CMakeLists.txt deleted file mode 100644 index 5fc4fa9ee1dfe938e27473fbc1ae7ea0b9c90aea..0000000000000000000000000000000000000000 --- a/thirdparty/googletest/CMakeLists.txt +++ /dev/null @@ -1,40 +0,0 @@ -#------------------------------------------------------------------------------# -# Distributed under the OSI-approved Apache License, Version 2.0. See -# accompanying file Copyright.txt for details. -#------------------------------------------------------------------------------# - -ExternalProject_Add(googletest - URL https://github.com/google/googletest/archive/release-1.8.0.zip - URL_MD5 adfafc8512ab65fd3cf7955ef0100ff5 - ${EP_ARGS} - CMAKE_ARGS - -DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/install - -DCMAKE_POLICY_DEFAULT_CMP0048=OLD - -DCMAKE_POLICY_DEFAULT_CMP0063=NEW - -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} - -DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS} - -DBUILD_GMOCK=OFF - -DBUILD_GTEST=ON - -Dgtest_build_samples=OFF - -Dgtest_build_tests=OFF - -Dgtest_hide_internal_symbols=ON - -Dgtest_disable_pthreads=OFF - -Dgtest_force_shared_crt=OFF) - -function(get_libfile var name) - if(BUILD_SHARED_LIBS) - set(${var} ${CMAKE_SHARED_LIBRARY_PREFIX}${name}${CMAKE_SHARED_LIBRARY_SUFFIX} PARENT_SCOPE) - else() - set(${var} ${CMAKE_STATIC_LIBRARY_PREFIX}${name}${CMAKE_STATIC_LIBRARY_SUFFIX} PARENT_SCOPE) - endif() -endfunction() - -get_libfile(GTEST_LIBRARY gtest) -get_libfile(GTEST_MAIN_LIBRARY gtest_main) -set(GTEST_ROOT ${CMAKE_CURRENT_BINARY_DIR}/install) -set(GTEST_INCLUDE_DIR ${GTEST_ROOT}/include - CACHE PATH "") -set(GTEST_LIBRARY ${GTEST_ROOT}/lib/${GTEST_LIBRARY} - CACHE FILEPATH "") -set(GTEST_MAIN_LIBRARY ${GTEST_ROOT}/lib/${GTEST_MAIN_LIBRARY} - CACHE FILEPATH "")