Commit 6bc8bd79 authored by Chris Cantwell's avatar Chris Cantwell

Added support for parallel MPI tests.

parent 680e2124
......@@ -17,3 +17,7 @@ ADD_SOLVER_EXECUTABLE(IncNavierStokesSolver solvers
${IncNavierStokesSolverSource})
ADD_NEKTAR_TEST(Channel_Flow_3modes)
IF (NEKTAR_USE_MPI)
ADD_NEKTAR_TEST(Channel_Flow_3modes_Parallel)
ENDIF (NEKTAR_USE_MPI)
<?xml version="1.0" encoding="utf-8"?>
<test>
<description>Channel Flow P=2</description>
<executable>IncNavierStokesSolver</executable>
<parameters>Channel_Flow_3modes_Parallel.xml</parameters>
<processes>2</processes>
<files>
<file description="Session File">Channel_Flow_3modes_Parallel.xml</file>
</files>
<metrics>
<metric type="L2" id="1">
<value variable="u">5.20394e-16</value>
<value variable="v">0</value>
<value variable="p">8.50369e-15</value>
</metric>
<metric type="Linf" id="2">
<value variable="u">4.7462e-15</value>
<value variable="v">3.04438e-16</value>
<value variable="p">6.23945e-14</value>
</metric>
</metrics>
</test>
<?xml version="1.0" encoding="utf-8"?>
<NEKTAR xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://www.nektar.info/schema/nektar.xsd">
<EXPANSIONS>
<E COMPOSITE="C[0]" NUMMODES="3" FIELDS="u,v,p" TYPE="MODIFIED" />
</EXPANSIONS>
<CONDITIONS>
<SOLVERINFO>
<I PROPERTY="SolverType" VALUE="VelocityCorrectionScheme" />
<I PROPERTY="EQTYPE" VALUE="UnsteadyNavierStokes" />
<I PROPERTY="AdvectionForm" VALUE="Convective" />
<I PROPERTY="Projection" VALUE="Galerkin" />
<I PROPERTY="TimeIntegrationMethod" VALUE="IMEXOrder1" />
</SOLVERINFO>
<PARAMETERS>
<P> TimeStep = 0.001 </P>
<P> NumSteps = 1000 </P>
<P> IO_CheckSteps = 1000 </P>
<P> IO_InfoSteps = 1000 </P>
<P> Kinvis = 1 </P>
</PARAMETERS>
<VARIABLES>
<V ID="0"> u </V>
<V ID="1"> v </V>
<V ID="2"> p </V>
</VARIABLES>
<BOUNDARYREGIONS>
<B ID="0"> C[1] </B>
<B ID="1"> C[2] </B>
<B ID="2"> C[3] </B>
</BOUNDARYREGIONS>
<BOUNDARYCONDITIONS>
<REGION REF="0">
<D VAR="u" VALUE="0" />
<D VAR="v" VALUE="0" />
<N VAR="p" USERDEFINEDTYPE="H" VALUE="0" />
</REGION>
<REGION REF="1">
<D VAR="u" VALUE="y*(1-y)" />
<D VAR="v" VALUE="0" />
<N VAR="p" USERDEFINEDTYPE="H" VALUE="0" />
</REGION>
<REGION REF="2">
<N VAR="u" VALUE="0" />
<N VAR="v" VALUE="0" />
<D VAR="p" VALUE="0" />
</REGION>
</BOUNDARYCONDITIONS>
<FUNCTION NAME="InitialConditions">
<E VAR="u" VALUE="0" />
<E VAR="v" VALUE="0" />
<E VAR="p" VALUE="0" />
</FUNCTION>
<FUNCTION NAME="ExactSolution">
<E VAR="u" VALUE="y*(1-y)" />
<E VAR="v" VALUE="0" />
<E VAR="p" VALUE="-2*Kinvis*(x-1)" />
</FUNCTION>
</CONDITIONS>
<GEOMETRY DIM="2" SPACE="2">
<VERTEX>
<V ID="0"> 0.0 0.0 0.0 </V>
<V ID="1"> 0.5 0.0 0.0 </V>
<V ID="2"> 1.0 0.0 0.0 </V>
<V ID="3"> 0.0 0.5 0.0 </V>
<V ID="4"> 0.5 0.5 0.0 </V>
<V ID="5"> 1.0 0.5 0.0 </V>
<V ID="6"> 0.0 1.0 0.0 </V>
<V ID="7"> 0.5 1.0 0.0 </V>
<V ID="8"> 1.0 1.0 0.0 </V>
</VERTEX>
<EDGE>
<E ID="0"> 0 1 </E>
<E ID="1"> 1 2 </E>
<E ID="2"> 0 3 </E>
<E ID="3"> 1 4 </E>
<E ID="4"> 2 5 </E>
<E ID="5"> 3 4 </E>
<E ID="6"> 4 5 </E>
<E ID="7"> 3 6 </E>
<E ID="8"> 4 7 </E>
<E ID="9"> 5 8 </E>
<E ID="10"> 6 7 </E>
<E ID="11"> 7 8 </E>
</EDGE>
<ELEMENT>
<Q ID="0"> 0 3 5 2 </Q>
<Q ID="1"> 1 4 6 3 </Q>
<Q ID="2"> 5 8 10 7 </Q>
<Q ID="3"> 6 9 11 8 </Q>
</ELEMENT>
<COMPOSITE>
<C ID="0"> Q[0-3] </C>
<C ID="1"> E[0,1,10,11] </C> <!-- Walls -->
<C ID="2"> E[2,7] </C> <!-- Inflow -->
<C ID="3"> E[4,9] </C> <!-- Outflow -->
</COMPOSITE>
<DOMAIN> C[0] </DOMAIN>
</GEOMETRY>
</NEKTAR>
......@@ -48,6 +48,11 @@ const std::string& TestData::GetParameters() const
return m_parameters;
}
const unsigned int& TestData::GetNProcesses() const
{
return m_processes;
}
std::string TestData::GetMetricType(unsigned int pId) const
{
ASSERTL0(pId < m_metrics.size(), "Metric ID out of range.");
......@@ -90,19 +95,31 @@ void TestData::Parse(TiXmlDocument* pDoc)
// Find description tag.
tmp = testElement->FirstChildElement("description");
m_description = string(tmp->GetText());
ASSERTL0(tmp, "Cannot find 'description' for test.");
m_description = string(tmp->GetText());
// Find solver tag.
// Find executable tag.
tmp = testElement->FirstChildElement("executable");
m_executable = string(tmp->GetText());
ASSERTL0(tmp, "Cannot find 'executable' for test.");
m_executable = string(tmp->GetText());
// Find input tag.
// Find parameters tag.
tmp = testElement->FirstChildElement("parameters");
m_parameters = string(tmp->GetText());
ASSERTL0(tmp, "Cannot find 'parameters' for test.");
m_parameters = string(tmp->GetText());
// Find parallel processes tah.
tmp = testElement->FirstChildElement("processes");
if (tmp)
{
m_processes = atoi(tmp->GetText());
}
else
{
m_processes = 1;
}
// Extract metric tags
metrics = testElement->FirstChildElement("metrics");
ASSERTL0(metrics, "No metrics defined for test.");
......@@ -113,6 +130,7 @@ void TestData::Parse(TiXmlDocument* pDoc)
tmp = tmp->NextSiblingElement("metric");
}
// Extract list of dependent files
files = testElement->FirstChildElement("files");
if (files)
{
......
......@@ -37,6 +37,7 @@ public:
const std::string& GetDescription() const;
const std::string& GetExecutable() const;
const std::string& GetParameters() const;
const unsigned int& GetNProcesses() const;
std::string GetMetricType(unsigned int pId) const;
unsigned int GetNumMetrics() const;
......@@ -50,6 +51,7 @@ private:
std::string m_description;
std::string m_executable;
std::string m_parameters;
unsigned int m_processes;
TiXmlDocument* m_doc;
std::vector<TiXmlElement*> m_metrics;
std::vector<DependentFile> m_files;
......
......@@ -128,6 +128,12 @@ int main(int argc, char *argv[])
// Construct test command to run. If in debug mode, append "-g"
// Output from stdout and stderr are directed to the files output.out
// and output.err, respectively.
if (file.GetNProcesses() > 1)
{
command += "mpirun -np "
+ boost::lexical_cast<std::string>(file.GetNProcesses())
+ " ";
}
fs::path execPath = startDir / fs::path(file.GetExecutable());
command += PortablePath(execPath);
#if defined(NDEBUG)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment