Commit a9094a81 authored by Kilian Lackhove's avatar Kilian Lackhove

auto detect if we are running on a shared filesystem and remove the cmdline option

parent 83921b30
......@@ -23,10 +23,6 @@ Override a parameter (or define a new one) specified in the XML file.
\hangindent=1.5cm
Override a solverinfo (or define a new one) specified in the XML file.
\lstinline[style=BashInputStyle]{--shared-filesystem}\\
\hangindent=1.5cm
By default when running in parallel the complete mesh is loaded by all processes, although partitioning is done uniquely on the root process only and communicated to the other processes. Each process then writes out its own partition to the local working directory. This is the most robust approach in accounting for systems where the distributed nodes do not share a common filesystem. In the case that there is a common filesystem, this option forces only the root process to load the complete mesh, perform partitioning and write out the session files for all partitions. This avoids potential memory issues when multiple processes attempt to load the complete mesh on a single node.
\lstinline[style=BashInputStyle]{--npx [int]}\\
\hangindent=1.5cm
When using a fully-Fourier expansion, specifies the number of processes to use in the x-coordinate direction.
......
......@@ -194,6 +194,8 @@ namespace Nektar
// Create communicator
CreateComm(argc, argv);
TestSharedFilesystem();
// If running in parallel change the default global sys solution
// type.
if (m_comm->GetSize() > 1)
......@@ -237,6 +239,8 @@ namespace Nektar
}
}
TestSharedFilesystem();
// If running in parallel change the default global sys solution
// type.
if (m_comm->GetSize() > 1)
......@@ -310,6 +314,43 @@ namespace Nektar
}
void SessionReader::TestSharedFilesystem()
{
m_sharedFilesystem = false;
if (m_comm->GetSize() > 1)
{
if (m_comm->GetRank() == 0)
{
std::ofstream testfile ("shared-fs-testfile");
testfile << "" << std::endl;
testfile.close();
}
m_comm->Block();
std::ifstream testfile("shared-fs-testfile");
int exists = (bool) testfile;
m_comm->AllReduce(exists, LibUtilities::ReduceSum);
m_sharedFilesystem = (exists == m_comm->GetSize());
if ((m_sharedFilesystem && m_comm->GetRank() == 0) || !m_sharedFilesystem)
{
std::remove("shared-fs-testfile");
}
}
else
{
m_sharedFilesystem = false;
}
if (m_verbose && m_comm->GetRank() == 0 && m_sharedFilesystem)
{
cout << "shared filesystem detected" << endl;
}
}
/**
* @brief Parses the command-line arguments for known options and
* filenames.
......@@ -327,7 +368,6 @@ namespace Nektar
"override a SOLVERINFO property")
("parameter,P", po::value<vector<std::string> >(),
"override a parameter")
("shared-filesystem,s", "Using shared filesystem.")
("npx", po::value<int>(),
"number of procs in X-dir")
("npy", po::value<int>(),
......@@ -619,6 +659,10 @@ namespace Nektar
return m_comm;
}
bool SessionReader::GetSharedFilesystem()
{
return m_sharedFilesystem;
}
/**
* This routine finalises any parallel communication.
......@@ -1656,7 +1700,7 @@ namespace Nektar
{
SessionReaderSharedPtr vSession = GetSharedThisPtr();
int nParts = vCommMesh->GetSize();
if (DefinesCmdLineArgument("shared-filesystem"))
if (m_sharedFilesystem)
{
CommSharedPtr vComm = GetComm();
vector<unsigned int> keys, vals;
......
......@@ -195,6 +195,8 @@ namespace Nektar
LIB_UTILITIES_EXPORT const std::string GetSessionNameRank() const;
/// Returns the communication object.
LIB_UTILITIES_EXPORT CommSharedPtr &GetComm();
/// Returns the communication object.
LIB_UTILITIES_EXPORT bool GetSharedFilesystem();
/// Finalises the session.
LIB_UTILITIES_EXPORT void Finalise();
......@@ -457,6 +459,8 @@ namespace Nektar
FilterMap m_filters;
/// Be verbose
bool m_verbose;
/// Running on a shared filesystem
bool m_sharedFilesystem;
/// Map of original composite ordering for parallel periodic bcs.
CompositeOrdering m_compOrder;
/// Map of original boundary region ordering for parallel periodic
......@@ -481,6 +485,8 @@ namespace Nektar
/// Returns a shared pointer to the current object.
inline SessionReaderSharedPtr GetSharedThisPtr();
LIB_UTILITIES_EXPORT void TestSharedFilesystem();
/// Parse the program arguments and fill #m_cmdLineOptions
std::vector<std::string> ParseCommandLineArguments(
int argc, char *argv[]);
......
......@@ -125,7 +125,7 @@ namespace Nektar
m_fld = MemoryManager<LibUtilities::FieldIO>
::AllocateSharedPtr(
m_session->GetComm(),
m_session->DefinesCmdLineArgument("shared-filesystem"));
m_session->GetSharedFilesystem());
// Read the geometry and the expansion information
m_graph = SpatialDomains::MeshGraph::Read(m_session);
......
......@@ -85,7 +85,6 @@ int main(int argc, char* argv[])
"Print options for a module.")
("module,m", po::value<vector<string> >(),
"Specify modules which are to be used.")
("shared-filesystem,s", "Using shared filesystem.")
("useSessionVariables",
"Use variables defined in session for output")
("verbose,v",
......
......@@ -234,11 +234,6 @@ void InputXml::Process(po::variables_map &vm)
cmdArgs.push_back("--verbose");
}
if(vm.count("shared-filesystem"))
{
cmdArgs.push_back("--shared-filesystem");
}
if(vm.count("part-only"))
{
cmdArgs.push_back("--part-only");
......
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