Merge branch release-2016
authorMark Abraham <mark.j.abraham@gmail.com>
Tue, 20 Dec 2016 12:03:37 +0000 (23:03 +1100)
committerMark Abraham <mark.j.abraham@gmail.com>
Tue, 20 Dec 2016 12:04:29 +0000 (23:04 +1100)
No conflicts

Change-Id: I175809e0b4f6ebf7dbbe668de66c47c318954b55

CMakeLists.txt
docs/doxygen/includesorter.py
src/gromacs/gmxana/gmx_wham.cpp
src/gromacs/gmxana/gmx_xpm2ps.cpp
src/gromacs/listed-forces/listed-forces.cpp
src/gromacs/listed-forces/listed-internal.h
src/gromacs/listed-forces/manage-threading.cpp
src/programs/mdrun/membed.cpp

index c76572b9b2a8c4a6982575a67e9b53ca5691dc5d..4f0181e0827cab82ae009e815038340e338a36ed 100644 (file)
@@ -491,7 +491,7 @@ if (HWLOC_FOUND)
 
     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)
index 92ac3371085610774d5b04319d3f9ded0058a34c..59666f83001aeae48bb8ae79a9867818aeb2e998 100755 (executable)
@@ -374,6 +374,12 @@ def main():
 
     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 = []
index 2ae134932d0d1ab8d3811000994991a47b77dcbd..3c20dfe16dcaa45ae5ec77479993f646c84ef087 100644 (file)
@@ -3337,7 +3337,8 @@ int gmx_wham(int argc, char *argv[])
         "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",
         "^^^^^^^^^^^^^^^^",
index 4eb173d1d7e7ccaa994bfbec090ccdd249a92424..49c46ba77521cd326a6cc8cecc524a6d35bd0eb0 100644 (file)
@@ -172,6 +172,8 @@ void get_params(const char *mpin, const char *mpout, t_psrec *psr)
     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);
index bf3dbf8a4db1d325b361883c3768847531060fea..47d20f44d3201c11fd739e039a021ad83de22d3b 100644 (file)
@@ -91,6 +91,11 @@ isPairInteraction(int ftype)
 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);
 
@@ -198,6 +203,11 @@ reduce_thread_output(int n, rvec *f, rvec *fshift,
                      gmx_bool bCalcEnerVir,
                      gmx_bool bDHDL)
 {
+    if (!bt->haveBondeds)
+    {
+        return;
+    }
+
     if (bt->nblock_used > 0)
     {
         /* Reduce the bonded force buffer */
@@ -482,6 +492,7 @@ void calc_listed(const t_commrec             *cr,
         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++)
index 7bd21c694926bcbdde471f9ee1b48feb52419098..dbf706d28bd1828c52053a05c3070adda9a4d80b 100644 (file)
@@ -84,6 +84,8 @@ struct bonded_threading_t
     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.
      */
index 4e3642c14b1d2c9d3adb57c2eb90cb08153dcd1d..afc7e84c73ff5f8ff09a1535dfc3dd79e80e33d3 100644 (file)
@@ -45,6 +45,8 @@
 
 #include "manage-threading.h"
 
+#include "config.h"
+
 #include <assert.h>
 #include <limits.h>
 #include <stdlib.h>
@@ -188,7 +190,8 @@ static void divide_bondeds_by_locality(int                 ntype,
 //! 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;
@@ -204,7 +207,8 @@ static void divide_bondeds_over_threads(t_idef *idef,
         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))
@@ -212,6 +216,11 @@ static void divide_bondeds_over_threads(t_idef *idef,
             continue;
         }
 
+        if (idef->il[f].nr > 0)
+        {
+            *haveBondeds = true;
+        }
+
         if (idef->il[f].nr == 0)
         {
             /* No interactions, avoid all the integer math below */
@@ -308,7 +317,16 @@ calc_bonded_reduction_mask(int natoms,
                            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;
 
@@ -374,7 +392,14 @@ void setup_bonded_threading(t_forcerec *fr, t_idef *idef)
     /* 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.
index ce15054cf88be6b169668a73a088d8b695b5f74d..04bc0591f6c70800a88c925cc3b59a3a5dee8db0 100644 (file)
@@ -232,8 +232,9 @@ static void get_input(const char *membed_input, real *xy_fac, real *xy_max, real
     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 */