void checkAndUpdateHardwareOptions(const gmx::MDLogger &mdlog,
gmx_hw_opt_t *hw_opt,
const bool isSimulationMasterRank,
- const int nPmeRanks)
+ const int nPmeRanks,
+ const t_inputrec *inputrec)
{
/* Currently hw_opt only contains default settings or settings supplied
* by the user on the command line.
"compiled without thread-MPI");
}
}
+
+ /* With thread-MPI we need to handle TPI and #OpenMP-threads=auto early,
+ * so we can parallelize using MPI only. The general check is done later.
+ */
+ if (GMX_THREAD_MPI && isSimulationMasterRank)
+ {
+ GMX_RELEASE_ASSERT(inputrec, "Expect a valid inputrec");
+ if (EI_TPI(inputrec->eI) && hw_opt->nthreads_omp == 0)
+ {
+ hw_opt->nthreads_omp = 1;
+ }
+ }
/* With thread-MPI the master thread sets hw_opt->totNumThreadsIsAuto.
* The other threads receive a partially processed hw_opt from the master
* thread and should not set hw_opt->totNumThreadsIsAuto again.
const gmx_multisim_t *ms,
int numRanksOnThisNode,
PmeRunMode pmeRunMode,
- const gmx_mtop_t &mtop)
+ const gmx_mtop_t &mtop,
+ const t_inputrec &inputrec)
{
+ if (EI_TPI(inputrec.eI))
+ {
+ if (hw_opt->nthreads_omp > 1)
+ {
+ gmx_fatal(FARGS, "You requested OpenMP parallelization, which is not supported with TPI.");
+ }
+ hw_opt->nthreads_omp = 1;
+ }
+
if (GMX_THREAD_MPI)
{