gmx_check_if_changed(HWLOC_FOUND_CHANGED HWLOC_FOUND)
if (_STATIC_HWLOC AND HWLOC_FOUND_CHANGED)
- message(STATUS "Static hwloc library found, will not attempt using it as it could lead to link-time errors. To use the detected library, manually set GMX_HWLOC=ON and you will likely have to pass appropriate linker flags too to satisfy the link-time dependencies of your hwloc library. Try "pkg-config --libs --static hwloc" for suggestions on what you will need.")
+ message(STATUS "Static hwloc library found, will not attempt using it as it could lead to link-time errors. To use the detected library, manually set GMX_HWLOC=ON and you will likely have to pass appropriate linker flags too to satisfy the link-time dependencies of your hwloc library. Try \"pkg-config --libs --static hwloc\" for suggestions on what you will need.")
set(GMX_HWLOC_DEFAULT OFF)
else()
set(GMX_HWLOC_DEFAULT ON)
if not options.quiet:
sys.stderr.write('Scanning source tree...\n')
+ if not options.source_root:
+ sys.stderr.write('Source root required not specified.\n')
+ sys.exit(2)
+ if not options.build_root:
+ sys.stderr.write('Build root required not specified.\n')
+ sys.exit(2)
tree = GromacsTree(options.source_root, options.build_root, reporter)
tree.load_installed_file_list()
files = []
"Parallelization",
"^^^^^^^^^^^^^^^",
"",
- "If available, the number of OpenMP threads used by gmx wham is controlled with [TT]-nt[tt].",
+ "If available, the number of OpenMP threads used by gmx wham can be controlled by setting",
+ "the [TT]OMP_NUM_THREADS[tt] environment variable.",
"",
"Autocorrelations",
"^^^^^^^^^^^^^^^^",
RTYPE("y-tickfontsize", psr->Y.tickfontsize, psr->X.tickfontsize);
STYPE("y-tickfont", psr->Y.tickfont, psr->Y.font);
+ check_warning_error(wi, FARGS);
+
if (mpout != NULL)
{
write_inpfile(mpout, ninp, inp, TRUE, wi);
static void
zero_thread_output(struct bonded_threading_t *bt, int thread)
{
+ if (!bt->haveBondeds)
+ {
+ return;
+ }
+
f_thread_t *f_t = &bt->f_t[thread];
const int nelem_fa = sizeof(*f_t->f)/sizeof(real);
gmx_bool bCalcEnerVir,
gmx_bool bDHDL)
{
+ if (!bt->haveBondeds)
+ {
+ return;
+ }
+
if (bt->nblock_used > 0)
{
/* Reduce the bonded force buffer */
wallcycle_sub_stop(wcycle, ewcsRESTRAINTS);
}
+ /* TODO: Skip this whole loop with a system/domain without listeds */
wallcycle_sub_start(wcycle, ewcsLISTED);
#pragma omp parallel for num_threads(bt->nthreads) schedule(static)
for (thread = 0; thread < bt->nthreads; thread++)
gmx_bitmask_t *mask; /**< Mask array, one element corresponds to a block of reduction_block_size atoms of the force array, bit corresponding to thread indices set if a thread writes to that block */
int block_nalloc; /**< Allocation size of block_index and mask */
+ bool haveBondeds; /**< true if we have and thus need to reduce bonded forces */
+
/* There are two different ways to distribute the bonded force calculation
* over the threads. We dedice which to use based on the number of threads.
*/
#include "manage-threading.h"
+#include "config.h"
+
#include <assert.h>
#include <limits.h>
#include <stdlib.h>
//! Divides bonded interactions over threads
static void divide_bondeds_over_threads(t_idef *idef,
int nthread,
- int max_nthread_uniform)
+ int max_nthread_uniform,
+ bool *haveBondeds)
{
ilist_data_t ild[F_NRE];
int ntype;
snew(idef->il_thread_division, idef->il_thread_division_nalloc);
}
- ntype = 0;
+ *haveBondeds = false;
+ ntype = 0;
for (f = 0; f < F_NRE; f++)
{
if (!ftype_is_bonded_potential(f))
continue;
}
+ if (idef->il[f].nr > 0)
+ {
+ *haveBondeds = true;
+ }
+
if (idef->il[f].nr == 0)
{
/* No interactions, avoid all the integer math below */
const t_idef *idef,
int thread, int nthread)
{
- assert(nthread <= BITMASK_SIZE);
+ static_assert(BITMASK_SIZE == GMX_OPENMP_MAX_THREADS, "For the error message below we assume these two are equal.");
+
+ if (nthread > BITMASK_SIZE)
+ {
+#pragma omp master
+ gmx_fatal(FARGS, "You are using %d OpenMP threads, which is larger than GMX_OPENMP_MAX_THREADS (%d). Decrease the number of OpenMP threads or rebuild GROMACS with a larger value for GMX_OPENMP_MAX_THREADS.",
+ nthread, GMX_OPENMP_MAX_THREADS);
+#pragma omp barrier
+ }
+ GMX_ASSERT(nthread <= BITMASK_SIZE, "We need at least nthread bits in the mask");
int nblock = (natoms + reduction_block_size - 1) >> reduction_block_bits;
/* Divide the bonded interaction over the threads */
divide_bondeds_over_threads(idef,
bt->nthreads,
- bt->bonded_max_nthread_uniform);
+ bt->bonded_max_nthread_uniform,
+ &bt->haveBondeds);
+
+ if (!bt->haveBondeds)
+ {
+ /* We don't have bondeds, so there is nothing to reduce */
+ return;
+ }
/* Determine to which blocks each thread's bonded force calculation
* contributes. Store this as a mask for each thread.
ITYPE ("maxwarn", *maxwarn, 0);
ITYPE ("pieces", *pieces, 1);
EETYPE("asymmetry", *bALLOW_ASYMMETRY, yesno_names);
-
+ check_warning_error(wi, FARGS);
write_inpfile(membed_input, ninp, inp, FALSE, wi);
+ done_warning(wi, FARGS);
}
/* Obtain the maximum and minimum coordinates of the group to be embedded */