/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2016,2017,2018, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2016,2017,2018,2019, 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.
*
* Each number of threads per module takes the default value unless
* GMX_*_NUM_THERADS env var is set, case in which its value overrides
- * the deafult.
- *
- * The "group" scheme supports OpenMP only in PME and in thise case all but
- * the PME nthread values default to 1.
+ * the default.
*/
static void pick_module_nthreads(const gmx::MDLogger &mdlog, int m,
- gmx_bool bFullOmpSupport,
gmx_bool bSepPME)
{
char *env;
/* with the verlet codepath, when any GMX_*_NUM_THREADS env var is set,
* OMP_NUM_THREADS also has to be set */
- if (bFullOmpSupport && getenv("OMP_NUM_THREADS") == nullptr)
+ if (getenv("OMP_NUM_THREADS") == nullptr)
{
gmx_warning("%s=%d is set, the default number of threads also "
"needs to be set with OMP_NUM_THREADS!",
modth_env_var[m], nth);
}
- /* with the group scheme warn if any env var except PME is set */
- if (!bFullOmpSupport)
- {
- if (m != emntPME)
- {
- gmx_warning("%s=%d is set, but OpenMP multithreading is not "
- "supported in %s!",
- modth_env_var[m], nth, mod_name[m]);
- nth = 1;
- }
- }
-
/* only babble if we are really overriding with a different value */
if ((bSepPME && m == emntPME && nth != modth.gnth_pme) || (nth != modth.gnth))
{
int omp_nthreads_req,
int omp_nthreads_pme_req,
gmx_bool gmx_unused bThisNodePMEOnly,
- gmx_bool bFullOmpSupport,
int numRanksOnThisNode,
gmx_bool bSepPME)
{
* the respective module and it has to be used in conjunction with
* OMP_NUM_THREADS.
*
- * With the group scheme OpenMP multithreading is only supported in PME,
- * for all other modules nthreads is set to 1.
* The number of PME threads is equal to:
* - 1 if not compiled with OpenMP or
* - GMX_PME_NUM_THREADS if defined, otherwise
{
nth = omp_nthreads_req;
}
- else if (bFullOmpSupport && bOMP)
+ else if (bOMP)
{
/* max available threads per node */
nth = nthreads_hw_avail;
}
/* now we have the global values, set them:
- * - 1 if not compiled with OpenMP and for the group scheme
+ * - 1 if not compiled with OpenMP
* - nth for the verlet scheme when compiled with OpenMP
*/
- if (bFullOmpSupport && bOMP)
+ if (bOMP)
{
modth.gnth = nth;
}
/* now set the per-module values */
modth.nth[emntDefault] = modth.gnth;
- pick_module_nthreads(mdlog, emntDomdec, bFullOmpSupport, bSepPME);
- pick_module_nthreads(mdlog, emntPairsearch, bFullOmpSupport, bSepPME);
- pick_module_nthreads(mdlog, emntNonbonded, bFullOmpSupport, bSepPME);
- pick_module_nthreads(mdlog, emntBonded, bFullOmpSupport, bSepPME);
- pick_module_nthreads(mdlog, emntPME, bFullOmpSupport, bSepPME);
- pick_module_nthreads(mdlog, emntUpdate, bFullOmpSupport, bSepPME);
- pick_module_nthreads(mdlog, emntVSITE, bFullOmpSupport, bSepPME);
- pick_module_nthreads(mdlog, emntLINCS, bFullOmpSupport, bSepPME);
- pick_module_nthreads(mdlog, emntSETTLE, bFullOmpSupport, bSepPME);
+ pick_module_nthreads(mdlog, emntDomdec, bSepPME);
+ pick_module_nthreads(mdlog, emntPairsearch, bSepPME);
+ pick_module_nthreads(mdlog, emntNonbonded, bSepPME);
+ pick_module_nthreads(mdlog, emntBonded, bSepPME);
+ pick_module_nthreads(mdlog, emntPME, bSepPME);
+ pick_module_nthreads(mdlog, emntUpdate, bSepPME);
+ pick_module_nthreads(mdlog, emntVSITE, bSepPME);
+ pick_module_nthreads(mdlog, emntLINCS, bSepPME);
+ pick_module_nthreads(mdlog, emntSETTLE, bSepPME);
/* set the number of threads globally */
if (bOMP)
else
#endif /* GMX_THREAD_MPI */
{
- if (bFullOmpSupport)
- {
- gmx_omp_set_num_threads(nth);
- }
- else
- {
- gmx_omp_set_num_threads(1);
- }
+ gmx_omp_set_num_threads(nth);
}
}
reportOpenmpSettings(const gmx::MDLogger &mdlog,
const t_commrec *cr,
gmx_bool bOMP,
- gmx_bool bFullOmpSupport,
gmx_bool bSepPME)
{
#if GMX_THREAD_MPI
nth_pme_max = modth.gnth_pme;
}
- /* for group scheme we print PME threads info only */
- if (bFullOmpSupport)
+
+ if (nth_max == nth_min)
{
- if (nth_max == nth_min)
- {
- GMX_LOG(mdlog.warning).appendTextFormatted(
- "Using %d OpenMP thread%s %s",
- nth_min, nth_min > 1 ? "s" : "",
- cr->nnodes > 1 ? mpi_str : "");
- }
- else
- {
- GMX_LOG(mdlog.warning).appendTextFormatted(
- "Using %d - %d OpenMP threads %s",
- nth_min, nth_max, mpi_str);
- }
+ GMX_LOG(mdlog.warning).appendTextFormatted(
+ "Using %d OpenMP thread%s %s",
+ nth_min, nth_min > 1 ? "s" : "",
+ cr->nnodes > 1 ? mpi_str : "");
}
+ else
+ {
+ GMX_LOG(mdlog.warning).appendTextFormatted(
+ "Using %d - %d OpenMP threads %s",
+ nth_min, nth_max, mpi_str);
+ }
+
if (bSepPME && (nth_pme_min != nth_min || nth_pme_max != nth_max))
{
if (nth_pme_max == nth_pme_min)
int numRanksOnThisNode,
int omp_nthreads_req,
int omp_nthreads_pme_req,
- gmx_bool bThisNodePMEOnly,
- gmx_bool bFullOmpSupport)
+ gmx_bool bThisNodePMEOnly)
{
gmx_bool bSepPME;
manage_number_of_openmp_threads(mdlog, cr, bOMP,
nthreads_hw_avail,
omp_nthreads_req, omp_nthreads_pme_req,
- bThisNodePMEOnly, bFullOmpSupport,
- numRanksOnThisNode, bSepPME);
+ bThisNodePMEOnly, numRanksOnThisNode, bSepPME);
#if GMX_THREAD_MPI
/* Non-master threads have to wait for the OpenMP management to be
* done, so that code elsewhere that uses OpenMP can be certain
}
#endif
- reportOpenmpSettings(mdlog, cr, bOMP, bFullOmpSupport, bSepPME);
+ reportOpenmpSettings(mdlog, cr, bOMP, bSepPME);
}
int gmx_omp_nthreads_get(int mod)