Skip to content
Snippets Groups Projects
Commit 884a63d6 authored by pnorbert's avatar pnorbert Committed by GitHub
Browse files

Merge pull request #55 from pnorbert/adios1

Method.SetIOMode();  updates to ADIOS1Reader to make code base compile
parents 85c3847f 7cb77820
No related branches found
No related tags found
No related merge requests found
...@@ -31,7 +31,7 @@ int main(int argc, char *argv[]) ...@@ -31,7 +31,7 @@ int main(int argc, char *argv[])
// Global class/object that serves for init, finalize and provides ADIOS // Global class/object that serves for init, finalize and provides ADIOS
// functions // functions
adios::ADIOS adios("config.xml", comm, /*verbose=*/adios::INFO, adios::ADIOS adios("config.xml", comm, /*verbose=*/adios::Verbose::INFO,
/*debugflag=*/false); /*debugflag=*/false);
/************* /*************
...@@ -83,8 +83,8 @@ int main(int argc, char *argv[]) ...@@ -83,8 +83,8 @@ int main(int argc, char *argv[])
"Ragged", adios::Dims{nproc, adios::VARYING_DIMENSION}); // ragged array "Ragged", adios::Dims{nproc, adios::VARYING_DIMENSION}); // ragged array
// add transform to variable // add transform to variable
adios::Transform zfp = adios::transform::ZFP(); adios::Transform compress = adios::transform::BZip2();
var2D.AddTransform(zfp, "accuracy=0.001"); var2D.AddTransform(compress, "level=5");
// open...write.write.write...advance...write.write.write...advance... // open...write.write.write...advance...write.write.write...advance...
// ...close cycle // ...close cycle
...@@ -120,7 +120,7 @@ int main(int argc, char *argv[]) ...@@ -120,7 +120,7 @@ int main(int argc, char *argv[])
// write and // write and
// its offsets in the global spaces. This could have been done in // its offsets in the global spaces. This could have been done in
// adios.DefineVariable() // adios.DefineVariable()
adios::Selection sel = adios.SelectionBoundingBox( adios::SelectionBoundingBox sel = adios::SelectionBoundingBox(
{1, NX}, {rank, NX}); // local dims and offsets; both as list {1, NX}, {rank, NX}); // local dims and offsets; both as list
var2D.SetSelection( var2D.SetSelection(
sel); // Shall we call it SetSpaceSelection, SetOutputSelection? sel); // Shall we call it SetSpaceSelection, SetOutputSelection?
...@@ -135,7 +135,7 @@ int main(int argc, char *argv[]) ...@@ -135,7 +135,7 @@ int main(int argc, char *argv[])
// Size of the bounding box should match the // Size of the bounding box should match the
// "space" selection which was given above. Default memspace is the full // "space" selection which was given above. Default memspace is the full
// selection. // selection.
adios::Selection memspace = adios.SelectionBoundingBox( adios::SelectionBoundingBox memspace = adios::SelectionBoundingBox(
{1, NX}, {0, 1}); // local dims and offsets; both as list {1, NX}, {0, 1}); // local dims and offsets; both as list
var2D.SetMemorySelection(memspace); var2D.SetMemorySelection(memspace);
...@@ -226,10 +226,10 @@ int main(int argc, char *argv[]) ...@@ -226,10 +226,10 @@ int main(int argc, char *argv[])
// we // we
// READ and // READ and
// its offsets in the global spaces // its offsets in the global spaces
adios::Selection bbsel = adios.SelectionBoundingBox( adios::SelectionBoundingBox bbsel = adios::SelectionBoundingBox(
{1, NX}, {0, 0}); // local dims and offsets; both as list {1, NX}, {0, 0}); // local dims and offsets; both as list
var2D.SetSelection(bbsel); var2D.SetSelection(bbsel);
adios::Selection memspace = adios.SelectionBoundingBox( adios::SelectionBoundingBox memspace = adios::SelectionBoundingBox(
{1, NX}, {0, 1}); // local dims and offsets; both as list {1, NX}, {0, 1}); // local dims and offsets; both as list
var2D.SetMemorySelection(memspace); var2D.SetMemorySelection(memspace);
reader->Read<double>(var2D, *Temperature); reader->Read<double>(var2D, *Temperature);
...@@ -292,9 +292,9 @@ int main(int argc, char *argv[]) ...@@ -292,9 +292,9 @@ int main(int argc, char *argv[])
// we // we
// READ and // READ and
// its offsets in the global spaces if we know this somehow // its offsets in the global spaces if we know this somehow
adios::Selection bbsel = adios.SelectionBoundingBox( adios::SelectionBoundingBox bbsel = adios::SelectionBoundingBox(
{1, NX}, {0, 0}); // local dims and offsets; both as list {1, NX}, {0, 0}); // local dims and offsets; both as list
var2D->SetSelection(bbsel); var2D.SetSelection(bbsel);
reader->Read<double>(var2D, *Temperature); reader->Read<double>(var2D, *Temperature);
// Let ADIOS allocate space for the incoming (per-writer) item // Let ADIOS allocate space for the incoming (per-writer) item
...@@ -399,7 +399,7 @@ int main(int argc, char *argv[]) ...@@ -399,7 +399,7 @@ int main(int argc, char *argv[])
// Open a file with all steps immediately available // Open a file with all steps immediately available
std::shared_ptr<adios::Engine> reader = adios.OpenFileReader( std::shared_ptr<adios::Engine> reader = adios.OpenFileReader(
"filename.bp", comm, rmethod, adios::COLLECTIVE_IO); "filename.bp", comm, rmethod, adios::IOMode::COLLECTIVE);
/* NX */ /* NX */
/* There is a single value for each step. We can read all into a 1D /* There is a single value for each step. We can read all into a 1D
......
/*
* Distributed under the OSI-approved Apache License, Version 2.0. See
* accompanying file Copyright.txt for details.
*
* IO_ADIOS2.cpp
*
* Created on: Feb 2017
* Author: Norbert Podhorszki
*/
#include "IO.h"
#include "ADIOS_CPP.h"
#include <string>
static int rank_saved;
adios::ADIOS *ad = nullptr;
std::shared_ptr<adios::Engine> bpWriter;
adios::Variable<double> *varT = nullptr;
IO::IO(const Settings &s, MPI_Comm comm)
{
rank_saved = s.rank;
m_outputfilename = s.outputfile + ".bp";
ad = new adios::ADIOS("adios2.xml", comm, adios::Verbose::INFO);
// Define method for engine creation
// 1. Get method def from config file or define new one
adios::Method &bpWriterSettings = ad->DeclareMethod("output");
if (!bpWriterSettings.IsUserDefined())
{
// if not defined by user, we can change the default settings
bpWriterSettings.SetEngine("BP"); // BP is the default engine
bpWriterSettings.AllowThreads(
1); // allow 1 extra thread for data processing
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(
"Aggregation",
std::to_string((s.nproc + 1) / 2)); // number of aggregators
}
// define T as 2D global array
varT = &ad->DefineVariable<double>(
"T", {s.gndx, s.gndy}, // Global dimensions
{s.ndx,
s.ndy}, // local size, could be defined later using SetSelection()
{s.offsx, s.offsy} // offset of the local array in the global space
);
// add transform to variable
// adios::Transform tr = adios::transform::BZIP2( );
// varT.AddTransform( tr, "" );
// varT.AddTransform( tr,"accuracy=0.001" ); // for ZFP
bpWriter = ad->Open(m_outputfilename, "w", comm, bpWriterSettings);
// ad->Open(m_outputfilename, "w", comm, bpWriterSettings);
if (bpWriter == nullptr)
throw std::ios_base::failure("ERROR: failed to open ADIOS bpWriter\n");
}
IO::~IO()
{
bpWriter->Close();
delete ad;
}
void /*IO::*/ old_style_write(int step, const HeatTransfer &ht,
const Settings &s, MPI_Comm comm)
{
bpWriter->Write<double>(*varT, ht.data_noghost().data());
bpWriter->Advance();
}
void IO::write(int step, const HeatTransfer &ht, const Settings &s,
MPI_Comm comm)
{
/* This selection is redundant and not required, since we defined
* the selection already in DefineVariable(). It is here just as an example.
*/
// Make a selection to describe the local dimensions of the variable we
// write
// and
// its offsets in the global spaces. This could have been done in
// adios.DefineVariable()
adios::Selection sel = adios.SelectionBoundingBox(
{s.ndx, s.ndy},
{s.offsx, s.offsy}); // local dims and offsets; both as list
var2D.SetSelection(sel);
/* Select the area that we want to write from the data pointer we pass to
the
writer.
Think HDF5 memspace, just not hyperslabs, only a bounding box selection.
Engine will copy this bounding box from the data pointer into the output
buffer.
Size of the bounding box should match the "space" selection which was
given
above.
Default memspace is always the full selection.
*/
adios::Selection memspace =
adios.SelectionBoundingBox({s.ndx, s.ndy}, {1, 1});
var2D.SetMemorySelection(memspace);
bpWriter->Write<double>(*varT, ht.data());
bpWriter->Advance();
}
...@@ -31,12 +31,13 @@ IO::IO(const Settings &s, MPI_Comm comm) ...@@ -31,12 +31,13 @@ IO::IO(const Settings &s, MPI_Comm comm)
if (!bpWriterSettings.IsUserDefined()) if (!bpWriterSettings.IsUserDefined())
{ {
// if not defined by user, we can change the default settings // if not defined by user, we can change the default settings
bpWriterSettings.SetEngine("BPFileWriter"); // BP is the default engine // BPFileWriter is the default engine
bpWriterSettings.AllowThreads(1); // for data processing bpWriterSettings.SetEngine("BPFileWriter");
// Allow an extra thread for data processing
bpWriterSettings.AddTransport( bpWriterSettings.AllowThreads(1);
"File", "lucky=yes"); // ISO-POSIX file is the default transport // ISO-POSIX file is the default transport
// Passing parameters to the transport // Passing parameters to the transport
bpWriterSettings.AddTransport("File", "lucky=yes");
const std::string aggregatorsParam("Aggregators=" + const std::string aggregatorsParam("Aggregators=" +
std::to_string((s.nproc + 1) / 2)); std::to_string((s.nproc + 1) / 2));
......
...@@ -64,10 +64,10 @@ int main(int argc, char *argv[]) ...@@ -64,10 +64,10 @@ int main(int argc, char *argv[])
// Define method for engine creation, it is basically straight-forward // Define method for engine creation, it is basically straight-forward
// parameters // parameters
adios::Method &bpWriterSettings = adios.DeclareMethod( adios::Method &bpWriterSettings = adios.DeclareMethod("hello");
"SingleFile"); // default method type is BPWriter
bpWriterSettings.SetEngine("ADIOS1Writer"); bpWriterSettings.SetEngine("ADIOS1Writer");
bpWriterSettings.SetParameters("profile_units=mus"); bpWriterSettings.SetParameters("profile_units=mus");
bpWriterSettings.SetIOMode(adios::IOMode::COLLECTIVE);
bpWriterSettings.AddTransport( bpWriterSettings.AddTransport(
"File", "profile_units=mus", "File", "profile_units=mus",
"have_metadata_file=no"); // uses default POSIX library "have_metadata_file=no"); // uses default POSIX library
...@@ -75,8 +75,7 @@ int main(int argc, char *argv[]) ...@@ -75,8 +75,7 @@ int main(int argc, char *argv[])
// Create engine smart pointer due to polymorphism, // Create engine smart pointer due to polymorphism,
// Open returns a smart pointer to Engine containing the Derived class // Open returns a smart pointer to Engine containing the Derived class
// Writer // Writer
auto bpWriter = adios.Open("myDoubles.bp", "w", bpWriterSettings, auto bpWriter = adios.Open("myDoubles.bp", "w", bpWriterSettings);
adios::IOMode::COLLECTIVE);
if (bpWriter == nullptr) if (bpWriter == nullptr)
throw std::ios_base::failure( throw std::ios_base::failure(
......
...@@ -42,8 +42,8 @@ int main(int argc, char *argv[]) ...@@ -42,8 +42,8 @@ int main(int argc, char *argv[])
// Define method for engine creation, it is basically straight-forward // Define method for engine creation, it is basically straight-forward
// parameters // parameters
adios::Method &bpWriterSettings = adios.DeclareMethod( adios::Method &bpWriterSettings = adios.DeclareMethod("hello");
"SinglePOSIXFile"); // default method type is Writer bpWriterSettings.SetIOMode(adios::IOMode::COLLECTIVE);
bpWriterSettings.SetParameters("profile_units=mus"); bpWriterSettings.SetParameters("profile_units=mus");
bpWriterSettings.AddTransport("File", "have_metadata_file=yes", bpWriterSettings.AddTransport("File", "have_metadata_file=yes",
"profile_units=mus"); "profile_units=mus");
...@@ -52,8 +52,7 @@ int main(int argc, char *argv[]) ...@@ -52,8 +52,7 @@ int main(int argc, char *argv[])
// Open returns a smart pointer to Engine containing the Derived class // Open returns a smart pointer to Engine containing the Derived class
// Writer // Writer
auto bpFileWriter = auto bpFileWriter =
adios.Open("myDoubles_nompi.bp", "w", bpWriterSettings, adios.Open("myDoubles_nompi.bp", "w", bpWriterSettings);
adios::IOMode::COLLECTIVE);
if (bpFileWriter == nullptr) if (bpFileWriter == nullptr)
throw std::ios_base::failure( throw std::ios_base::failure(
......
...@@ -48,7 +48,6 @@ public: ...@@ -48,7 +48,6 @@ public:
/// unsafe /// unsafe
std::string m_Type; ///< Method's engine type std::string m_Type; ///< Method's engine type
unsigned int m_nThreads = 1; unsigned int m_nThreads = 1;
adios::IOMode m_IOMode = adios::IOMode::INDEPENDENT;
std::map<std::string, std::string> m_Parameters; ///< method parameters std::map<std::string, std::string> m_Parameters; ///< method parameters
std::vector<std::map<std::string, std::string>> std::vector<std::map<std::string, std::string>>
...@@ -78,6 +77,12 @@ public: ...@@ -78,6 +77,12 @@ public:
*/ */
void SetEngine(const std::string type); void SetEngine(const std::string type);
/**
* Set the IO mode (collective or independent)
* @param IO mode
*/
void SetIOMode(const IOMode mode);
/** /**
* Set how many threads the engine can use for its operations (e.g. file io, * Set how many threads the engine can use for its operations (e.g. file io,
* compression, staging). * compression, staging).
...@@ -135,6 +140,7 @@ public: ...@@ -135,6 +140,7 @@ public:
private: private:
Verbose m_Verbose = Verbose::WARN; Verbose m_Verbose = Verbose::WARN;
adios::IOMode m_IOMode = adios::IOMode::INDEPENDENT;
void AddTransportParameters(const std::string type, void AddTransportParameters(const std::string type,
const std::vector<std::string> &parameters); const std::vector<std::string> &parameters);
......
...@@ -101,6 +101,8 @@ public: ...@@ -101,6 +101,8 @@ public:
private: private:
void Init(); ///< called from constructor, gets the selected ADIOS1 void Init(); ///< called from constructor, gets the selected ADIOS1
/// transport method from settings /// transport method from settings
void InitParameters();
void InitTransports();
template <class T> template <class T>
Variable<T> *InquireVariableCommon(const std::string &name, Variable<T> *InquireVariableCommon(const std::string &name,
......
...@@ -29,6 +29,7 @@ bool Method::IsUserDefined() ...@@ -29,6 +29,7 @@ bool Method::IsUserDefined()
} }
void Method::SetEngine(const std::string type) { m_Type = type; } void Method::SetEngine(const std::string type) { m_Type = type; }
void Method::SetIOMode(const IOMode mode) { m_IOMode = mode; };
void Method::AllowThreads(const unsigned int nThreads) void Method::AllowThreads(const unsigned int nThreads)
{ {
......
...@@ -2,14 +2,14 @@ ...@@ -2,14 +2,14 @@
* Distributed under the OSI-approved Apache License, Version 2.0. See * Distributed under the OSI-approved Apache License, Version 2.0. See
* accompanying file Copyright.txt for details. * accompanying file Copyright.txt for details.
* *
* BPFileReader.cpp * ADIOS1Reader.cpp
* *
* Created on: Feb 27, 2017 * Created on: Feb 27, 2017
* Author: wfg * Author: wfg
*/ */
#include "engine/adios1/ADIOS1Reader.h"
#include "core/Support.h" #include "core/Support.h"
#include "engine/bp/BPFileReader.h"
#include "functions/adiosFunctions.h" // CSVToVector #include "functions/adiosFunctions.h" // CSVToVector
#include "transport/file/FStream.h" // uses C++ fstream #include "transport/file/FStream.h" // uses C++ fstream
#include "transport/file/FileDescriptor.h" // uses POSIX #include "transport/file/FileDescriptor.h" // uses POSIX
...@@ -21,127 +21,128 @@ namespace adios ...@@ -21,127 +21,128 @@ namespace adios
ADIOS1Reader::ADIOS1Reader(ADIOS &adios, const std::string &name, ADIOS1Reader::ADIOS1Reader(ADIOS &adios, const std::string &name,
const std::string accessMode, MPI_Comm mpiComm, const std::string accessMode, MPI_Comm mpiComm,
const Method &method) const Method &method)
: Engine(adios, "BPFileReader", name, accessMode, mpiComm, method, : Engine(adios, "ADIOS1Reader", name, accessMode, mpiComm, method,
" BPFileReader constructor (or call to ADIOS Open).\n") " ADIOS1Reader constructor (or call to ADIOS Open).\n")
{ {
Init(); Init();
adios_read_init_method(read_method, mpiComm, "");
} }
BPFileReader::~BPFileReader() {} ADIOS1Reader::~ADIOS1Reader() {}
Variable<void> * Variable<void> *
BPFileReader::InquireVariable(const std::string &variableName, ADIOS1Reader::InquireVariable(const std::string &variableName,
const bool readIn) // not yet implemented const bool readIn) // not yet implemented
{ {
return nullptr; return nullptr;
} }
Variable<char> * Variable<char> *
BPFileReader::InquireVariableChar(const std::string &variableName, ADIOS1Reader::InquireVariableChar(const std::string &variableName,
const bool readIn) const bool readIn)
{ {
return InquireVariableCommon<char>(variableName, readIn); return InquireVariableCommon<char>(variableName, readIn);
} }
Variable<unsigned char> * Variable<unsigned char> *
BPFileReader::InquireVariableUChar(const std::string &variableName, ADIOS1Reader::InquireVariableUChar(const std::string &variableName,
const bool readIn) const bool readIn)
{ {
return InquireVariableCommon<unsigned char>(variableName, readIn); return InquireVariableCommon<unsigned char>(variableName, readIn);
} }
Variable<short> * Variable<short> *
BPFileReader::InquireVariableShort(const std::string &variableName, ADIOS1Reader::InquireVariableShort(const std::string &variableName,
const bool readIn) const bool readIn)
{ {
return InquireVariableCommon<short>(variableName, readIn); return InquireVariableCommon<short>(variableName, readIn);
} }
Variable<unsigned short> * Variable<unsigned short> *
BPFileReader::InquireVariableUShort(const std::string &variableName, ADIOS1Reader::InquireVariableUShort(const std::string &variableName,
const bool readIn) const bool readIn)
{ {
return InquireVariableCommon<unsigned short>(variableName, readIn); return InquireVariableCommon<unsigned short>(variableName, readIn);
} }
Variable<int> *BPFileReader::InquireVariableInt(const std::string &variableName, Variable<int> *ADIOS1Reader::InquireVariableInt(const std::string &variableName,
const bool readIn) const bool readIn)
{ {
return InquireVariableCommon<int>(variableName, readIn); return InquireVariableCommon<int>(variableName, readIn);
} }
Variable<unsigned int> * Variable<unsigned int> *
BPFileReader::InquireVariableUInt(const std::string &variableName, ADIOS1Reader::InquireVariableUInt(const std::string &variableName,
const bool readIn) const bool readIn)
{ {
return InquireVariableCommon<unsigned int>(variableName, readIn); return InquireVariableCommon<unsigned int>(variableName, readIn);
} }
Variable<long int> * Variable<long int> *
BPFileReader::InquireVariableLInt(const std::string &variableName, ADIOS1Reader::InquireVariableLInt(const std::string &variableName,
const bool readIn) const bool readIn)
{ {
return InquireVariableCommon<long int>(variableName, readIn); return InquireVariableCommon<long int>(variableName, readIn);
} }
Variable<unsigned long int> * Variable<unsigned long int> *
BPFileReader::InquireVariableULInt(const std::string &variableName, ADIOS1Reader::InquireVariableULInt(const std::string &variableName,
const bool readIn) const bool readIn)
{ {
return InquireVariableCommon<unsigned long int>(variableName, readIn); return InquireVariableCommon<unsigned long int>(variableName, readIn);
} }
Variable<long long int> * Variable<long long int> *
BPFileReader::InquireVariableLLInt(const std::string &variableName, ADIOS1Reader::InquireVariableLLInt(const std::string &variableName,
const bool readIn) const bool readIn)
{ {
return InquireVariableCommon<long long int>(variableName, readIn); return InquireVariableCommon<long long int>(variableName, readIn);
} }
Variable<unsigned long long int> * Variable<unsigned long long int> *
BPFileReader::InquireVariableULLInt(const std::string &variableName, ADIOS1Reader::InquireVariableULLInt(const std::string &variableName,
const bool readIn) const bool readIn)
{ {
return InquireVariableCommon<unsigned long long int>(variableName, readIn); return InquireVariableCommon<unsigned long long int>(variableName, readIn);
} }
Variable<float> * Variable<float> *
BPFileReader::InquireVariableFloat(const std::string &variableName, ADIOS1Reader::InquireVariableFloat(const std::string &variableName,
const bool readIn) const bool readIn)
{ {
return InquireVariableCommon<float>(variableName, readIn); return InquireVariableCommon<float>(variableName, readIn);
} }
Variable<double> * Variable<double> *
BPFileReader::InquireVariableDouble(const std::string &variableName, ADIOS1Reader::InquireVariableDouble(const std::string &variableName,
const bool readIn) const bool readIn)
{ {
return InquireVariableCommon<double>(variableName, readIn); return InquireVariableCommon<double>(variableName, readIn);
} }
Variable<long double> * Variable<long double> *
BPFileReader::InquireVariableLDouble(const std::string &variableName, ADIOS1Reader::InquireVariableLDouble(const std::string &variableName,
const bool readIn) const bool readIn)
{ {
return InquireVariableCommon<long double>(variableName, readIn); return InquireVariableCommon<long double>(variableName, readIn);
} }
Variable<std::complex<float>> * Variable<std::complex<float>> *
BPFileReader::InquireVariableCFloat(const std::string &variableName, ADIOS1Reader::InquireVariableCFloat(const std::string &variableName,
const bool readIn) const bool readIn)
{ {
return InquireVariableCommon<std::complex<float>>(variableName, readIn); return InquireVariableCommon<std::complex<float>>(variableName, readIn);
} }
Variable<std::complex<double>> * Variable<std::complex<double>> *
BPFileReader::InquireVariableCDouble(const std::string &variableName, ADIOS1Reader::InquireVariableCDouble(const std::string &variableName,
const bool readIn) const bool readIn)
{ {
return InquireVariableCommon<std::complex<double>>(variableName, readIn); return InquireVariableCommon<std::complex<double>>(variableName, readIn);
} }
Variable<std::complex<long double>> * Variable<std::complex<long double>> *
BPFileReader::InquireVariableCLDouble(const std::string &variableName, ADIOS1Reader::InquireVariableCLDouble(const std::string &variableName,
const bool readIn) const bool readIn)
{ {
return InquireVariableCommon<std::complex<long double>>(variableName, return InquireVariableCommon<std::complex<long double>>(variableName,
...@@ -149,31 +150,34 @@ BPFileReader::InquireVariableCLDouble(const std::string &variableName, ...@@ -149,31 +150,34 @@ BPFileReader::InquireVariableCLDouble(const std::string &variableName,
} }
VariableCompound * VariableCompound *
BPFileReader::InquireVariableCompound(const std::string &variableName, ADIOS1Reader::InquireVariableCompound(const std::string &variableName,
const bool readIn) const bool readIn)
{ {
return nullptr; return nullptr;
} }
void BPFileReader::Close(const int transportIndex) {} void ADIOS1Reader::Close(const int transportIndex) {}
// PRIVATE // PRIVATE
void BPFileReader::Init() void ADIOS1Reader::Init()
{ {
if (m_DebugMode == true) if (m_DebugMode == true)
{ {
if (m_AccessMode != "r" && m_AccessMode != "read") if (m_AccessMode != "r" && m_AccessMode != "read")
throw std::invalid_argument( throw std::invalid_argument(
"ERROR: BPFileReader doesn't support access mode " + "ERROR: ADIOS1Reader doesn't support access mode " +
m_AccessMode + m_AccessMode +
", in call to ADIOS Open or BPFileReader constructor\n"); ", in call to ADIOS Open or ADIOS1Reader constructor\n");
} }
InitParameters();
InitTransports(); InitTransports();
} }
void BPFileReader::InitTransports() // maybe move this? void ADIOS1Reader::InitParameters() {}
void ADIOS1Reader::InitTransports()
{ {
if (m_DebugMode == true) if (m_DebugMode == true)
{ {
if (TransportNamesUniqueness() == false) if (TransportNamesUniqueness() == false)
...@@ -188,43 +192,10 @@ void BPFileReader::InitTransports() // maybe move this? ...@@ -188,43 +192,10 @@ void BPFileReader::InitTransports() // maybe move this?
for (const auto &parameters : m_Method.m_TransportParameters) for (const auto &parameters : m_Method.m_TransportParameters)
{ {
auto itTransport = parameters.find("transport"); auto itTransport = parameters.find("transport");
if (itTransport->second == "file" || itTransport->second == "File") if (itTransport->second == "file" || itTransport->second == "File" ||
itTransport->second == "bp" || itTransport->second == "BP")
{ {
auto itLibrary = parameters.find("library"); read_method = ADIOS_READ_METHOD_BP;
if (itLibrary == parameters.end() ||
itLibrary->second == "POSIX") // use default POSIX
{
auto file = std::make_shared<transport::FileDescriptor>(
m_MPIComm, m_DebugMode);
// m_BP1Reader.OpenRankFiles( m_Name, m_AccessMode, *file );
m_Transports.push_back(std::move(file));
}
else if (itLibrary->second == "FILE*" ||
itLibrary->second == "stdio.h")
{
auto file = std::make_shared<transport::FilePointer>(
m_MPIComm, m_DebugMode);
// m_BP1Reader.OpenRankFiles( m_Name, m_AccessMode, *file );
m_Transports.push_back(std::move(file));
}
else if (itLibrary->second == "fstream" ||
itLibrary->second == "std::fstream")
{
auto file = std::make_shared<transport::FStream>(m_MPIComm,
m_DebugMode);
// m_BP1Reader.OpenRankFiles( m_Name, m_AccessMode, *file );
m_Transports.push_back(std::move(file));
}
else if (itLibrary->second == "MPI-IO")
{
}
else
{
if (m_DebugMode == true)
throw std::invalid_argument(
"ERROR: file transport library " + itLibrary->second +
" not supported, in " + m_Name + m_EndMessage);
}
} }
else else
{ {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment