Merge branch 'release-2018' into master
authorAleksei Iupinov <a.yupinov@gmail.com>
Thu, 8 Feb 2018 10:47:06 +0000 (11:47 +0100)
committerAleksei Iupinov <a.yupinov@gmail.com>
Thu, 8 Feb 2018 10:48:10 +0000 (11:48 +0100)
Manually modified:
src/programs/mdrun/md.cpp (to uncomment done_ebin())

Change-Id: Ic3887c40668f69e69ee8da15d210721b8bd3e95f

20 files changed:
docs/release-notes/performance.rst
src/external/lmfit/lmmin.cpp
src/gromacs/gmxlib/nonbonded/nb_generic.cpp
src/gromacs/listed-forces/bonded.cpp
src/gromacs/mdlib/ebin.cpp
src/gromacs/mdlib/ebin.h
src/gromacs/mdlib/forcerec.cpp
src/gromacs/mdlib/mdebin.cpp
src/gromacs/mdlib/tests/CMakeLists.txt
src/gromacs/mdlib/tests/mdebin.cpp [new file with mode: 0644]
src/gromacs/mdlib/tests/refdata/PrintEbin_pr_ebin_HandlesAverages.xml [new file with mode: 0644]
src/gromacs/mdlib/tests/refdata/PrintEbin_pr_ebin_HandlesEmptyAverages.xml [new file with mode: 0644]
src/gromacs/mdlib/tests/refdata/PrintEbin_print_ebin_HandlesEmptyAverages.xml [new file with mode: 0644]
src/gromacs/mdlib/tpi.cpp
src/gromacs/simd/impl_x86_avx_512/impl_x86_avx_512_util_double.h
src/gromacs/simd/impl_x86_avx_512/impl_x86_avx_512_util_float.h
src/programs/mdrun/md.cpp
src/programs/mdrun/tests/termination.cpp
src/programs/mdrun/tests/terminationhelper.cpp
src/programs/mdrun/tests/terminationhelper.h

index a8c4fe2b43cdbd3b97ddf1f3ca50ad6bf990aa0e..4308ca9b592d035a93aa4b3cd0ecee5a56aee0ad 100644 (file)
@@ -70,10 +70,6 @@ AVX_128_FMA and AVX_256 extensions. But hardware that supports the new
 AVX2_128 extensions also supports AVX_256, so we enable such support
 for the group-scheme kernels.
 
-Improved Ewald-style short-ranged interactions on Intel Skylake CPUs
-""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
-These now default to use tabulated Ewald short-ranged interactions.
-
 Detect AVX-512 FMA units to choose best SIMD
 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 Recent Intel x86 hardware can have multiple AVX-512 FMA units, and the
