From 2a79d8616d28dd8076cc02f8c54adbf1fb9cb2b6 Mon Sep 17 00:00:00 2001 From: wfg <wfg@pc0098504.ornl.gov> Date: Thu, 23 Feb 2017 11:26:51 -0500 Subject: [PATCH] Simplified compilation to libdataman only Other DataMan library dependencies must be in LD_LIBRARY_PATH --- examples/hello/datamanWriter/Makefile | 9 +++++---- include/core/Engine.h | 7 +++++++ include/engine/bp/BPWriter.h | 2 +- include/engine/dataman/DataManReader.h | 2 +- include/engine/dataman/DataManWriter.h | 5 ++++- include/format/BP1Writer.h | 9 --------- src/core/Engine.cpp | 5 +++++ src/engine/bp/BPWriter.cpp | 13 ++++++++++++- src/format/BP1Writer.cpp | 6 ------ 9 files changed, 35 insertions(+), 23 deletions(-) diff --git a/examples/hello/datamanWriter/Makefile b/examples/hello/datamanWriter/Makefile index e915be6bf..195afdfbf 100644 --- a/examples/hello/datamanWriter/Makefile +++ b/examples/hello/datamanWriter/Makefile @@ -20,23 +20,24 @@ INC+= -I$(ADIOS_DIR)/include #DATAMAN DATAMAN_LOC=/home/wfg/Applications/DataMan INC+= -I$(DATAMAN_LOC)/include -LIB+= -L$(DATAMAN_LOC)/lib -lcacheman -lstreamman -lzmqman +LIB+= -L$(DATAMAN_LOC)/lib -ldataman # -lcacheman -lstreamman -lzmqman +LIB_NOMPI+= -L$(DATAMAN_LOC)/lib -ldataman # -lcacheman -lstreamman -lzmqman #COMPILER FLAGS CFLAGS=-Wall -O0 -g -Wpedantic -std=c++11 #SYSTEM LIBS LIB+= -lpthread -LIB_NOMPI+= -lpthread +LIB_NOMPI+= -ldl -lpthread all: mpi nompi mpi: $(ADIOS_LIB) $(ADIOS_HFiles) - $(MPICC) $(CFLAGS) $(INC) -DHAVE_MPI $(BASE_NAME).cpp -o $(BASE_NAME).exe $(LIB) -lpthread + $(MPICC) $(CFLAGS) $(INC) -DHAVE_MPI $(BASE_NAME).cpp -o $(BASE_NAME).exe $(LIB) nompi: $(ADIOS_NOMPI_LIB) $(NoMPI_HFiles) - $(CC) $(CFLAGS) $(INC) $(BASE_NAME)_nompi.cpp -o $(BASE_NAME)_nompi.exe $(LIB_NOMPI) -lpthread + $(CC) $(CFLAGS) $(INC) $(BASE_NAME)_nompi.cpp -o $(BASE_NAME)_nompi.exe $(LIB_NOMPI) clean: rm *.exe; diff --git a/include/core/Engine.h b/include/core/Engine.h index 942cc8ae7..e9c176cde 100644 --- a/include/core/Engine.h +++ b/include/core/Engine.h @@ -233,6 +233,13 @@ protected: bool TransportNamesUniqueness( ) const; ///< checks if transport names are unique among the same types (file I/O) + + /** + * Throws an exception in debug mode if transport index is out of range. + * @param transportIndex must be in the range [ -1 , m_Transports.size()-1 ] + */ + void CheckTransportIndex( const int transportIndex ); + }; diff --git a/include/engine/bp/BPWriter.h b/include/engine/bp/BPWriter.h index 1e603c885..ce99908c6 100644 --- a/include/engine/bp/BPWriter.h +++ b/include/engine/bp/BPWriter.h @@ -110,7 +110,7 @@ private: variable.m_AppValues = values; m_WrittenVariables.insert( variable.m_Name ); - //precalculate new metadata and payload sizes + //pre-calculate new metadata and payload sizes const std::size_t indexSize = m_BP1Writer.GetVariableIndexSize( variable ); const std::size_t payloadSize = variable.PayLoadSize(); //will change if compression is applied //Buffer reallocation, expensive part diff --git a/include/engine/dataman/DataManReader.h b/include/engine/dataman/DataManReader.h index ade638d41..3e4df1802 100644 --- a/include/engine/dataman/DataManReader.h +++ b/include/engine/dataman/DataManReader.h @@ -16,7 +16,7 @@ //supported capsules #include "capsule/heap/STLVector.h" - +#include "DataManager.h" namespace adios { diff --git a/include/engine/dataman/DataManWriter.h b/include/engine/dataman/DataManWriter.h index 81c9fbb87..d6b8851ce 100644 --- a/include/engine/dataman/DataManWriter.h +++ b/include/engine/dataman/DataManWriter.h @@ -18,7 +18,7 @@ #include "capsule/heap/STLVector.h" -#include "DataMan.h" //here comes your DataMan header +#include "DataManager.h" //here comes your DataMan header namespace adios @@ -108,6 +108,9 @@ private: variable.m_AppValues = values; m_WrittenVariables.insert( variable.m_Name ); + DataManager dataManager; + dataManager.add_stream( "0", "0", 1, 1, 1, "0" ); + //This part will go away, this is just to monitor variables per rank std::cout << "I am hooked to the DataMan library\n"; MPI_Barrier( m_MPIComm ); diff --git a/include/format/BP1Writer.h b/include/format/BP1Writer.h index 7509b4fee..32bb42e3e 100644 --- a/include/format/BP1Writer.h +++ b/include/format/BP1Writer.h @@ -541,15 +541,6 @@ private: MemcpyToBuffers( buffers, positions, &value, sizeof(T) ); } - - - /** - * - * @param capsule - * @param transport - */ - void CloseRankFile( Capsule& capsule, Transport& transport ) const; - /** * Flattens the metadata indices into a single metadata buffer in capsule * @param metadataSet diff --git a/src/core/Engine.cpp b/src/core/Engine.cpp index d9765feac..7b74cd94d 100644 --- a/src/core/Engine.cpp +++ b/src/core/Engine.cpp @@ -155,5 +155,10 @@ bool Engine::TransportNamesUniqueness( ) const } +void Engine::CheckTransportIndex( const int transportIndex ) +{ + +} + } //end namespace diff --git a/src/engine/bp/BPWriter.cpp b/src/engine/bp/BPWriter.cpp index e5e53a319..ad6c7de2f 100644 --- a/src/engine/bp/BPWriter.cpp +++ b/src/engine/bp/BPWriter.cpp @@ -167,6 +167,17 @@ void BPWriter::AdvanceStep( ) void BPWriter::Close( const int transportIndex ) { + CheckTransportIndex( transportIndex ); + if( transportIndex == -1 ) + { + for( auto& transport : m_Transports ) //by reference or value or it doesn't matter? + m_BP1Writer.Close( m_MetadataSet, m_Buffer, *transport, m_IsFirstClose ); + } + else + { + m_BP1Writer.Close( m_MetadataSet, m_Buffer, *m_Transports[transportIndex], m_IsFirstClose ); + } + //BP1Writer to update the metadata indices @@ -272,7 +283,7 @@ void BPWriter::WriteProcessGroupIndex( ) m_BP1Writer.WriteProcessGroupIndex( isFortran, name, processID, timeStepName, timeStep, m_Transports, m_Buffer, m_MetadataSet ); - m_BufferVariableCountPosition = m_Buffer.m_DataPosition; //fixed for every PG + m_BufferVariableCountPosition = m_Buffer.m_DataPosition; //fixed for every new PG } diff --git a/src/format/BP1Writer.cpp b/src/format/BP1Writer.cpp index c46161ed0..59eb3a126 100644 --- a/src/format/BP1Writer.cpp +++ b/src/format/BP1Writer.cpp @@ -224,12 +224,6 @@ void BP1Writer::WriteDimensionRecord( std::vector<char*>& buffers, std::vector<s } -void BP1Writer::CloseRankFile( Capsule& capsule, Transport& transport ) const -{ - -} - - void BP1Writer::FlattenMetadata( BP1MetadataSet& metadataSet, Capsule& capsule ) const noexcept { -- GitLab