Example #1
0
int
MdrunTestFixture::callMdrun(const CommandLine &callerRef)
{
    /* Conforming to style guide by not passing a non-const reference
       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("-g", logFileName);
    caller.addOption("-e", edrFileName);
    caller.addOption("-o", fullPrecisionTrajectoryFileName);
    caller.addOption("-x", reducedPrecisionTrajectoryFileName);

    caller.addOption("-deffnm", fileManager_.getTemporaryFilePath("state"));

    if (nsteps > -2)
    {
        caller.addOption("-nsteps", nsteps);
    }

#ifdef GMX_THREAD_MPI
    caller.addOption("-nt", g_numThreads);
#endif
#ifdef GMX_OPENMP
    caller.addOption("-ntomp", g_numOpenMPThreads);
#endif

    return gmx_mdrun(caller.argc(), caller.argv());
}
Example #2
0
int
SimulationRunner::callMdrun(const CommandLine &callerRef)
{
    /* Conforming to style guide by not passing a non-const reference
       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("-g", logFileName_);
    caller.addOption("-e", edrFileName_);
    caller.addOption("-o", fullPrecisionTrajectoryFileName_);
    caller.addOption("-x", reducedPrecisionTrajectoryFileName_);

    caller.addOption("-deffnm", fixture_->fileManager_.getTemporaryFilePath("state"));

    if (nsteps_ > -2)
    {
        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

    return gmx_mdrun(caller.argc(), caller.argv());
}
Example #3
0
int
SimulationRunner::callMdrun(const CommandLine &callerRef)
{
    /* Conforming to style guide by not passing a non-const reference
       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("-g", logFileName_);
    caller.addOption("-e", edrFileName_);
    caller.addOption("-o", fullPrecisionTrajectoryFileName_);
    caller.addOption("-x", reducedPrecisionTrajectoryFileName_);

    caller.addOption("-deffnm", fixture_->fileManager_.getTemporaryFilePath("state"));

    if (nsteps_ > -2)
    {
        caller.addOption("-nsteps", nsteps_);
    }

#if GMX_MPI
#  if GMX_GPU != GMX_GPU_NONE
#    if 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

#if GMX_THREAD_MPI
    caller.addOption("-ntmpi", g_numThreads);
#endif

#if GMX_OPENMP
    caller.addOption("-ntomp", g_numOpenMPThreads);
#endif

#if GMX_GPU != GMX_GPU_NONE
    /* TODO Ideally, with real MPI, we could call
     * gmx_collect_hardware_mpi() here and find out how many nodes
     * mdrun will run on. For now, we assume that we're running on one
     * node regardless of the number of ranks, because that's true in
     * Jenkins and for most developers running the tests. */
    int numberOfNodes = 1;
#if GMX_THREAD_MPI
    /* Can't use gmx_node_num() because it is only valid after spawn of thread-MPI threads */
    int numberOfRanks = g_numThreads;
#elif GMX_LIB_MPI
    int numberOfRanks = gmx_node_num();
#else
    int numberOfRanks = 1;
#endif
    if (numberOfRanks > numberOfNodes && !gmx_multiple_gpu_per_node_supported())
    {
        if (gmx_node_rank() == 0)
        {
            fprintf(stderr, "GROMACS in this build configuration cannot run on more than one GPU per node,\n so with %d ranks and %d nodes, this test will disable GPU support", numberOfRanks, numberOfNodes);
        }
        caller.addOption("-nb", "cpu");
    }
#endif
    return gmx_mdrun(caller.argc(), caller.argv());
}