index 4da012d0f389e44f93857e2e052a786e2d9c1c80..eb2d29893529c002b1e16db912f5cf120d02633d 100644 (file)
@@ -232,7 +232,7 @@ void lmmin(const int n, double* x, const int m, const void* data,
     if (C->verbosity)
         fprintf(msgfile, "  fnorm = %18.8g\n", fnorm);
 
-    if (!isfinite(fnorm)) {
+    if (!std::isfinite(fnorm)) {
         S->outcome = 12; /* nan */
         goto terminate;
     } else if (fnorm <= LM_DWARF) {
@@ -354,7 +354,7 @@ void lmmin(const int n, double* x, const int m, const void* data,
             } else {
                 xnorm = lm_enorm(n, x);
             }
-            if (!isfinite(xnorm)) {
+            if (!std::isfinite(xnorm)) {
                 S->outcome = 12; /* nan */
                 goto terminate;
             }
@@ -381,7 +381,7 @@ void lmmin(const int n, double* x, const int m, const void* data,
 
             /* Predict scaled reduction. */
             pnorm = lm_enorm(n, wa3);
-            if (!isfinite(pnorm)) {
+            if (!std::isfinite(pnorm)) {
                 S->outcome = 12; /* nan */
                 goto terminate;
             }
@@ -392,7 +392,7 @@ void lmmin(const int n, double* x, const int m, const void* data,
                     wa3[i] -= fjac[j*m+i] * wa1[Pivot[j]];
             }
             temp1 = SQR(lm_enorm(n, wa3) / fnorm);
-            if (!isfinite(temp1)) {
+            if (!std::isfinite(temp1)) {
                 S->outcome = 12; /* nan */
                 goto terminate;
             }
@@ -411,7 +411,7 @@ void lmmin(const int n, double* x, const int m, const void* data,
             if (S->userbreak)
                 goto terminate;
             fnorm1 = lm_enorm(m, wf);
-            if (!isfinite(fnorm1)) {
+            if (!std::isfinite(fnorm1)) {
                 S->outcome = 12; /* nan */
                 goto terminate;
             }
@@ -472,7 +472,7 @@ void lmmin(const int n, double* x, const int m, const void* data,
                 for (i = 0; i < m; i++)
                     fvec[i] = wf[i];
                 xnorm = lm_enorm(n, wa2);
-                if (!isfinite(xnorm)) {
+                if (!std::isfinite(xnorm)) {
                     S->outcome = 12; /* nan */
                     goto terminate;
                 }
index b9ca9c77539c1cdfdef620c8a427ff147908b137..d95223a1b37005b9f6e7fa7cd36282d2c485c90f 100644 (file)
@@ -122,9 +122,17 @@ gmx_nb_generic_kernel(t_nblist *                nlist,
 
     const interaction_const_t *ic = fr->ic;
 
-    ewtab               = ic->tabq_coul_FDV0;
-    ewtabscale          = ic->tabq_scale;
-    ewtabhalfspace      = 0.5/ewtabscale;
+    if (ielec == GMX_NBKERNEL_ELEC_EWALD)
+    {
+        ewtab               = ic->tabq_coul_FDV0;
+        ewtabscale          = ic->tabq_scale;
+        ewtabhalfspace      = 0.5/ewtabscale;
+    }
+    else
+    {
+        ewtab          = nullptr;
+        ewtabhalfspace = ewtabscale = 0;
+    }
 
     rcoulomb2           = ic->rcoulomb*ic->rcoulomb;
     rvdw                = ic->rvdw;
index c949572a2afc2f2fcedc2b70eee4cf166556f4c7..c776c92f8fdaaddf4d407531ca611ab2e074ca10 100644 (file)
@@ -379,7 +379,7 @@ real bonds(int nbonds,
 
         ki   = pbc_rvec_sub(pbc, x[ai], x[aj], dx); /*   3      */
         dr2  = iprod(dx, dx);                       /*   5             */
-        dr   = dr2*gmx::invsqrt(dr2);               /*  10             */
+        dr   = std::sqrt(dr2);                      /*  10             */
 
         *dvdlambda += harmonic(forceparams[type].harmonic.krA,
                                forceparams[type].harmonic.krB,
index b91ba7036b7601d6b6614d51059caf5671f7df2a..ccc2b46064fd8975bd7a203ed13a7bf65b39589b 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
  * Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2012,2014,2015,2017, by the GROMACS development team, led by
+ * Copyright (c) 2012,2014,2015,2017,2018, 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.
@@ -60,6 +60,18 @@ t_ebin *mk_ebin(void)
     return eb;
 }
 
+void done_ebin(t_ebin *eb)
+{
+    for (int i = 0; i < eb->nener; i++)
+    {
+        sfree(eb->enm[i].name);
+        sfree(eb->enm[i].unit);
+    }
+    sfree(eb->e);
+    sfree(eb->e_sim);
+    sfree(eb->enm);
+}
+
 int get_ebin_space(t_ebin *eb, int nener, const char *enm[], const char *unit)
 {
     int         index;
@@ -116,7 +128,7 @@ int get_ebin_space(t_ebin *eb, int nener, const char *enm[], const char *unit)
     return index;
 }
 
-void add_ebin(t_ebin *eb, int index, int nener, real ener[], gmx_bool bSum)
+void add_ebin(t_ebin *eb, int index, int nener, const real ener[], gmx_bool bSum)
 {
     int       i, m;
     double    e, invmm, diff;
@@ -192,30 +204,31 @@ void pr_ebin(FILE *fp, t_ebin *eb, int index, int nener, int nperline,
              int prmode, gmx_bool bPrHead)
 {
     int  i, j, i0;
-    real ee = 0;
     int  rc;
     char buf[30];
 
     rc = 0;
 
-    if (index < 0)
+    if (index < 0 || index > eb->nener)
     {
         gmx_fatal(FARGS, "Invalid index in pr_ebin: %d", index);
     }
-    if (nener == -1)
+    int start = index;
+    if (nener > eb->nener)
     {
-        nener = eb->nener;
+        gmx_fatal(FARGS, "Invalid nener in pr_ebin: %d", nener);
     }
-    else
+    int end = eb->nener;
+    if (nener != -1)
     {
-        nener = index + nener;
+        end = index + nener;
     }
-    for (i = index; (i < nener) && rc >= 0; )
+    for (i = start; (i < end) && rc >= 0; )
     {
         if (bPrHead)
         {
             i0 = i;
-            for (j = 0; (j < nperline) && (i < nener) && rc >= 0; j++, i++)
+            for (j = 0; (j < nperline) && (i < end) && rc >= 0; j++, i++)
             {
                 if (strncmp(eb->enm[i].name, "Pres", 4) == 0)
                 {
@@ -236,17 +249,27 @@ void pr_ebin(FILE *fp, t_ebin *eb, int index, int nener, int nperline,
 
             i = i0;
         }
-        for (j = 0; (j < nperline) && (i < nener) && rc >= 0; j++, i++)
+        for (j = 0; (j < nperline) && (i < end) && rc >= 0; j++, i++)
         {
             switch (prmode)
             {
-                case eprNORMAL: ee = eb->e[i].e; break;
-                case eprAVER:   ee = eb->e_sim[i].esum/eb->nsum_sim; break;
+                case eprNORMAL:
+                    rc = fprintf(fp, "   %12.5e", eb->e[i].e);
+                    break;
+                case eprAVER:
+                    if (eb->nsum_sim > 0)
+                    {
+                        rc = fprintf(fp, "   %12.5e", eb->e_sim[i].esum/eb->nsum_sim);
+                    }
+                    else
+                    {
+                        rc = fprintf(fp, "    %-12s", "N/A");
+                    }
+                    break;
                 default: gmx_fatal(FARGS, "Invalid print mode %d in pr_ebin",
                                    prmode);
             }
 
-            rc = fprintf(fp, "   %12.5e", ee);
         }
         if (rc >= 0)
         {
index 406ffa6361174a86c02c62cb363cc10e6eaf7545..8f53f1648e8e5e5f9856e1d13560da6bd2c7083a 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
  * Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2018, 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.
@@ -62,6 +62,9 @@ enum {
 t_ebin *mk_ebin(void);
 /* Create an energy bin */
 
+//! Empty the contents of \c eb.
+void done_ebin(t_ebin *eb);
+
 int get_ebin_space(t_ebin *eb, int nener, const char *enm[], const char *unit);
 
 /* Create space in the energy bin and register names.
@@ -71,7 +74,7 @@ int get_ebin_space(t_ebin *eb, int nener, const char *enm[], const char *unit);
  * calls to add_ebin.
  */
 
-void add_ebin(t_ebin *eb, int index, int nener, real ener[], gmx_bool bSum);
+void add_ebin(t_ebin *eb, int index, int nener, const real ener[], gmx_bool bSum);
 /* Add nener reals (eg. energies, box-lengths, pressures) to the
  * energy bin at position index.
  * If bSum is TRUE then the reals are also added to the sum
@@ -86,13 +89,19 @@ void ebin_increase_count(t_ebin *eb, gmx_bool bSum);
 void reset_ebin_sums(t_ebin *eb);
 /* Reset the average and fluctuation sums */
 
+/*! \brief Print the contents of some energy bins.
+ *
+ * We will print nperline entries on a text line (advisory <=
+ * 5). prmode may be any of the above listed enum values. tsteps is
+ * used only when eprAVER or eprRMS is set. If bPrHead than the
+ * header is printed.
+ *
+ * \c index and \c nener must be in [0, eb->nener), except that \c
+ * nener -1 is interpreted as eb->nener.
+ *
+ * \todo Callers should be refactored pass eb->nener, rather than
+ * us implement and rely on this special behaviour of -1. */
 void pr_ebin(FILE *fp, t_ebin *eb, int index, int nener, int nperline,
              int prmode, gmx_bool bPrHead);
-/* Print the contents of the energy bin. If nener = -1 ALL energies from
- * index to the end will be printed. We will print nperline entries on a text
- * line (advisory <= 5). prmode may be any of the above listed enum values.
- * tsteps is used only when eprAVER or eprRMS is set.
- * If bPrHead than the header is printed.
- */
 
 #endif
index 40366f4484e2c418402538d89069c3145b8b85f1..401994a6817827b6f1918ec20cd603a7385006f1 100644 (file)
@@ -2646,6 +2646,7 @@ void init_forcerec(FILE                    *fp,
             gmx_fatal(FARGS, "Unsupported electrostatic interaction: %s", eel_names[ic->eeltype]);
             break;
     }
+    fr->nbkernel_elec_modifier = ic->coulomb_modifier;
 
     /* Vdw: Translate from mdp settings to kernel format */
     switch (ic->vdwtype)
@@ -2675,6 +2676,7 @@ void init_forcerec(FILE                    *fp,
             gmx_fatal(FARGS, "Unsupported vdw interaction: %s", evdw_names[ic->vdwtype]);
             break;
     }
+    fr->nbkernel_vdw_modifier = ic->vdw_modifier;
 
     if (ir->cutoff_scheme == ecutsGROUP)
     {
index 3858ba527df6bda7016cbd9fa2cb4f6474404ff5..b7c3513a4c67abaecb049e8be8cb70f03922a082 100644 (file)
@@ -1229,6 +1229,8 @@ void print_ebin_header(FILE *log, gmx_int64_t steps, double time)
             "Step", "Time", gmx_step_str(steps, buf), time);
 }
 
+// TODO It is too many responsibilities for this function to handle
+// both .edr and .log output for both per-time and time-average data.
 void print_ebin(ener_file_t fp_ene, gmx_bool bEne, gmx_bool bDR, gmx_bool bOR,
                 FILE *log,
                 gmx_int64_t step, double time,
@@ -1251,6 +1253,15 @@ void print_ebin(ener_file_t fp_ene, gmx_bool bEne, gmx_bool bDR, gmx_bool bOR,
 
     t_enxframe   fr;
 
+    if (mode == eprAVER && md->ebin->nsum_sim <= 0)
+    {
+        if (log)
+        {
+            fprintf(log, "Not enough data recorded to report energy averages\n");
+        }
+        return;
+    }
+
     switch (mode)
     {
         case eprNORMAL:
index fbcf73f88f679f35afb7d4afe2a79de06f2e30ac..5bfa99cd1a4e3263daeb2f193db9a65cb0cc86af 100644 (file)
@@ -1,7 +1,7 @@
 #
 # This file is part of the GROMACS molecular simulation package.
 #
-# Copyright (c) 2014,2016,2017, by the GROMACS development team, led by
+# Copyright (c) 2014,2016,2017,2018, 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.
@@ -34,6 +34,7 @@
 
 gmx_add_unit_test(MdlibUnitTest mdlib-test
                   calc_verletbuf.cpp
+                  mdebin.cpp
                   settle.cpp
                   shake.cpp
                   simulationsignal.cpp)
diff --git a/src/gromacs/mdlib/tests/mdebin.cpp b/src/gromacs/mdlib/tests/mdebin.cpp
new file mode 100644 (file)
index 0000000..6b2cba8
--- /dev/null
@@ -0,0 +1,159 @@
+/*
+ * This file is part of the GROMACS molecular simulation package.
+ *
+ * Copyright (c) 2018, 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.
+ *
+ * GROMACS is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1
+ * of the License, or (at your option) any later version.
+ *
+ * GROMACS is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with GROMACS; if not, see
+ * http://www.gnu.org/licenses, or write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA.
+ *
+ * If you want to redistribute modifications to GROMACS, please
+ * consider that scientific software is very special. Version
+ * control is crucial - bugs must be traceable. We will be happy to
+ * consider code for inclusion in the official distribution, but
+ * derived work must not be called official GROMACS. Details are found
+ * in the README & COPYING files - if they are missing, get the
+ * official version at http://www.gromacs.org.
+ *
+ * To help us fund GROMACS development, we humbly ask that you cite
+ * the research papers on the package. Check out http://www.gromacs.org.
+ */
+#include "gmxpre.h"
+
+#include "gromacs/mdlib/mdebin.h"
+
+#include <cstdio>
+
+#include <gtest/gtest.h>
+
+#include "gromacs/utility/textreader.h"
+#include "gromacs/utility/unique_cptr.h"
+
+#include "testutils/refdata.h"
+#include "testutils/testasserts.h"
+#include "testutils/testfilemanager.h"
+
+namespace gmx
+{
+namespace test
+{
+namespace
+{
+
+//! Wraps fclose to discard the return value to use it as a deleter with gmx::unique_cptr.
+void fcloseWrapper(FILE *fp)
+{
+    fclose(fp);
+}
+
+class PrintEbin : public ::testing::Test
+{
+    public:
+        t_ebin                         ebin_;
+        unique_cptr<t_ebin, done_ebin> ebinGuard_;
+        t_mdebin                       mdebin_;
+
+        TestFileManager                fileManager_;
+        // TODO This will be more elegant (and run faster) when we
+        // refactor the output routines to write to a stream
+        // interface, which can already be handled in-memory when
+        // running tests.
+        std::string logFilename_;
+        FILE       *log_;
+        unique_cptr<FILE, fcloseWrapper> logFileGuard_;
+
+        TestReferenceData                refData_;
+        TestReferenceChecker             checker_;
+
+        PrintEbin() : ebin_ {0}, ebinGuard_(&ebin_), mdebin_ {0},
+        fileManager_(), logFilename_(fileManager_.getTemporaryFilePath(".log")),
+        log_(std::fopen(logFilename_.c_str(), "w")), logFileGuard_(log_),
+        refData_ {}, checker_(refData_.rootChecker())
+        {
+            mdebin_.ebin = &ebin_;
+        }
+};
+
+TEST_F(PrintEbin, print_ebin_HandlesEmptyAverages)
+{
+    ASSERT_NE(log_, nullptr);
+
+    // Test print_ebin
+    print_ebin(nullptr, false, false, false, log_,
+               0, 0, eprAVER,
+               &mdebin_, nullptr, nullptr, nullptr, nullptr);
+
+    // We need to close the file before the contents are available.
+    logFileGuard_.reset(nullptr);
+
+    checker_.checkString(TextReader::readFileToString(logFilename_), "log");
+}
+
+// TODO Ideally we'd test for proper output of a normal t_mdebin, but
+// building one is a lot of work for limited value.
+
+TEST_F(PrintEbin, pr_ebin_HandlesAverages)
+{
+    ASSERT_NE(log_, nullptr);
+
+    // Set up the energy entries
+    const char *firstName[]      = {"first"};
+    const char *secondName[]     = {"second"};
+    int         first            = get_ebin_space(mdebin_.ebin, 1, firstName, nullptr);
+    int         second           = get_ebin_space(mdebin_.ebin, 1, secondName, nullptr);
+
+    // Put some data into the energy entries
+    const real  timevalues[2][2] = { { 1.0, 10.0}, {2.0, 20.0} };
+    gmx_bool    bSum             = true;
+    for (const auto &values : timevalues)
+    {
+        add_ebin(mdebin_.ebin, first, 1, &values[0], bSum);
+        add_ebin(mdebin_.ebin, second, 1, &values[1], bSum);
+        ebin_increase_count(mdebin_.ebin, bSum);
+    }
+
+    // Test pr_ebin
+    pr_ebin(log_, &ebin_, 0, 2, 5, eprAVER, true);
+
+    // We need to close the file before the contents are available.
+    logFileGuard_.reset(nullptr);
+
+    checker_.checkString(TextReader::readFileToString(logFilename_), "log");
+}
+
+TEST_F(PrintEbin, pr_ebin_HandlesEmptyAverages)
+{
+    ASSERT_NE(log_, nullptr);
+
+    // Set up the energy entries
+    const char *firstName[]      = {"first"};
+    const char *secondName[]     = {"second"};
+    get_ebin_space(mdebin_.ebin, 1, firstName, nullptr);
+    get_ebin_space(mdebin_.ebin, 1, secondName, nullptr);
+
+    // Test pr_ebin
+    pr_ebin(log_, &ebin_, 0, 2, 5, eprAVER, true);
+
+    // We need to close the file before the contents are available.
+    logFileGuard_.reset(nullptr);
+
+    checker_.checkString(TextReader::readFileToString(logFilename_), "log");
+}
+
+}      // namespace
+}      // namespace
+}      // namespace
diff --git a/src/gromacs/mdlib/tests/refdata/PrintEbin_pr_ebin_HandlesAverages.xml b/src/gromacs/mdlib/tests/refdata/PrintEbin_pr_ebin_HandlesAverages.xml
new file mode 100644 (file)
index 0000000..1999b92
--- /dev/null
@@ -0,0 +1,7 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
+<ReferenceData>
+  <String Name="log">          first         second
+    1.50000e+00    1.50000e+01
+</String>
+</ReferenceData>
diff --git a/src/gromacs/mdlib/tests/refdata/PrintEbin_pr_ebin_HandlesEmptyAverages.xml b/src/gromacs/mdlib/tests/refdata/PrintEbin_pr_ebin_HandlesEmptyAverages.xml
new file mode 100644 (file)
index 0000000..272c433
--- /dev/null
@@ -0,0 +1,7 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
+<ReferenceData>
+  <String Name="log">          first         second
+    N/A             N/A         
+</String>
+</ReferenceData>
diff --git a/src/gromacs/mdlib/tests/refdata/PrintEbin_print_ebin_HandlesEmptyAverages.xml b/src/gromacs/mdlib/tests/refdata/PrintEbin_print_ebin_HandlesEmptyAverages.xml
new file mode 100644 (file)
index 0000000..8392469
--- /dev/null
@@ -0,0 +1,6 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
+<ReferenceData>
+  <String Name="log">Not enough data recorded to report energy averages
+</String>
+</ReferenceData>
index b284487a1fe82cd37bec7b063e32c4eba44f650a..eae59c1a7069267c73784e43b650deac02b38b94 100644 (file)
@@ -291,7 +291,7 @@ double do_tpi(FILE *fplog, t_commrec *cr, const gmx::MDLogger gmx_unused &mdlog,
     /* We need to allocate one element extra, since we might use
      * (unaligned) 4-wide SIMD loads to access rvec entries.
      */
-    f.resize(top_global->natoms + 1);
+    f.resize(gmx::paddedRVecVectorSize(top_global->natoms));
 
     /* Print to log file  */
     walltime_accounting_start(walltime_accounting);
index 8bb451d55064639519e87a55b48df63c0e2e62c9..3d938b4c20c5d58bedc1e2ef73d5031c7888cea8 100644 (file)
@@ -103,23 +103,23 @@ gatherLoadBySimdIntTranspose(const double * base, SimdDInt32 offset, SimdDouble
 
 template <int align, typename ... Targs>
 static inline void gmx_simdcall
-gatherLoadUBySimdIntTranspose(const double *base, SimdDInt32 offset, Targs... Fargs)
+gatherLoadUBySimdIntTranspose(const double *base, SimdDInt32 offset, SimdDouble *v, Targs... Fargs)
 {
-    gatherLoadBySimdIntTranspose<align>(base, offset, Fargs ...);
+    gatherLoadBySimdIntTranspose<align>(base, offset, v, Fargs ...);
 }
 
 template <int align, typename ... Targs>
 static inline void gmx_simdcall
-gatherLoadTranspose(const double *base, const std::int32_t offset[], Targs... Fargs)
+gatherLoadTranspose(const double *base, const std::int32_t offset[], SimdDouble *v, Targs... Fargs)
 {
-    gatherLoadBySimdIntTranspose<align>(base, simdLoad(offset, SimdDInt32Tag()), Fargs ...);
+    gatherLoadBySimdIntTranspose<align>(base, simdLoad(offset, SimdDInt32Tag()), v, Fargs ...);
 }
 
 template <int align, typename ... Targs>
 static inline void gmx_simdcall
-gatherLoadUTranspose(const double *base, const std::int32_t offset[], Targs... Fargs)
+gatherLoadUTranspose(const double *base, const std::int32_t offset[], SimdDouble *v, Targs... Fargs)
 {
-    gatherLoadTranspose<align>(base, offset, Fargs ...);
+    gatherLoadBySimdIntTranspose<align>(base, simdLoad(offset, SimdDInt32Tag()), v, Fargs ...);
 }
 
 template <int align>
index 6f6bf175a419ee3cace07926f9e3238547b5124b..c9e290bc1234e8656eacb5863bb9361d33a7f830 100644 (file)
@@ -105,23 +105,23 @@ gatherLoadBySimdIntTranspose(const float *base, SimdFInt32 offset, SimdFloat *v,
 
 template <int align, typename ... Targs>
 static inline void gmx_simdcall
-gatherLoadUBySimdIntTranspose(const float *base, SimdFInt32 offset, Targs... Fargs)
+gatherLoadUBySimdIntTranspose(const float *base, SimdFInt32 offset, SimdFloat *v, Targs... Fargs)
 {
-    gatherLoadBySimdIntTranspose<align>(base, offset, Fargs ...);
+    gatherLoadBySimdIntTranspose<align>(base, offset, v, Fargs ...);
 }
 
 template <int align, typename ... Targs>
 static inline void gmx_simdcall
-gatherLoadTranspose(const float *base, const std::int32_t offset[], Targs... Fargs)
+gatherLoadTranspose(const float *base, const std::int32_t offset[], SimdFloat *v, Targs... Fargs)
 {
-    gatherLoadBySimdIntTranspose<align>(base, simdLoad(offset, SimdFInt32Tag()), Fargs ...);
+    gatherLoadBySimdIntTranspose<align>(base, simdLoad(offset, SimdFInt32Tag()), v, Fargs ...);
 }
 
 template <int align, typename ... Targs>
 static inline void gmx_simdcall
-gatherLoadUTranspose(const float *base, const std::int32_t offset[], Targs... Fargs)
+gatherLoadUTranspose(const float *base, const std::int32_t offset[], SimdFloat *v, Targs... Fargs)
 {
-    gatherLoadTranspose<align>(base, offset, Fargs ...);
+    gatherLoadBySimdIntTranspose<align>(base, simdLoad(offset, SimdFInt32Tag()), v, Fargs ...);
 }
 
 template <int align>
index bda2386e9ba38682a3136781234ff52d87c274a1..add69850754014f5fb7cbdf0a4742eba54bed71c 100644 (file)
@@ -1984,7 +1984,7 @@ double gmx::do_md(FILE *fplog, t_commrec *cr, const gmx::MDLogger &mdlog,
                        eprAVER, mdebin, fcd, groups, &(ir->opts), ir->awh);
         }
     }
-
+    done_ebin(mdebin->ebin);
     done_mdoutf(outf);
 
     if (bPMETune)
index 3ab7316310e5926ed65a5e3274c373d8406e7197..bce57464a115833eea6b94f4945ac74986548585 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2016,2017, by the GROMACS development team, led by
+ * Copyright (c) 2016,2017,2018, 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.
@@ -81,5 +81,18 @@ TEST_F(MdrunTerminationTest, WritesCheckpointAfterMaxhTerminationAndThenRestarts
     helper.runSecondMdrun();
 }
 
+TEST_F(MdrunTerminationTest, CheckpointRestartWorksWithNoAppend)
+{
+    CommandLine       mdrunCaller;
+    mdrunCaller.append("mdrun");
+    TerminationHelper helper(&fileManager_, &mdrunCaller, &runner_);
+
+    organizeMdpFile(&runner_);
+    EXPECT_EQ(0, runner_.callGrompp());
+
+    helper.runFirstMdrun(runner_.cptFileName_);
+    helper.runSecondMdrunWithNoAppend();
+}
+
 } // namespace
 } // namespace
index 361ffcbec85c9ca1bbd2cae8ecb10fbec6030fb6..34c6225437b6ec9d4e2d80be5b98b1786a02413d 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2016, by the GROMACS development team, led by
+ * Copyright (c) 2016,2018, 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.
@@ -84,5 +84,14 @@ void TerminationHelper::runSecondMdrun()
     ASSERT_EQ(0, runner_->callMdrun(secondPart));
 }
 
+void TerminationHelper::runSecondMdrunWithNoAppend()
+{
+    CommandLine secondPart(*mdrunCaller_);
+    secondPart.addOption("-cpi", runner_->cptFileName_);
+    secondPart.addOption("-nsteps", 2);
+    secondPart.append("-noappend");
+    ASSERT_EQ(0, runner_->callMdrun(secondPart));
+}
+
 } // namespace
 } // namespace
index ad765e375057529799285f2911e13dcd06bef2a7..e9c1a8e13098c619adffd75f6daf8a42c529bc57 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2016, by the GROMACS development team, led by
+ * Copyright (c) 2016,2018, 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.
@@ -84,6 +84,8 @@ class TerminationHelper
         void runFirstMdrun(const std::string &expectedCptFileName);
         //! Check that the restart works, but don't do any more MD steps.
         void runSecondMdrun();
+        //! Check that the restart works without appending, but don't do any more MD steps.
+        void runSecondMdrunWithNoAppend();
     protected:
         //! Object to help call mdrun
         CommandLine      *mdrunCaller_;