/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2013,2014, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
* Implements classes in moduletest.h.
*
* \author Mark Abraham <mark.j.abraham@gmail.com>
- * \ingroup module_mdrun
+ * \ingroup module_mdrun_integration_tests
*/
#include "gmxpre.h"
#include "gromacs/options/options.h"
#include "gromacs/utility/basedefinitions.h"
#include "gromacs/utility/basenetwork.h"
-#include "gromacs/utility/file.h"
+#include "gromacs/utility/gmxmpi.h"
+#include "gromacs/utility/textwriter.h"
#include "programs/mdrun/mdrun_main.h"
#include "testutils/cmdlinetest.h"
void
SimulationRunner::useEmptyMdpFile()
{
+ // TODO When removing the group scheme, update actual and potential users of useEmptyMdpFile
useStringAsMdpFile("cutoff-scheme = Group\n");
}
void
SimulationRunner::useStringAsMdpFile(const std::string &mdpString)
{
- gmx::File::writeFileFromString(mdpInputFileName_, mdpString);
+ gmx::TextWriter::writeFileFromString(mdpInputFileName_, mdpString);
}
void
SimulationRunner::useStringAsNdxFile(const char *ndxString)
{
- gmx::File::writeFileFromString(ndxFileName_, ndxString);
+ gmx::TextWriter::writeFileFromString(ndxFileName_, ndxString);
}
void
ndxFileName_ = fixture_->fileManager_.getInputFilePath((std::string(name) + ".ndx").c_str());
}
+void
+SimulationRunner::useGroFromDatabase(const char *name)
+{
+ groFileName_ = fixture_->fileManager_.getInputFilePath((std::string(name) + ".gro").c_str());
+}
+
int
SimulationRunner::callGromppOnThisRank()
{
int
SimulationRunner::callGrompp()
{
+ int returnValue = 0;
#ifdef GMX_LIB_MPI
- // When compiled with external MPI, only call one instance of the
- // grompp function
- if (0 != gmx_node_rank())
+ // When compiled with external MPI, we're trying to run mdrun with
+ // MPI, but we need to make sure that we only do grompp on one
+ // rank
+ if (0 == gmx_node_rank())
+#endif
{
- return 0;
+ returnValue = callGromppOnThisRank();
}
+#ifdef GMX_LIB_MPI
+ // Make sure rank zero has written the .tpr file before other
+ // ranks try to read it. Thread-MPI and serial do this just fine
+ // on their own.
+ MPI_Barrier(MPI_COMM_WORLD);
#endif
- return callGromppOnThisRank();
+ return returnValue;
}
int
to this function. Passing a non-const reference might make it
easier to write code that incorrectly re-uses callerRef after
the call to this function. */
+
CommandLine caller(callerRef);
caller.addOption("-s", tprFileName_);
caller.addOption("-nsteps", nsteps_);
}
+#ifdef GMX_MPI
+# ifdef GMX_GPU
+# ifdef GMX_THREAD_MPI
+ int numGpusNeeded = g_numThreads;
+# else /* Must be real MPI */
+ int numGpusNeeded = gmx_node_num();
+# endif
+ std::string gpuIdString(numGpusNeeded, '0');
+ caller.addOption("-gpu_id", gpuIdString.c_str());
+# endif
+#endif
+
#ifdef GMX_THREAD_MPI
caller.addOption("-nt", g_numThreads);
#endif
+
#ifdef GMX_OPENMP
caller.addOption("-ntomp", g_numOpenMPThreads);
#endif