Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adios2::core::ADIOS: Initialize new IO objects with config file #3955

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 32 additions & 6 deletions source/adios2/core/ADIOS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,11 @@ ADIOS::ADIOS(const std::string configFile, helper::Comm comm, const std::string
}
if (helper::EndsWith(configFile, ".xml"))
{
XMLInit(configFile);
m_ConfigFileContents = XMLInit(configFile);
}
else if (helper::EndsWith(configFile, ".yaml") || helper::EndsWith(configFile, ".yml"))
{
YAMLInit(configFile);
m_ConfigFileContents = YAMLInit(configFile);
}
}
#ifdef ADIOS2_HAVE_KOKKOS
Expand Down Expand Up @@ -189,6 +189,20 @@ IO &ADIOS::DeclareIO(const std::string name, const ArrayOrdering ArrayOrder)
IO &io = ioPair.first->second;
io.SetDeclared();
io.SetArrayOrder(ArrayOrder);

// Configure new IO objects with config file (if present)
if (!m_ConfigFile.empty() && !m_ConfigFileContents.empty())
{
if (helper::EndsWith(m_ConfigFile, ".xml"))
{
XMLIOInit(m_ConfigFile, m_ConfigFileContents, io);
}
else if (helper::EndsWith(m_ConfigFile, ".yaml") || helper::EndsWith(m_ConfigFile, ".yml"))
{
YAMLInitIO(m_ConfigFile, m_ConfigFileContents, io);
}
}

return io;
}

Expand Down Expand Up @@ -286,14 +300,26 @@ void ADIOS::CheckOperator(const std::string name) const
}
}

void ADIOS::XMLInit(const std::string &configFileXML)
std::string ADIOS::XMLInit(const std::string &configFileXML)
{
return helper::ParseConfigXML(*this, configFileXML, m_IOs, m_Operators);
}

void ADIOS::XMLIOInit(const std::string &configFileXML, const std::string &configFileContents,
core::IO &io)
{
helper::ParseConfigXMLIO(*this, configFileXML, configFileContents, io, m_Operators);
}

std::string ADIOS::YAMLInit(const std::string &configFileYAML)
{
helper::ParseConfigXML(*this, configFileXML, m_IOs, m_Operators);
return helper::ParseConfigYAML(*this, configFileYAML, m_IOs);
}

void ADIOS::YAMLInit(const std::string &configFileYAML)
void ADIOS::YAMLInitIO(const std::string &configFileYAML, const std::string &configFileContents,
core::IO &io)
{
helper::ParseConfigYAML(*this, configFileYAML, m_IOs);
helper::ParseConfigYAMLIO(*this, configFileYAML, configFileContents, io);
}

void ADIOS::Global_init_AWS_API()
Expand Down
11 changes: 9 additions & 2 deletions source/adios2/core/ADIOS.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ class ADIOS

/** XML File to be read containing configuration information */
const std::string m_ConfigFile;
std::string m_ConfigFileContents;

/**
* @brief List of IO class objects defined from either ADIOS
Expand All @@ -184,9 +185,15 @@ class ADIOS

void CheckOperator(const std::string name) const;

void XMLInit(const std::string &configFileXML);
std::string XMLInit(const std::string &configFileXML);

void YAMLInit(const std::string &configFileYAML);
void XMLIOInit(const std::string &configFileXML, const std::string &configFileContents,
core::IO &io);

std::string YAMLInit(const std::string &configFileYAML);

void YAMLInitIO(const std::string &configFileYAML, const std::string &configFileContents,
core::IO &io);

private:
/* Global services that we want to initialize at most once and shutdown
Expand Down
Loading
Loading