userGpuTaskAssignment = parseUserTaskAssignmentString(hw_opt.userGpuTaskAssignment);
}
GMX_CATCH_ALL_AND_EXIT_WITH_FATAL_ERROR
- auto nonbondedTarget = findTaskTarget(nbpu_opt);
- auto pmeTarget = findTaskTarget(pme_opt);
- auto pmeFftTarget = findTaskTarget(pme_fft_opt);
- auto bondedTarget = findTaskTarget(bonded_opt);
- auto updateTarget = findTaskTarget(update_opt);
- PmeRunMode pmeRunMode = PmeRunMode::None;
+ auto nonbondedTarget = findTaskTarget(nbpu_opt);
+ auto pmeTarget = findTaskTarget(pme_opt);
+ auto pmeFftTarget = findTaskTarget(pme_fft_opt);
+ auto bondedTarget = findTaskTarget(bonded_opt);
+ auto updateTarget = findTaskTarget(update_opt);
FILE* fplog = nullptr;
// If we are appending, we don't write log output because we need
useGpuForNonbonded, useGpuForPme, bondedTarget, canUseGpuForBonded,
EVDW_PME(inputrec->vdwtype), EEL_PME_EWALD(inputrec->coulombtype),
domdecOptions.numPmeRanks, gpusWereDetected);
-
- pmeRunMode = (useGpuForPme ? PmeRunMode::GPU : PmeRunMode::CPU);
- if (pmeRunMode == PmeRunMode::GPU)
- {
- if (pmeFftTarget == TaskTarget::Cpu)
- {
- pmeRunMode = PmeRunMode::Mixed;
- }
- }
- else if (pmeFftTarget == TaskTarget::Gpu)
- {
- gmx_fatal(FARGS,
- "Assigning FFTs to GPU requires PME to be assigned to GPU as well. With PME "
- "on CPU you should not be using -pmefft.");
- }
}
GMX_CATCH_ALL_AND_EXIT_WITH_FATAL_ERROR
+ const PmeRunMode pmeRunMode = determinePmeRunMode(useGpuForPme, pmeFftTarget, *inputrec);
+
// Initialize development feature flags that enabled by environment variable
// and report those features that are enabled.
const DevelopmentFeatureFlags devFlags =
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2015,2016,2017,2018,2019,2020, 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.
return false;
}
+
+PmeRunMode determinePmeRunMode(const bool useGpuForPme, const TaskTarget& pmeFftTarget, const t_inputrec& inputrec)
+{
+ if (!EEL_PME(inputrec.coulombtype))
+ {
+ return PmeRunMode::None;
+ }
+
+ if (useGpuForPme)
+ {
+ if (pmeFftTarget == TaskTarget::Cpu)
+ {
+ return PmeRunMode::Mixed;
+ }
+ else
+ {
+ return PmeRunMode::GPU;
+ }
+ }
+ else
+ {
+ if (pmeFftTarget == TaskTarget::Gpu)
+ {
+ gmx_fatal(FARGS,
+ "Assigning FFTs to GPU requires PME to be assigned to GPU as well. With PME "
+ "on CPU you should not be using -pmefft.");
+ }
+ return PmeRunMode::CPU;
+ }
+}
+
bool decideWhetherToUseGpusForBonded(const bool useGpuForNonbonded,
const bool useGpuForPme,
const TaskTarget bondedTarget,
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2017,2018,2019,2020, 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.
int numPmeRanksPerSimulation,
bool gpusWereDetected);
+/*! \brief Determine PME run mode.
+ *
+ * Given the PME task assignment in \p useGpuForPme and the user-provided
+ * FFT task target in \p pmeFftTarget, returns a PME run mode for the
+ * current run. It also checks the compatibility of the two.
+ *
+ * \note Aborts the run upon incompatible values of \p useGpuForPme and \p pmeFftTarget.
+ *
+ * \param[in] useGpuForPme PME task assignment, true if PME task is mapped to the GPU.
+ * \param[in] pmeFftTarget The user's choice for -pmefft for where to assign the FFT
+ * work of the PME task. \param[in] inputrec The user input record
+ * */
+PmeRunMode determinePmeRunMode(bool useGpuForPme, const TaskTarget& pmeFftTarget, const t_inputrec& inputrec);
+
/*! \brief Decide whether the simulation will try to run bonded tasks on GPUs.
*
* \param[in] useGpuForNonbonded Whether GPUs will be used for nonbonded interactions.