diff --git a/examples/dataman/datamanNoXML.cpp b/examples/dataman/datamanNoXML.cpp index 0c80c5ecab8a1d8090b9f68cc8e07aafc8424c59..4bf62bcdc313a137864095046052baa73276ee80 100644 --- a/examples/dataman/datamanNoXML.cpp +++ b/examples/dataman/datamanNoXML.cpp @@ -9,12 +9,12 @@ #ifdef HAVE_MPI #include <mpi.h> #else - #include "public/mpidummy.h" + #include "../../include/mpidummy.h" using adios::MPI_Init; using adios::MPI_Comm_rank; #endif -#include "public/ADIOS.h" +#include "../../include/ADIOS.h" int main( int argc, char* argv [] ) diff --git a/examples/globalArray/globalArrayNoXML.cpp b/examples/globalArray/globalArrayNoXML.cpp index 5b2b91ed74ffbdc01e04b302dba73e02324111ba..b90054b0c8dd701fa957c17a35773814bb135342 100644 --- a/examples/globalArray/globalArrayNoXML.cpp +++ b/examples/globalArray/globalArrayNoXML.cpp @@ -12,7 +12,7 @@ #include <string> #include <vector> -#include "public/ADIOS.h" +#include "../../include/ADIOS.h" int main( int argc, char* argv [] ) { diff --git a/examples/globalArray/globalArrayXML.cpp b/examples/globalArray/globalArrayXML.cpp index 9951aafc406778ee1f96f37d7ebb110a972eabdb..82b9e9e0a666fbf4623c49191eea89924baa9a81 100644 --- a/examples/globalArray/globalArrayXML.cpp +++ b/examples/globalArray/globalArrayXML.cpp @@ -12,7 +12,7 @@ #include <string> #include <vector> -#include "public/ADIOS.h" +#include "../../include/ADIOS.h" int main( int argc, char* argv [] ) { diff --git a/examples/globalArray/globalArrayZeroCopy.cpp b/examples/globalArray/globalArrayZeroCopy.cpp index 41501475e16a49420e552b0d34ec9ef027629b77..9a5716591f9508a71e8df1923da3cc8a050f4bb0 100644 --- a/examples/globalArray/globalArrayZeroCopy.cpp +++ b/examples/globalArray/globalArrayZeroCopy.cpp @@ -12,7 +12,7 @@ #include <string> #include <vector> -#include "public/ADIOS.h" +#include "../../include/ADIOS.h" int main( int argc, char* argv [] ) { diff --git a/examples/hello/C/helloFStream.c b/examples/hello/C/helloFStream.c index b9978fd1e4a8105173b5de82382d033c524a165b..70f890db1e0b13d243ebb58734e6621477f69bfb 100644 --- a/examples/hello/C/helloFStream.c +++ b/examples/hello/C/helloFStream.c @@ -6,7 +6,7 @@ -#include "public/ADIOS_C.h" +#include "../../../include/ADIOS_C.h" void main( int argc, char* argv [] ) diff --git a/examples/hello/helloADIOS.cpp b/examples/hello/helloADIOS.cpp index 24bc2747d9b9581c3e709608d58a9e42ebbdf156..d17d59272a4e87a569a8c98ea4c4310cb67da5d5 100644 --- a/examples/hello/helloADIOS.cpp +++ b/examples/hello/helloADIOS.cpp @@ -13,7 +13,7 @@ #include <fstream> #include <string> -#include "public/ADIOS.h" +#include "../../include/ADIOS.h" int main( int argc, char* argv [] ) diff --git a/examples/hello/helloADIOS_C.c b/examples/hello/helloADIOS_C.c index 59c41e5192c0fda4ddf90088aac05eac4c7e3d48..28af801072c315a5412a7672234a7157e3fe23ea 100644 --- a/examples/hello/helloADIOS_C.c +++ b/examples/hello/helloADIOS_C.c @@ -8,10 +8,10 @@ #ifdef HAVE_MPI #include <mpi.h> #else - #include "public/mpidummy.h" + #include "../../include/mpidummy.h" #endif -#include "public/ADIOS_C.h" +#include "../../include/ADIOS_C.h" diff --git a/examples/hello/helloADIOS_nompi.cpp b/examples/hello/helloADIOS_nompi.cpp index c0876a8945ab553ca8ca7aae3f9f136551815106..4109656f6a946aafbb6afa4bbec2d6b54d56e1ee 100644 --- a/examples/hello/helloADIOS_nompi.cpp +++ b/examples/hello/helloADIOS_nompi.cpp @@ -9,7 +9,7 @@ #include <stdexcept> #include <iostream> -#include "public/ADIOS.h" +#include "../../include/ADIOS.h" int main( int argc, char* argv [] ) diff --git a/examples/hello/helloFStream.cpp b/examples/hello/helloFStream.cpp index e1121cdcbb8e571d108854d8686a8ecf41c422bd..04d588b76f4bef73370a41c67a1b2c4bf12053a2 100644 --- a/examples/hello/helloFStream.cpp +++ b/examples/hello/helloFStream.cpp @@ -15,10 +15,10 @@ #ifdef HAVE_MPI #include <mpi.h> #else - #include "public/mpidummy.h" + #include "../../include/mpidummy.h" #endif -#include "public/ADIOS.h" +#include "../../include/ADIOS.h" int main( int argc, char* argv [] ) diff --git a/examples/hello/helloFStreamNoXML.cpp b/examples/hello/helloFStreamNoXML.cpp index accaa9f80e538acf143ebaf3e06d9295694e7531..70f1181fe36c55e794db50ecb71d8c8d34ca3b21 100644 --- a/examples/hello/helloFStreamNoXML.cpp +++ b/examples/hello/helloFStreamNoXML.cpp @@ -14,10 +14,10 @@ #ifdef HAVE_MPI #include <mpi.h> #else - #include "public/mpidummy.h" + #include "../../include/mpidummy.h" #endif -#include "public/ADIOS.h" +#include "../../include/ADIOS.h" int main( int argc, char* argv [] ) diff --git a/examples/xmlParser/xmlParser.cpp b/examples/xmlParser/xmlParser.cpp index 9e4c37335d61cf3a58bf4c3108eb32493b232623..aa1ef10834e0175dcc2b4c995c2bb32561a53370 100644 --- a/examples/xmlParser/xmlParser.cpp +++ b/examples/xmlParser/xmlParser.cpp @@ -9,12 +9,12 @@ #include <iostream> #include <string> -#include "public/ADIOS.h" +#include "../../include/ADIOS.h" #ifdef HAVE_MPI #include <mpi.h> #else - #include "mpidummy.h" + #include "../../include/mpidummy.h" using namespace adios; #endif diff --git a/include/public/ADIOS.h b/include/ADIOS.h similarity index 74% rename from include/public/ADIOS.h rename to include/ADIOS.h index 8e854a8b8096f02f91809abeccb26c1b1d351c1b..214274a3955b60bbe454418e66267a6c539f9e65 100644 --- a/include/public/ADIOS.h +++ b/include/ADIOS.h @@ -12,17 +12,19 @@ #include <string> #include <memory> //shared_ptr #include <ostream> +#include <unordered_map> /// \endcond #ifdef HAVE_MPI #include <mpi.h> #else - #include "public/mpidummy.h" + #include "mpidummy.h" #endif #include "core/Group.h" -#include "core/Capsule.h" -#include "public/Support.h" +#include "core/Method.h" +#include "core/Engine.h" +#include "core/Support.h" #include "functions/adiosTemplates.h" @@ -80,40 +82,24 @@ public: // PUBLIC Constructors and Functions define the User Interface with ADIO /** - * @brief Open to Write, Read or Append to a stream - * @param streamName associated file or stream - * @param accessMode "w": write, "a": append, need more info on this + * @brief Open to Write, Read + * @param name unique stream or file name + * @param accessMode + * @param mpiComm + * @param method corresponding method + * @return */ - template< class... Args > - void Open( const std::string streamName, const std::string accessMode, const std::string transport, Args... args ) - { - if( m_DebugMode == true ) - { - if( m_Capsules.count( streamName ) == 1 ) //it exists - throw std::invalid_argument( "ERROR: trying to open existing stream (or file) " + streamName + ".\n" ); - } - - std::vector<std::string> arguments = { args... }; - m_Capsules.emplace( streamName, Capsule( m_MPIComm, m_DebugMode, streamName, accessMode, transport, arguments ) ); - } + const unsigned int Open( const std::string name, const std::string accessMode, MPI_Comm mpiComm ); /** - * Sets a new transport method to be associated with a current stream. - * @param streamName must be created with Open - * @param transport - * @return transport index + * @brief Create an Engine described by a previously defined method + * @param name + * @param accessMode + * @param method + * @return */ - template< class... Args > - int AddTransport( const std::string streamName, const std::string accessMode, const std::string transport, Args... args ) - { - if( m_DebugMode == true ) - { - if( m_Capsules.count( streamName ) == 0 ) //it exists - throw std::invalid_argument( "ERROR: stream (or file) " + streamName + " does not exist in call to AddTransport.\n" ); - } - std::vector<std::string> arguments = { args... }; - return m_Capsules[streamName].AddTransport( streamName, accessMode, false, transport, arguments ); - } + const unsigned int Open( const std::string name, const std::string accessMode, const std::string method ); + /** * Sets the maximum buffer size of a stream @@ -134,12 +120,11 @@ public: // PUBLIC Constructors and Functions define the User Interface with ADIO void Write( const std::string streamName, const std::string groupName, const std::string variableName, const T* values, const int transportIndex = -1 ) { - auto itCapsule = m_Capsules.find( streamName ); auto itGroup = m_Groups.find( groupName ); if( m_DebugMode == true ) { - CheckCapsule( itCapsule, streamName, " from call to Write variable " + variableName ); + CheckCapsule( streamName, " from call to Write variable " + variableName ); CheckGroup( itGroup, groupName, " from call to Write variable " + variableName ); if( transportIndex < -1 ) throw std::invalid_argument( "ERROR: transport index " + std::to_string( transportIndex ) + @@ -159,21 +144,25 @@ public: // PUBLIC Constructors and Functions define the User Interface with ADIO * @param cores optional parameter for threaded version */ template<class T> - void Write( const std::string streamName, const std::string variableName, const T* values, + void Write( const int handler, const std::string variableName, const T* values, const int transportIndex = -1 ) { - auto itCapsule = m_Capsules.find( streamName ); if( m_DebugMode == true ) - CheckCapsule( itCapsule, streamName, " from call to Write variable " + variableName ); + CheckCapsule( streamName, " from call to Write variable " + variableName ); - const std::string groupName( itCapsule->second.m_CurrentGroup ); - auto itGroup = m_Groups.find( groupName ); - if( m_DebugMode == true ) - CheckGroup( itGroup, groupName, " from call to Write variable " + variableName ); - - WriteHelper( itCapsule->second, itGroup->second, variableName, values, transportIndex, m_DebugMode ); + WriteHelper( itCapsule->second, *itCapsule->second.m_CurrentGroup, variableName, values, transportIndex, m_DebugMode ); } + template<class T> + void Write( const int handler, const std::string variableName, const T* values, + const int transportIndex = -1 ) + { + if( m_DebugMode == true ) + CheckCapsule( streamName, " from call to Write variable " + variableName ); + + WriteHelper( itCapsule->second, *itCapsule->second.m_CurrentGroup, variableName, values, transportIndex, m_DebugMode ); + } + /** * Close a particular stream and the corresponding transport * @param streamName stream to be closed with all corresponding transports @@ -233,25 +222,33 @@ private: std::string m_HostLanguage = "C++"; ///< Supported languages: C, C++, Fortran, Python, etc. bool m_DebugMode = false; ///< if true will do more checks, exceptions, warnings, expect slower code + //GROUP /** * @brief List of groups defined from either ADIOS XML configuration file or the CreateGroup function. * <pre> * Key: std::string unique group name - * Value: SGroup struct in SGroup.h + * Value: Group class * </pre> */ std::map< std::string, Group > m_Groups; + //METHODS -> Engine Metadata + std::map< std::string, Method > m_Methods; + + //ENGINE /** - * @brief List of Capsules, each defined from the Open function. + * @brief List of Engines, ADIOS Open adds to this container. * <pre> - * Key: std::string unique stream/file/capsule name given by ADIOS Open - * Value: CCapsule object + * Key: Engine handle give by a counter + * Value: Engine derived class * </pre> */ - std::map< std::string, Capsule > m_Capsules; + std::unordered_map< unsigned int, std::shared_ptr<Capsule> > m_Engines; + std::set< std::string > m_EngineNames; ///< set used to check Engine name uniqueness in debug mode + int m_EngineCounter = -1; ///< used to set the unsigned int key in m_Capsules, helpful is a capsule is removed + //TRANSFORMS std::vector< std::shared_ptr<Transform> > m_Transforms; ///< transforms associated with ADIOS run /** @@ -269,8 +266,8 @@ private: * @param streamName unique name, passed for thrown exception only * @param hint adds information to thrown exception */ - void CheckCapsule( std::map< std::string, Capsule >::const_iterator itCapsule, - const std::string streamName, const std::string hint ) const; + void CheckEngine( const std::string streamName, const std::string hint ) const; + }; diff --git a/include/public/ADIOS_C.h b/include/ADIOS_C.h similarity index 97% rename from include/public/ADIOS_C.h rename to include/ADIOS_C.h index 8ce32f7f61b166e530ddb6d35a462cef09da5da0..2331d51474b5fb31e12d4a291575d3b9d01398f3 100644 --- a/include/public/ADIOS_C.h +++ b/include/ADIOS_C.h @@ -11,7 +11,7 @@ #ifdef HAVE_MPI #include <mpi.h> #else - #include "public/mpidummy.h" + #include "../mpidummy.h" using adios::MPI_Comm_rank; using adios::MPI_Comm; #endif diff --git a/include/core/Capsule.h b/include/core/Capsule.h index 496a49cb63b571f5c5b7e247d098d2ba99f4f481..d8ab0667f53d26e8d5bc18f6e1b76344745031c1 100644 --- a/include/core/Capsule.h +++ b/include/core/Capsule.h @@ -1,114 +1,39 @@ /* * Capsule.h * - * Created on: Nov 7, 2016 + * Created on: Dec 7, 2016 * Author: wfg */ #ifndef CAPSULE_H_ #define CAPSULE_H_ - -/// \cond EXCLUDE_FROM_DOXYGEN -#include <vector> -#include <string> -#include <memory> -#include <map> -/// \endcond - -#ifdef HAVE_MPI - #include <mpi.h> -#else - #include "public/mpidummy.h" -#endif - -#include "core/Group.h" -#include "core/Variable.h" -#include "core/Transform.h" -#include "core/Transport.h" -#include "functions/capsuleTemplates.h" - - -namespace adios -{ - /** - * Base class for Capsule operations managing shared-memory, and buffer and variables transform and transport operations + * Base class that owns an manages the raw data buffer and metadata. + * Derived classes will allocate their own buffer in different memory spaces. + * e.g. locally (stack) or in shared memory (virtual memory) */ class Capsule { public: - #ifdef HAVE_MPI - MPI_Comm m_MPIComm = NULL; ///< only used as reference to MPI communicator passed from parallel constructor, MPI_Comm is a pointer itself. Public as called from C - #else - MPI_Comm m_MPIComm = 0; ///< only used as reference to MPI communicator passed from parallel constructor, MPI_Comm is a pointer itself. Public as called from C - #endif - - int m_RankMPI = 0; ///< current MPI rank process - int m_SizeMPI = 1; ///< current MPI processes size - - std::string m_CurrentGroup; ///< associated group to look for variable information - size_t m_MaxBufferSize = 0; - - Capsule( ); ///< Default Empty constructor used with ADIOS class empty constructor + const std::string m_Type; ///< buffer type + const char m_AccessMode; ///< 'w': write, 'r': read, 'a': append /** - * Multiple argument constructor - * @param accessMode - * @param mpiComm - * @param debugMode + * Base class constructor providing type from derived class and accessMode + * @param type derived class type + * @param accessMode 'w':write, 'r':read, 'a':append */ + Capsule( const std::string type, const char accessMode ); - Capsule( const MPI_Comm mpiComm, const bool debugMode, const std::string streamName, const std::string accessMode, - const std::string transport, const std::vector<std::string>& arguments ); - - ~Capsule( ); - - /** - * Add a transport to a stream - * @param streamName - * @param accessMode - * @param isDefault - * @param transport - * @param arguments - * @return transport index - */ - int AddTransport( const std::string streamName, const std::string accessMode, const bool isDefault, - const std::string transport, const std::vector<std::string>& arguments ); - - /** - * Writes raw data to m_Buffer - * @param data pointer containing the data - * @param size of data to be written - * @param transportIndex calls the Write function to this transport only, if -1 (default), call all transports - */ - template<class T> - void Write( const T* data, const size_t size, int transportIndex ) - { - if( m_DebugMode == true ) - { - if( transportIndex >= m_Transports.size() ) - throw std::invalid_argument( "ERROR: transport index " + std::to_string( transportIndex ) + - " does not point to a transport method in call to Write\n" ); - } - WriteToBuffer( data, size, transportIndex, m_Transports, m_MaxBufferSize, m_Buffer ); - } - - void Close( int transportIndex ); ///< Closes a particular transport - + virtual ~Capsule( ); -private: + virtual void Write( const std::vector<char>& data, const std::size_t size ); - std::vector< std::shared_ptr<Transport> > m_Transports; - std::string m_AccessMode; - std::vector<char> m_Buffer; - const bool m_DebugMode = false; - std::string GetName( const std::vector<std::string>& arguments ) const; }; -} //end namespace #endif /* CAPSULE_H_ */ diff --git a/include/core/Engine.h b/include/core/Engine.h new file mode 100644 index 0000000000000000000000000000000000000000..4eed322c89652b35fa50b629b7f5a0c0955a2380 --- /dev/null +++ b/include/core/Engine.h @@ -0,0 +1,95 @@ +/* + * Capsule.h + * + * Created on: Nov 7, 2016 + * Author: wfg + */ + +#ifndef ENGINE_H_ +#define ENGINE_H_ + + +/// \cond EXCLUDE_FROM_DOXYGEN +#include <vector> +#include <string> +#include <memory> //std::shared_ptr +#include <map> +/// \endcond + +#ifdef HAVE_MPI + #include <mpi.h> +#else + #include "mpidummy.h" +#endif + +#include "core/Method.h" +#include "core/Group.h" +#include "core/Variable.h" +#include "core/Transform.h" +#include "core/Transport.h" +#include "core/Capsule.h" + + +namespace adios +{ + +/** + * Base class for Engine operations managing shared-memory, and buffer and variables transform and transport operations + */ +class Engine +{ + +public: + + #ifdef HAVE_MPI + MPI_Comm m_MPIComm = NULL; ///< only used as reference to MPI communicator passed from parallel constructor, MPI_Comm is a pointer itself. Public as called from C + #else + MPI_Comm m_MPIComm = 0; ///< only used as reference to MPI communicator passed from parallel constructor, MPI_Comm is a pointer itself. Public as called from C + #endif + + Group* m_CurrentGroup = nullptr; ///< associated group to look for variable information + int m_RankMPI = 0; ///< current MPI rank process + int m_SizeMPI = 1; ///< current MPI processes size + + /** + * Multiple argument constructor + * @param accessMode + * @param mpiComm + * @param debugMode + */ + + Engine( const std::string streamName, const std::string accessMode, const MPI_Comm mpiComm, + const Method& method ); + + virtual ~Engine( ); + + virtual void Write( Group& group, Variable<char>& variable ); + virtual void Write( Group& group, Variable<unsigned char>& variable ); + virtual void Write( Group& group, Variable<short>& variable ); + virtual void Write( Group& group, Variable<unsigned short>& variable ); + virtual void Write( Group& group, Variable<int>& variable ); + virtual void Write( Group& group, Variable<unsigned int>& variable ); + virtual void Write( Group& group, Variable<long int>& variable ); + virtual void Write( Group& group, Variable<unsigned long int>& variable ); + virtual void Write( Group& group, Variable<long long int>& variable ); + virtual void Write( Group& group, Variable<unsigned long long int>& variable ); + virtual void Write( Group& group, Variable<float>& variable ); + virtual void Write( Group& group, Variable<double>& variable ); + virtual void Write( Group& group, Variable<long double>& variable ); + + virtual void Close( int transportIndex ); ///< Closes a particular transport + +private: + + std::vector< std::shared_ptr<Transport> > m_Transports; ///< transports managed + std::vector< Capsule > m_Buffers; ///< managed Buffers + const bool m_DebugMode = false; + + std::string GetName( const std::vector<std::string>& arguments ) const; + +}; + + +} //end namespace + +#endif /* ENGINE_H_ */ diff --git a/include/core/Group.h b/include/core/Group.h index b7a968ab23bdc4b67316136b1a3650d8f91db372..ae57a850b7b25c280bd6165fd5db248560f819eb 100644 --- a/include/core/Group.h +++ b/include/core/Group.h @@ -20,7 +20,7 @@ #ifdef HAVE_MPI #include <mpi.h> #else - #include "public/mpidummy.h" + #include "mpidummy.h" #endif diff --git a/include/core/Method.h b/include/core/Method.h new file mode 100644 index 0000000000000000000000000000000000000000..4de9f2a15bc2a501a9c6459f4657c04630622141 --- /dev/null +++ b/include/core/Method.h @@ -0,0 +1,32 @@ +/* + * Method.h + * + * Created on: Dec 16, 2016 + * Author: wfg + */ + +#ifndef METHOD_H_ +#define METHOD_H_ + +#include <vector> +#include <string> + + +namespace adios +{ + +/** + * Serves as metadata to define an engine + */ +struct Method +{ + std::vector< std::string > Capsules; ///< Capsule type + std::map< std::string, std::vector<std::string> > Transports; ///< key: transports, value: arguments to Transport + std::string Group; ///< Associated group name to this engine +}; + + +} //end namespace + + +#endif /* METHOD_H_ */ diff --git a/include/public/Support.h b/include/core/Support.h similarity index 100% rename from include/public/Support.h rename to include/core/Support.h diff --git a/include/core/Transport.h b/include/core/Transport.h index ebe561ee931565a8fb0a01ec5287c91f17c60ac8..86496d15027c3205a186ae9614008e44c5493513 100644 --- a/include/core/Transport.h +++ b/include/core/Transport.h @@ -16,7 +16,7 @@ #ifdef HAVE_MPI #include <mpi.h> #else - #include "public/mpidummy.h" + #include "../mpidummy.h" #endif diff --git a/include/engine/DataMan.h b/include/engine/DataMan.h new file mode 100644 index 0000000000000000000000000000000000000000..ec365e04548847cb735e7114aba5dced5a873df6 --- /dev/null +++ b/include/engine/DataMan.h @@ -0,0 +1,32 @@ +/* + * DataMan.h + * + * Created on: Dec 16, 2016 + * Author: wfg + */ + +#ifndef DATAMAN_H_ +#define DATAMAN_H_ + +#include "core/Engine.h" + + +namespace adios +{ + +class DataMan : public Engine +{ + + + + +}; + + + + +} + + + +#endif /* DATAMAN_H_ */ diff --git a/include/engine/SIRIUS.h b/include/engine/SIRIUS.h new file mode 100644 index 0000000000000000000000000000000000000000..e06d37a25b9788489e20b16adbae47f9b1f92c2d --- /dev/null +++ b/include/engine/SIRIUS.h @@ -0,0 +1,32 @@ +/* + * SIRIUS.h + * + * Created on: Dec 16, 2016 + * Author: wfg + */ + +#ifndef SIRIUS_H_ +#define SIRIUS_H_ + + + +namespace adios +{ + + +class SIRIUS : public Engine +{ + + SIRIUS( ); + + + + +}; + + +} //namespace + + + +#endif /* SIRIUS_H_ */ diff --git a/include/engine/Single.h b/include/engine/Single.h new file mode 100644 index 0000000000000000000000000000000000000000..f8e97046273f651b8f08cc268010075191adac47 --- /dev/null +++ b/include/engine/Single.h @@ -0,0 +1,26 @@ +/* + * Single.h + * + * Created on: Dec 16, 2016 + * Author: wfg + */ + +#ifndef SINGLE_H_ +#define SINGLE_H_ + + + +namespace adios +{ + + + + + + + + +} //end namespace + + +#endif /* SINGLE_H_ */ diff --git a/include/functions/adiosFunctions.h b/include/functions/adiosFunctions.h index 9f67b539053600805ef1621be892e7928d2f91a1..1f1b8f00fcead8b3b45126d318328114ea2c3068 100644 --- a/include/functions/adiosFunctions.h +++ b/include/functions/adiosFunctions.h @@ -18,7 +18,7 @@ #ifdef HAVE_MPI #include <mpi.h> #else - #include "public/mpidummy.h" + #include "mpidummy.h" #endif diff --git a/include/functions/adiosTemplates.h b/include/functions/adiosTemplates.h index 1f1bca18116fafbd7c8532aa4f8ec819615174c2..ae9cc01eac3c585461e1c13992fb9ec4f4415352 100644 --- a/include/functions/adiosTemplates.h +++ b/include/functions/adiosTemplates.h @@ -11,10 +11,11 @@ /// \cond EXCLUDE_FROM_DOXYGEN #include <string> #include <stdexcept> + +#include "../core/Engine.h" /// \endcond -#include "core/Capsule.h" #include "core/Group.h" #include "core/Variable.h" #include "functions/adiosFunctions.h" diff --git a/include/public/mpidummy.h b/include/mpidummy.h similarity index 100% rename from include/public/mpidummy.h rename to include/mpidummy.h diff --git a/src/public/ADIOS.cpp b/src/ADIOS.cpp similarity index 77% rename from src/public/ADIOS.cpp rename to src/ADIOS.cpp index 9afc97ed12dd6b902dcbbbb8f1834232c033568b..e721a4fa9322af1165f5c7d8cac665cc5d1bacee 100644 --- a/src/public/ADIOS.cpp +++ b/src/ADIOS.cpp @@ -3,7 +3,6 @@ * * Created on: Sep 29, 2016 * Author: William F Godoy - * */ /// \cond EXCLUDE_FROM_DOXYGEN @@ -13,7 +12,7 @@ #include <utility> /// \endcond -#include "public/ADIOS.h" +#include "ADIOS.h" #include "functions/adiosFunctions.h" @@ -60,31 +59,59 @@ ADIOS::~ADIOS( ) { } -void ADIOS::SetMaxBufferSize( const std::string streamName, const size_t maxBufferSize ) +void ADIOS::SetCurrentGroup( const unsigned int engineHandler, const std::string groupName ) { - auto itCapsule = m_Capsules.find( streamName ); + auto itEngine = m_Engine if( m_DebugMode == true ) - CheckCapsule( itCapsule, streamName, " from call to SetMaxBufferSize\n" ); + CheckCapsule( itCapsule, streamName, " from call to SetCurrentGroup\n" ); - itCapsule->second.m_MaxBufferSize = maxBufferSize; + itCapsule->second.m_CurrentGroup = groupName; } -void ADIOS::SetCurrentGroup( const std::string streamName, const std::string groupName ) +const unsigned int ADIOS::Open( const std::string streamName, const std::string accessMode, + MPI_Comm mpiComm, const std::string methodName ) { - auto itCapsule = m_Capsules.find( streamName ); if( m_DebugMode == true ) - CheckCapsule( itCapsule, streamName, " from call to SetCurrentGroup\n" ); + { + if( m_EngineNames.count( streamName ) == 1 ) //Engine exists + throw std::invalid_argument( "ERROR: method " + methodName + " already created by Open, in call from Open.\n" ); - itCapsule->second.m_CurrentGroup = groupName; + if( m_Methods.count( methodName ) == 0 ) // + throw std::invalid_argument( "ERROR: method " + methodName + " has not been defined, in call from Open\n" ); + } + + ++m_EngineCounter; + + if( methodName.empty() ) + { + + } + else //special cases + { + if( methodName == "SIRIUS" ) + { + m_Engines[ m_EngineCounter ] = + } + else if( methodName == "DataMan" ) + { + m_Engines[ m_EngineCounter ] = ; + } + } + + return m_EngineCounter; } -void ADIOS::Close( const std::string streamName, const int transportIndex ) //close stream +void ADIOS::Close( const unsigned int methodHandler, const int transportIndex ) //close stream { - auto itCapsule = m_Capsules.find( streamName ); + auto itEngine = m_Engines.find( methodHandler ); if( m_DebugMode == true ) - CheckCapsule( itCapsule, streamName, " from call to Close\n" ); + { + + } + + itEngine itCapsule->second.Close( transportIndex ); } @@ -165,8 +192,7 @@ void ADIOS::CheckGroup( std::map< std::string, Group >::const_iterator itGroup, throw std::invalid_argument( "ERROR: group " + groupName + " not found " + hint + "\n" ); } -void ADIOS::CheckCapsule( std::map< std::string, Capsule >::const_iterator itCapsule, - const std::string streamName, const std::string hint ) const +void ADIOS::CheckCapsule( const std::string streamName, const std::string hint ) const { if( itCapsule == m_Capsules.end() ) throw std::invalid_argument( "ERROR: stream (or file) " + streamName + " not created with Open , " + hint + "\n" ); diff --git a/src/public/ADIOS_C.cpp b/src/ADIOS_C.cpp similarity index 98% rename from src/public/ADIOS_C.cpp rename to src/ADIOS_C.cpp index 399df8346ae0e9da6dd558b77703d866bf9b3d5b..46bfde3cf81e917e21cf8a5bebba4d8e3ddd248b 100644 --- a/src/public/ADIOS_C.cpp +++ b/src/ADIOS_C.cpp @@ -5,13 +5,14 @@ * Author: wfg */ +#include "../../include/ADIOS_C.h" + #include <string> #include <fstream> #include <iostream> #include <cstring> -#include "public/ADIOS_C.h" -#include "public/ADIOS.h" +#include "../../include/ADIOS.h" #ifdef __cplusplus diff --git a/src/core/Capsule.cpp b/src/core/Capsule.cpp index bf0437b4277bbc7f188024ae0bdee667dab30ebb..dbc2a3a985fa3017e999973de7591b7527aec22e 100644 --- a/src/core/Capsule.cpp +++ b/src/core/Capsule.cpp @@ -15,8 +15,8 @@ #include "transform/BZIP2.h" #endif -#include "core/Capsule.h" -#include "public/Support.h" +#include "../../include/core/Engine.h" +#include "../../include/core/Support.h" //transport below #include "transport/POSIX.h" diff --git a/src/core/Group.cpp b/src/core/Group.cpp index b98fe3198fc12b0205b640bf42b78288f6af94be..fecc0c1a71bae99639484dd5ef5f216afcd53282 100644 --- a/src/core/Group.cpp +++ b/src/core/Group.cpp @@ -12,9 +12,10 @@ #include "core/Group.h" + +#include "../../include/core/Support.h" #include "core/Variable.h" #include "functions/adiosFunctions.h" -#include "public/Support.h" namespace adios diff --git a/src/public/Support.cpp b/src/core/Support.cpp similarity index 73% rename from src/public/Support.cpp rename to src/core/Support.cpp index 4cc30fa3acd17066135ffce6455cde4f7378b346..5e213fe16e12dec79d3981be809ca32f3175f9ff 100644 --- a/src/public/Support.cpp +++ b/src/core/Support.cpp @@ -6,7 +6,7 @@ */ -#include "public/Support.h" +#include "../../include/core/Support.h" namespace adios @@ -37,18 +37,18 @@ const std::map<std::string, std::set<std::string> > Support::Datatypes { "char", "std::string", "string", "unsigned char", - "short", "std::vector<short>", "vector<short>", - "unsigned short", "std::vector<unsigned short>", "vector<unsigned short>", - "int", "std::vector<int>", "vector<int>", "integer", - "unsigned int", "std::vector<unsigned int>", "vector<unsigned int>", + "short", + "unsigned short", + "int", "integer", + "unsigned int", "long int", "long", - "unsigned long int", "std::vector<unsigned long int>", "vector<unsigned long int>", "unsigned long", "std::vector<unsigned long>", "vector<unsigned long>", + "unsigned long int", "unsigned long", "long long int", "long long", - "unsigned long long int", "std::vector<unsigned long long int>", "vector<unsigned long long int>", "unsigned long long", "std::vector<unsigned long long>", "vector<unsigned long long>", - "float", "std::vector<float>", "vector<float>", - "float complex", "std::complex<float>", "complex<float>", - "double", "std::vector<double>", "vector<double>", - "long double", "std::vector<long double>", "vector<long double>", + "unsigned long long int", "unsigned long long", + "float", + "float complex", + "double", + "long double", "double complex", "std::complex<double>", "complex<double>" } }, @@ -75,7 +75,7 @@ const std::map<std::string, std::set<std::string> > Support::Datatypes { "character", "integer*2", - "integer", + "integer", "real*2", "real", "real*4", "double precision", "real*8", "complex", diff --git a/src/functions/adiosFunctions.cpp b/src/functions/adiosFunctions.cpp index 1f1e2c120f34e90a7c313407544ff8e2d167fb24..28fd62c18a8a3d72d4ebe73dffcdbc66df2f295a 100644 --- a/src/functions/adiosFunctions.cpp +++ b/src/functions/adiosFunctions.cpp @@ -19,7 +19,8 @@ /// \endcond #include "functions/adiosFunctions.h" -#include "public/Support.h" + +#include "../../include/core/Support.h" #ifdef HAVE_BZIP2 #include "transform/CBZIP2.h" diff --git a/src/public/mpidummy.cpp b/src/mpidummy.cpp similarity index 99% rename from src/public/mpidummy.cpp rename to src/mpidummy.cpp index 76859bcca75139c8cbf9dd79e81f4ade51d8b2b2..6c2bb66f0fa30d7239ebe343984db505c3933214 100644 --- a/src/public/mpidummy.cpp +++ b/src/mpidummy.cpp @@ -19,7 +19,9 @@ #include <unistd.h> /// \endcond -#include "public/mpidummy.h" +#include "mpidummy.h" + + #if defined(__APPLE__) || defined(__WIN32__) || defined(__CYGWIN__) # define lseek64 lseek