diff --git a/Makefile b/Makefile index c8d5cfbae64945182ef92a8a4131cba5b082021b..68008292348a38c87574dadc247b8335786713b9 100644 --- a/Makefile +++ b/Makefile @@ -13,8 +13,7 @@ AR:=$(SYS_BIN)/ar MPICC:=$(SYS_BIN)/mpic++ LIBS:= -L$(SYS_LIB) -L$(LOCAL_LIB) -CFLAGS:=-c -Wall -O0 -g -Wpedantic -Woverloaded-virtual -std=c++11 -#CFLAGS:=-c -Wall -O3 -Wpedantic -Woverloaded-virtual -std=c++14 +CFLAGS:=-c -Wall -Wpedantic -Woverloaded-virtual -std=c++11 -O0 -g ARFLAGS:=rcs #ADIOS diff --git a/examples/hello/dataman/Makefile b/examples/hello/dataman/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..88896bd67f4553c5e1e5210179485ba1765fb072 --- /dev/null +++ b/examples/hello/dataman/Makefile @@ -0,0 +1,35 @@ +# Makefile for testing purposes, will build libadios.a +# Created on: Oct 4, 2016 +# Author: wfg + + +BASE_NAME=helloDataMan_OOP + +TOOL_DIR=/usr/bin + +CC=$(TOOL_DIR)/g++ # Compiling with mpicc for now +MPICC=$(TOOL_DIR)/mpic++ +AR=$(TOOL_DIR)/ar + +#ADIOS LOCATION +ADIOS_DIR=../../.. +ADIOS_LIB=$(ADIOS_DIR)/lib/libadios.a +ADIOS_NOMPI_LIB=$(ADIOS_DIR)/lib/libadios_nompi.a + +ADIOS_INCLUDE=-I$(ADIOS_DIR)/include + + +#FLAGS +CFLAGS=-Wall -O0 -g -Wpedantic -std=c++11 + +all: mpi + +mpi: $(ADIOS_LIB) $(ADIOS_HFiles) + $(MPICC) $(CFLAGS) $(ADIOS_INCLUDE) -DHAVE_MPI $(BASE_NAME).cpp -o $(BASE_NAME)_mpi $(ADIOS_LIB) + +nompi: $(ADIOS_NOMPI_LIB) $(NoMPI_HFiles) + $(CC) $(CFLAGS) $(ADIOS_INCLUDE) $(BASE_NAME).cpp -o $(BASE_NAME)_nompi $(ADIOS_NOMPI_LIB) + +clean: + rm *_mpi; rm *_nompi + diff --git a/examples/hello/dataman/helloDataMan.cpp b/examples/hello/dataman/helloDataMan.cpp new file mode 100644 index 0000000000000000000000000000000000000000..43991600c687f83b74c70de224fc95e259b6b115 --- /dev/null +++ b/examples/hello/dataman/helloDataMan.cpp @@ -0,0 +1,93 @@ +/* + * helloADIOSNoXML_OOP.cpp + * + * Created on: Jan 9, 2017 + * Author: wfg + */ + +#include <vector> +#include <iostream> + +#ifdef HAVE_MPI + #include <mpi.h> +#else + #include "mpidummy.h" + using adios::MPI_Init; + using adios::MPI_Comm_rank; + using adios::MPI_Finalize; +#endif + + +#include "ADIOS.h" + + +int main( int argc, char* argv [] ) +{ + MPI_Init( &argc, &argv ); + int rank; + MPI_Comm_rank( MPI_COMM_WORLD, &rank ); + const bool adiosDebug = true; + + //Application variable + std::vector<double> myInts = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + int myIntsSize = 10; + + try + { + //Define group and variables + adios::ADIOS adios( MPI_COMM_WORLD, adiosDebug ); + const std::string groupName( "ints" ); + adios.DeclareGroup( groupName ); + adios.DefineVariable( groupName, "myIntsSize", "int" ); + adios.DefineVariable( groupName, "myInts", "double", "myIntsSize" ); + + //Define method + const std::string methodName( "singleBP" ); + adios.DeclareMethod( methodName, "singleBP" ); + adios.AddCapsule( methodName, "Heap" ); + adios.AddTransport( methodName, "POSIX", "fname=myfile.bp" ); + adios.AddTransport( methodName, "TCP_IP", "fname=myfile.tcp" ); + + //Create engine handler and Write + int handler = adios.Open( "myInts.bp", "w", methodName ); + adios.SetDefaultGroup( handler, groupName ); + + double varDouble = 10.; + adios.Write( handler, "myIntsSize", &varDouble ); + adios.Write( handler, "myInts", &myInts.front() ); + adios.Write( 10, "myInts", &myInts.front() ); + adios.Close( handler ); + } + catch( std::invalid_argument& e ) + { + if( rank == 0 ) + { + std::cout << "Invalid argument exception, STOPPING PROGRAM\n"; + std::cout << e.what() << "\n"; + } + } + catch( std::ios_base::failure& e ) + { + if( rank == 0 ) + { + std::cout << "System exception, STOPPING PROGRAM\n"; + std::cout << e.what() << "\n"; + } + } + catch( std::exception& e ) + { + if( rank == 0 ) + { + std::cout << "Exception, STOPPING PROGRAM\n"; + std::cout << e.what() << "\n"; + } + } + + MPI_Finalize( ); + + return 0; + +} + + + diff --git a/examples/hello/dataman/helloDataMan_OOP.cpp b/examples/hello/dataman/helloDataMan_OOP.cpp new file mode 100644 index 0000000000000000000000000000000000000000..2be3296e767cd15b244f84a65c3b6275a9caea63 --- /dev/null +++ b/examples/hello/dataman/helloDataMan_OOP.cpp @@ -0,0 +1,87 @@ +/* + * helloADIOSNoXML_OOP.cpp + * + * Created on: Jan 9, 2017 + * Author: wfg + */ + +#include <vector> +#include <iostream> + +#ifdef HAVE_MPI + #include <mpi.h> +#else + #include "mpidummy.h" + using adios::MPI_Init; + using adios::MPI_Comm_rank; + using adios::MPI_Finalize; +#endif + + +#include "ADIOS_OOP.h" + + +int main( int argc, char* argv [] ) +{ + MPI_Init( &argc, &argv ); + int rank; + MPI_Comm_rank( MPI_COMM_WORLD, &rank ); + const bool adiosDebug = true; + + //Application variable + std::vector<double> myInts = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + int myIntsSize = static_cast<int>( myInts.size() ); + + try + { + //Define group and variables + adios::Group group( adiosDebug ); + group.DefineVariable( "myIntsSize", "int" ); //define size as scalar + group.DefineVariable( "myInts", "double", "myIntsSize" ); //define variable with associate size + + //Define method + adios::Method method( "DataMan", adiosDebug ); + method.AddCapsule( "Heap" ); + method.AddTransport( "POSIX", "have_metadata_file=0" ); //option to save to file + method.AddTransport( "TCP_IP", "fname=myfile.tcp" ); //here you can add as many options as you want in the format "parameter=value" + + //Create engine and Write + adios::engine::DataMan dataMan( "myMessage", "w", MPI_COMM_WORLD, method, adiosDebug ); + dataMan.SetDefaultGroup( group ); + dataMan.Write( "myIntsSize", &myIntsSize ); //issue hello + dataMan.Write( "myInts", &myInts.front() ); //issue hello + dataMan.Close( ); + } + catch( std::invalid_argument& e ) + { + if( rank == 0 ) + { + std::cout << "Invalid argument exception, STOPPING PROGRAM\n"; + std::cout << e.what() << "\n"; + } + } + catch( std::ios_base::failure& e ) + { + if( rank == 0 ) + { + std::cout << "System exception, STOPPING PROGRAM\n"; + std::cout << e.what() << "\n"; + } + } + catch( std::exception& e ) + { + if( rank == 0 ) + { + std::cout << "Exception, STOPPING PROGRAM\n"; + std::cout << e.what() << "\n"; + } + } + + MPI_Finalize( ); + + return 0; + +} + + + diff --git a/include/ADIOS.h b/include/ADIOS.h index 04c92fda01d6cd48fbe933fe3db6d0a89a288135..60a5247e1e55141bdd4fa35003b062b10be7f6de 100644 --- a/include/ADIOS.h +++ b/include/ADIOS.h @@ -170,7 +170,7 @@ public: // PUBLIC Constructors and Functions define the User Interface with ADIO * @param cores optional parameter for threaded operations * @return handler to created engine */ - const unsigned int Open( const std::string streamName, const std::string accessMode, MPI_Comm mpiComm, + unsigned int Open( const std::string streamName, const std::string accessMode, MPI_Comm mpiComm, const std::string methodName, const unsigned int cores = 1 ); @@ -182,7 +182,7 @@ public: // PUBLIC Constructors and Functions define the User Interface with ADIO * @param cores optional parameter for threaded operations * @return handler to created engine */ - const unsigned int Open( const std::string streamName, const std::string accessMode, const std::string methodName, + unsigned int Open( const std::string streamName, const std::string accessMode, const std::string methodName, const unsigned int cores = 1 ); @@ -307,6 +307,7 @@ private: void CheckGroup( std::map< std::string, Group >::const_iterator itGroup, const std::string groupName, const std::string hint ) const; + /** * @brief Checks for method existence in m_Methods, if failed throws std::invalid_argument exception * @param itMethod m_Methods iterator, usually from find function diff --git a/include/capsule/Heap.h b/include/capsule/Heap.h index d16d04df33b9d3461a7df1cd0603242e99e988f0..8618d0eebd42263f6e0aa3bec21026178f078a3c 100644 --- a/include/capsule/Heap.h +++ b/include/capsule/Heap.h @@ -38,8 +38,8 @@ public: char* GetData( ); char* GetMetadata( ); - const std::size_t GetDataSize( ) const; - const std::size_t GetMetadataSize( ) const; + std::size_t GetDataSize( ) const; + std::size_t GetMetadataSize( ) const; void ResizeData( const std::size_t size ); void ResizeMetadata( const std::size_t size ); diff --git a/include/capsule/ShmSystemV.h b/include/capsule/ShmSystemV.h index c7e1f2c6cfcf4210cb3ba9913d975ddf715a8967..72b7ee85454c8b3905471d720299f2ecdc28a750 100644 --- a/include/capsule/ShmSystemV.h +++ b/include/capsule/ShmSystemV.h @@ -38,8 +38,8 @@ public: char* GetData( ); ///< return the pointer to the raw data buffer char* GetMetadata( ); ///< return the pointer to the raw metadata buffer - const std::size_t GetDataSize( ) const; ///< get current data buffer size - const std::size_t GetMetadataSize( ) const; ///< get current metadata buffer size + std::size_t GetDataSize( ) const; ///< get current data buffer size + std::size_t GetMetadataSize( ) const; ///< get current metadata buffer size void WriteData( const std::size_t first, const char* data, const std::size_t size ); void WriteData( const std::size_t first, const unsigned char* data, const std::size_t size ); diff --git a/include/core/Capsule.h b/include/core/Capsule.h index ac3bf4b4bde2344acf4ad006cd04fe7a7253d3fb..5dc08cf60c4aa6517d2d0764cbf3a8decb519e9a 100644 --- a/include/core/Capsule.h +++ b/include/core/Capsule.h @@ -43,8 +43,8 @@ public: virtual char* GetData( ) = 0; ///< return the pointer to the raw data buffer virtual char* GetMetadata( ) = 0; ///< return the pointer to the raw metadata buffer - virtual const std::size_t GetDataSize( ) const = 0; ///< get current data buffer size - virtual const std::size_t GetMetadataSize( ) const = 0; ///< get current metadata buffer size + virtual std::size_t GetDataSize( ) const = 0; ///< get current data buffer size + virtual std::size_t GetMetadataSize( ) const = 0; ///< get current metadata buffer size virtual void ResizeData( const std::size_t size ); ///< resize data buffer virtual void ResizeMetadata( const std::size_t size ); ///< resize metadata buffer diff --git a/include/core/Engine.h b/include/core/Engine.h index 208736cbae5146809e7811b13339ed0e5e724290..e91c979cc53e1e33187bd61c21b41ab7207698e5 100644 --- a/include/core/Engine.h +++ b/include/core/Engine.h @@ -95,6 +95,14 @@ public: virtual void Write( Group& group, const std::string variableName, const double* values ) = 0; virtual void Write( Group& group, const std::string variableName, const long double* values ) = 0; + /** + * @brief Write functions can be overridden by derived classes. Base class behavior is to: + * 1) Write to Variable values (m_Values) using the pointer to default group *m_Group set with SetDefaultGroup function + * 2) Transform the data + * 3) Write to all capsules -> data and metadata + * @param variableName + * @param values coming from user app + */ virtual void Write( const std::string variableName, const char* values ) = 0; virtual void Write( const std::string variableName, const unsigned char* values ) = 0; virtual void Write( const std::string variableName, const short* values ) = 0; diff --git a/include/core/Group.h b/include/core/Group.h index 72b27220f4f856addb42c2ca00747e9cc18852fb..006698e8c13d4aabb314a1050e3971091ed07c85 100644 --- a/include/core/Group.h +++ b/include/core/Group.h @@ -161,7 +161,7 @@ private: * @param globalOffsetsCSV comma separated variables defining global offsets (e.g. "oNx,oNY,oNz") * @return -1 if not global --> both inputs are empty, otherwise index in m_GlobalBounds if exist or create a new element in m_GlobalBounds; */ - const int SetGlobalBounds( const std::string globalDimensionsCSV, const std::string globalOffsetsCSV ) noexcept; + int SetGlobalBounds( const std::string globalDimensionsCSV, const std::string globalOffsetsCSV ) noexcept; /** @@ -171,7 +171,7 @@ private: * @param variableName variable to be searched in m_SetVariables * @return variable value */ - const unsigned long long int GetIntVariableValue( const std::string variableName ) const; + unsigned long long int GetIntVariableValue( const std::string variableName ) const; }; diff --git a/include/engine/DataMan.h b/include/engine/DataMan.h new file mode 100644 index 0000000000000000000000000000000000000000..ddbd91b3f7b52dababf079e546f8cd18f4d515e1 --- /dev/null +++ b/include/engine/DataMan.h @@ -0,0 +1,83 @@ +/* + * DataMan.h + * + * Created on: Jan 10, 2017 + * Author: wfg + */ + +#ifndef DATAMAN_H_ +#define DATAMAN_H_ + + +#include "core/Engine.h" + + +namespace adios +{ +namespace engine +{ + + +class DataMan : public Engine +{ + +public: + + /** + * Constructor for single BP capsule engine, writes in BP format into a single heap capsule + * @param name unique name given to the engine + * @param accessMode + * @param mpiComm + * @param method + * @param debugMode + */ + DataMan( const std::string name, const std::string accessMode, MPI_Comm mpiComm, + const Method& method, const bool debugMode = false, const unsigned int cores = 1 ); + + ~DataMan( ); + + void Write( Group& group, const std::string variableName, const char* values ); + void Write( Group& group, const std::string variableName, const unsigned char* values ); + void Write( Group& group, const std::string variableName, const short* values ); + void Write( Group& group, const std::string variableName, const unsigned short* values ); + void Write( Group& group, const std::string variableName, const int* values ); + void Write( Group& group, const std::string variableName, const unsigned int* values ); + void Write( Group& group, const std::string variableName, const long int* values ); + void Write( Group& group, const std::string variableName, const unsigned long int* values ); + void Write( Group& group, const std::string variableName, const long long int* values ); + void Write( Group& group, const std::string variableName, const unsigned long long int* values ); + void Write( Group& group, const std::string variableName, const float* values ); + void Write( Group& group, const std::string variableName, const double* values ); + void Write( Group& group, const std::string variableName, const long double* values ); + + void Write( const std::string variableName, const char* values ); + void Write( const std::string variableName, const unsigned char* values ); + void Write( const std::string variableName, const short* values ); + void Write( const std::string variableName, const unsigned short* values ); + void Write( const std::string variableName, const int* values ); + void Write( const std::string variableName, const unsigned int* values ); + void Write( const std::string variableName, const long int* values ); + void Write( const std::string variableName, const unsigned long int* values ); + void Write( const std::string variableName, const long long int* values ); + void Write( const std::string variableName, const unsigned long long int* values ); + void Write( const std::string variableName, const float* values ); + void Write( const std::string variableName, const double* values ); + void Write( const std::string variableName, const long double* values ); + +private: + + void Init( ); + void InitCapsules( ); + void InitTransports( ); + +}; + + +} //end namespace engine +} //end namespace adios + + + + + +#endif /* DATAMAN_H_ */ diff --git a/include/engine/SingleBP.h b/include/engine/SingleBP.h index 52706956bca335eebd50ebb66098ddf7bfd57dc8..346978149e1c9f95548e5452f7410bd8e891f53b 100644 --- a/include/engine/SingleBP.h +++ b/include/engine/SingleBP.h @@ -72,11 +72,6 @@ private: }; - - - - - } //end namespace engine } //end namespace adios diff --git a/src/ADIOS.cpp b/src/ADIOS.cpp index 8b650933cfdcdafaef4080c2e4488ae17edc2a15..fd25ef8dfe0027bdf4364e4eecf2070b3339128a 100644 --- a/src/ADIOS.cpp +++ b/src/ADIOS.cpp @@ -99,8 +99,8 @@ void ADIOS::DeclareMethod( const std::string methodName, const std::string type } -const unsigned int ADIOS::Open( const std::string name, const std::string accessMode, - MPI_Comm mpiComm, const std::string methodName, const unsigned int cores ) +unsigned int ADIOS::Open( const std::string name, const std::string accessMode, + MPI_Comm mpiComm, const std::string methodName, const unsigned int cores ) { auto itMethod = m_Methods.find( methodName ); @@ -137,8 +137,8 @@ const unsigned int ADIOS::Open( const std::string name, const std::string access } -const unsigned int ADIOS::Open( const std::string streamName, const std::string accessMode, const std::string methodName, - const unsigned int cores ) +unsigned int ADIOS::Open( const std::string streamName, const std::string accessMode, const std::string methodName, + const unsigned int cores ) { return Open( streamName, accessMode, m_MPIComm, methodName, cores ); } diff --git a/src/capsule/Heap.cpp b/src/capsule/Heap.cpp index 7706601adc400ead3f8af5af82cb4d2b4cd14ab1..d9ebaefaf3fdae69cb5bf9b989664c52fb50ee64 100644 --- a/src/capsule/Heap.cpp +++ b/src/capsule/Heap.cpp @@ -38,13 +38,13 @@ char* Heap::GetMetadata( ) } -const std::size_t Heap::GetDataSize( ) const +std::size_t Heap::GetDataSize( ) const { return m_Data.size( ); } -const std::size_t Heap::GetMetadataSize( ) const +std::size_t Heap::GetMetadataSize( ) const { return m_Metadata.size(); } diff --git a/src/capsule/ShmSystemV.cpp b/src/capsule/ShmSystemV.cpp index 0ed5cef2b60c0ed250148142e1c40cf7051505ed..87d515173e2b52085155a4806341162929d6b6cc 100644 --- a/src/capsule/ShmSystemV.cpp +++ b/src/capsule/ShmSystemV.cpp @@ -58,13 +58,13 @@ char* ShmSystemV::GetMetadata( ) } -const std::size_t ShmSystemV::GetDataSize( ) const +std::size_t ShmSystemV::GetDataSize( ) const { return m_DataSize; } -const std::size_t ShmSystemV::GetMetadataSize( ) const +std::size_t ShmSystemV::GetMetadataSize( ) const { return m_MetadataSize; } diff --git a/src/core/Engine.cpp b/src/core/Engine.cpp index 90d5cd98c9524170d4b74f81b4181d3ce3b32290..3f1dfc30f2c415d717d800f61d863c1c2735e45c 100644 --- a/src/core/Engine.cpp +++ b/src/core/Engine.cpp @@ -40,6 +40,7 @@ void Engine::SetDefaultGroup( Group& group ) m_Group = &group; } + //PROTECTED const unsigned int Engine::PreSetVariable( Group& group, const std::string variableName, const std::set<std::string>& types, diff --git a/src/core/Group.cpp b/src/core/Group.cpp index 21164d62273d288190af31970d83720ace85f17a..efce46fd9c90d17ee67e15fe6e6d9a9e8f0cb5f5 100644 --- a/src/core/Group.cpp +++ b/src/core/Group.cpp @@ -239,7 +239,7 @@ void Group::DefineAttribute( const std::string attributeName, const std::string } -const unsigned long long int Group::GetIntVariableValue( const std::string variableName ) const +unsigned long long int Group::GetIntVariableValue( const std::string variableName ) const { if( m_DebugMode == true ) { @@ -428,7 +428,7 @@ void Group::ParseXMLGroup( const std::string& xmlGroup, std::vector< std::shared } -const int Group::SetGlobalBounds( const std::string globalDimensionsCSV, const std::string globalOffsetsCSV ) noexcept +int Group::SetGlobalBounds( const std::string globalDimensionsCSV, const std::string globalOffsetsCSV ) noexcept { if( globalDimensionsCSV.empty() || globalOffsetsCSV.empty() ) return -1; diff --git a/src/engine/DataMan.cpp b/src/engine/DataMan.cpp new file mode 100644 index 0000000000000000000000000000000000000000..a9a68cf2ba05c5ab9370b294ee0be5464b7f6372 --- /dev/null +++ b/src/engine/DataMan.cpp @@ -0,0 +1,280 @@ +/* + * DataMan.cpp + * + * Created on: Jan 10, 2017 + * Author: wfg + */ + +#include <iostream> + +#include "engine/DataMan.h" +#include "core/Support.h" + +//supported capsules +#include "capsule/Heap.h" + +//supported transports +#include "transport/POSIX.h" +#include "transport/FStream.h" +#include "transport/File.h" + + +namespace adios +{ +namespace engine +{ + +DataMan::DataMan( const std::string streamName, const std::string accessMode, const MPI_Comm mpiComm, + const Method& method, const bool debugMode, const unsigned int cores ): + Engine( "SingleBP", streamName, accessMode, mpiComm, method, debugMode, cores, " SingleBP constructor (or call to ADIOS Open).\n" ) +{ + Init( ); +} + + +DataMan::~DataMan( ) +{ } + + +void DataMan::Init( ) +{ + InitCapsules( ); + InitTransports( ); +} + + +void DataMan::Write( Group& group, const std::string variableName, const char* values ) +{ + +} + +void DataMan::Write( Group& group, const std::string variableName, const unsigned char* values ) +{ + +} + +void DataMan::Write( Group& group, const std::string variableName, const short* values ) +{ + +} + +void DataMan::Write( Group& group, const std::string variableName, const unsigned short* values ) +{ + +} + +void DataMan::Write( Group& group, const std::string variableName, const int* values ) +{ + +} + +void DataMan::Write( Group& group, const std::string variableName, const unsigned int* values ) +{ + +} + +void DataMan::Write( Group& group, const std::string variableName, const long int* values ) +{ + +} + +void DataMan::Write( Group& group, const std::string variableName, const unsigned long int* values ) +{ + +} + +void DataMan::Write( Group& group, const std::string variableName, const long long int* values ) +{ + +} + +void DataMan::Write( Group& group, const std::string variableName, const unsigned long long int* values ) +{ + +} + +void DataMan::Write( Group& group, const std::string variableName, const float* values ) +{ + +} + +void DataMan::Write( Group& group, const std::string variableName, const double* values ) +{ + +} + + +void DataMan::Write( Group& group, const std::string variableName, const long double* values ) +{ + +} + + +void DataMan::Write( const std::string variableName, const char* values ) +{ + +} + +void DataMan::Write( const std::string variableName, const unsigned char* values ) +{ + +} + +void DataMan::Write( const std::string variableName, const short* values ) +{ + +} + +void DataMan::Write( const std::string variableName, const unsigned short* values ) +{ + +} + +void DataMan::Write( const std::string variableName, const int* values ) +{ + auto index = PreSetVariable( *m_Group, variableName, Support::DatatypesAliases.at("int"), " from call to Write int*" ); + std::cout << "Hello from DataMan Write integer with index " << index << "\n"; + +} + +void DataMan::Write( const std::string variableName, const unsigned int* values ) +{ + +} + +void DataMan::Write( const std::string variableName, const long int* values ) +{ + +} + +void DataMan::Write( const std::string variableName, const unsigned long int* values ) +{ + +} + +void DataMan::Write( const std::string variableName, const long long int* values ) +{ + +} + +void DataMan::Write( const std::string variableName, const unsigned long long int* values ) +{ + +} + +void DataMan::Write( const std::string variableName, const float* values ) +{ + +} + +void DataMan::Write( const std::string variableName, const double* values ) +{ + auto index = PreSetVariable( *m_Group, variableName, Support::DatatypesAliases.at("double"), " from call to Write double*" ); + std::cout << "Hello from Data Write double with index " << index << "\n"; +} + + +void DataMan::Write( const std::string variableName, const long double* values ) +{ + +} + + +void DataMan::InitCapsules( ) +{ + if( m_DebugMode == true ) + { + if( m_Method.m_CapsuleParameters.size() > 1 ) + { + throw std::invalid_argument( "ERROR: SingleBP engine only allows one heap buffer, in " + m_Name + + m_EndMessage ); + } + else if( m_Method.m_CapsuleParameters.size() == 1 ) + { + auto itType = m_Method.m_CapsuleParameters[0].find( "buffer" ); + + if( m_DebugMode == true ) + CheckParameter( itType, m_Method.m_CapsuleParameters[0], " capsule buffer", + ", in " + m_Name + m_EndMessage ); + + if( !( itType->second == "Heap" || itType->second == "HEAP" ) ) + throw std::invalid_argument( "ERROR: SingleBP doesn't support Capsule of buffer type " + + itType->second + " in " + m_Name + m_EndMessage ); + } + } + //Create single capsule of type heap + m_Capsules.push_back( std::make_shared<Heap>( m_AccessMode, m_RankMPI, m_Cores ) ); +} + + + +void DataMan::InitTransports( ) +{ + std::set< std::string > transportStreamNames; //used to check for name conflict between transports + + const unsigned int transportsSize = m_Method.m_TransportParameters.size(); + + for( const auto& parameters : m_Method.m_TransportParameters ) + { + auto itTransport = parameters.find( "transport" ); + if( m_DebugMode == true ) + CheckParameter( itTransport, parameters, "transport", ", in " + m_Name + m_EndMessage ); + + + if( itTransport->second == "POSIX" ) + { + m_Transports.push_back( std::make_shared<POSIX>( m_MPIComm, m_DebugMode ) ); + } + else if( itTransport->second == "File" ) + { + m_Transports.push_back( std::make_shared<File>( m_MPIComm, m_DebugMode ) ); + } + else if( itTransport->second == "FStream" ) + { + m_Transports.push_back( std::make_shared<FStream>( m_MPIComm, m_DebugMode ) ); + } + else if( itTransport->second == "MPIFile" ) + { + //m_Transports.push_back( std::make_shared<MPIFile>( m_MPIComm, m_DebugMode ) ); not yet supported + } + else + { + if( m_DebugMode == true ) + throw std::invalid_argument( "ERROR: transport + " + itTransport->second + " not supported, in " + + m_Name + m_EndMessage ); + } + //name + if( transportsSize > 1 ) + { + auto itName = parameters.find( "name" ); //first check name + + if( m_DebugMode == true ) + CheckParameter( itName, parameters, "name", " in transport " + itTransport->second + + ", in " + m_Name + m_EndMessage ); + + m_Transports.back()->Open( itName->second, m_AccessMode ); + } + else if( transportsSize == 1 ) + { + auto itName = parameters.find( "name" ); + + if( itName == parameters.end() ) //take streamName + m_Transports.back()->Open( m_Name, m_AccessMode ); + else + m_Transports.back()->Open( m_Name, m_AccessMode ); + + } + else if( transportsSize == 0 ) + { + if( m_DebugMode == true ) + throw std::invalid_argument( "ERROR: transport not defined for engine " + m_Name + m_EndMessage ); + } + } +} + + +} //end namespace engine +} //end namespace adios + + + diff --git a/src/mpidummy.cpp b/src/mpidummy.cpp index 6c2bb66f0fa30d7239ebe343984db505c3933214..3a3de22a26c738e462d9acb3fb3b33fb835479c2 100644 --- a/src/mpidummy.cpp +++ b/src/mpidummy.cpp @@ -197,7 +197,7 @@ int MPI_File_read(MPI_File fh, void *buf, int count, MPI_Datatype datatype, MPI_ uint64_t bytes_read; bytes_read = read (fh, buf, bytes_to_read); if (bytes_read != bytes_to_read) { - snprintf(mpierrmsg, MPI_MAX_ERROR_STRING, "could not read %" PRIu64 " bytes. read only: %" PRIu64 "\n", bytes_to_read, bytes_read); + snprintf(mpierrmsg, MPI_MAX_ERROR_STRING, "could not read %lu bytes. read only: %lu \n", bytes_to_read, bytes_read); return -2; } *status = bytes_read;