Merge branch release-5-0
authorMark Abraham <mark.j.abraham@gmail.com>
Sat, 9 May 2015 20:42:50 +0000 (22:42 +0200)
committerMark Abraham <mark.j.abraham@gmail.com>
Sat, 9 May 2015 20:47:07 +0000 (22:47 +0200)
Conflicts:
src/gromacs/mdlib/nbnxn_cuda/nbnxn_cuda.cu

Trivial conflict; resolved preserving both the name change from cu_nb
to nb in master, and bug fix incoming from release-4-6 via
release-5-0.

Bumped copyright headers on BG/Q Platform files

Change-Id: Ie9dc6e674e8ab9b27716cf6d1b7bc5e779ea1bea

cmake/Platform/BlueGeneQ-static-XL-C.cmake
cmake/Platform/BlueGeneQ-static-XL-CXX.cmake
src/gromacs/gmxana/gmx_trjconv.c
src/gromacs/gmxpreprocess/readir.c
src/gromacs/mdlib/nbnxn_cuda/nbnxn_cuda.cu
src/gromacs/mdlib/sim_util.cpp
src/gromacs/simd/impl_x86_avx_128_fma/impl_x86_avx_128_fma.h
src/gromacs/trajectoryanalysis/tests/angle.cpp
src/gromacs/trajectoryanalysis/tests/refdata/AngleModuleTest_HandlesOneVsMultipleVectorGroupsAngles.xml
src/gromacs/utility/futil.cpp
src/programs/mdrun/repl_ex.cpp

index 3999635f62a71c2d933209762a6da1e79399a3c7..d09dc4af10dca481c634a18b55807a85245e5265 100644 (file)
@@ -1,7 +1,7 @@
 #
 # This file is part of the GROMACS molecular simulation package.
 #
-# Copyright (c) 2013,2014, by the GROMACS development team, led by
+# Copyright (c) 2013,2014,2015, 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.
@@ -31,7 +31,7 @@
 #
 # To help us fund GROMACS development, we humbly ask that you cite
 # the research papers on the package. Check out http://www.gromacs.org.
-#
+
 #=============================================================================
 # CMake - Cross Platform Makefile Generator
 # Copyright 2000-2011 Kitware, Inc., Insight Software Consortium
@@ -74,10 +74,7 @@ __BlueGeneQ_set_static_flags(XL C)
 __BlueGeneQ_set_static_flags(XL CXX)
 
 set(CMAKE_SYSTEM_NAME BlueGeneQ-static CACHE STRING "Cross-compiling for BlueGene/Q" FORCE)
-# xl.ndebug is appropriate for production calculations. For debugging,
-# use xl to add back error checks and assertions. Using the
-# thread-safe compiler version is required, so use (e.g.)
-# CMAKE_C_COMPILER=/bgsys/drivers/ppcfloor/comm/xl.ndebug/bin/mpixlc_r
-# CMAKE_CXX_COMPILER=/bgsys/drivers/ppcfloor/comm/xl.ndebug/bin/mpixlcxx_r
+set(CMAKE_C_FLAGS_RELEASE "-O3 -DNDEBUG" CACHE STRING "Compiler optimization flags")
+set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG" CACHE STRING "Compiler optimization flags")
 
 mark_as_advanced(CMAKE_XL_CreateExportList) # No idea what spams this
index 3999635f62a71c2d933209762a6da1e79399a3c7..d09dc4af10dca481c634a18b55807a85245e5265 100644 (file)
@@ -1,7 +1,7 @@
 #
 # This file is part of the GROMACS molecular simulation package.
 #
-# Copyright (c) 2013,2014, by the GROMACS development team, led by
+# Copyright (c) 2013,2014,2015, 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.
@@ -31,7 +31,7 @@
 #
 # To help us fund GROMACS development, we humbly ask that you cite
 # the research papers on the package. Check out http://www.gromacs.org.
-#
+
 #=============================================================================
 # CMake - Cross Platform Makefile Generator
 # Copyright 2000-2011 Kitware, Inc., Insight Software Consortium
@@ -74,10 +74,7 @@ __BlueGeneQ_set_static_flags(XL C)
 __BlueGeneQ_set_static_flags(XL CXX)
 
 set(CMAKE_SYSTEM_NAME BlueGeneQ-static CACHE STRING "Cross-compiling for BlueGene/Q" FORCE)
-# xl.ndebug is appropriate for production calculations. For debugging,
-# use xl to add back error checks and assertions. Using the
-# thread-safe compiler version is required, so use (e.g.)
-# CMAKE_C_COMPILER=/bgsys/drivers/ppcfloor/comm/xl.ndebug/bin/mpixlc_r
-# CMAKE_CXX_COMPILER=/bgsys/drivers/ppcfloor/comm/xl.ndebug/bin/mpixlcxx_r
+set(CMAKE_C_FLAGS_RELEASE "-O3 -DNDEBUG" CACHE STRING "Compiler optimization flags")
+set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG" CACHE STRING "Compiler optimization flags")
 
 mark_as_advanced(CMAKE_XL_CreateExportList) # No idea what spams this
index b1c7a5ed51910d4a73aff9446e4ed8bcb4e1b9d4..1bd02fe2d91e8b6a5671b52767d82394e51ece8c 100644 (file)
@@ -692,9 +692,10 @@ int gmx_trjconv(int argc, char *argv[])
         "Use option [TT]-pbc mol[tt] in addition to [TT]-center[tt] when you",
         "want all molecules in the box after the centering.[PAR]",
 
-        "Option [TT]-box[tt] sets the size of the new box. If you want to"
-        "modify only some of the dimensions, e.g. when reading from a trajectory,"
-        "you can use -1 for those dimensions that should stay the same"
+        "Option [TT]-box[tt] sets the size of the new box. This option only works",
+        "for leading dimensions and is thus generally only useful for rectangular boxes.",
+        "If you want to modify only some of the dimensions, e.g. when reading from",
+        "a trajectory, you can use -1 for those dimensions that should stay the same",
 
         "It is not always possible to use combinations of [TT]-pbc[tt],",
         "[TT]-fit[tt], [TT]-ur[tt] and [TT]-center[tt] to do exactly what",
@@ -1412,13 +1413,23 @@ int gmx_trjconv(int argc, char *argv[])
                 if (bSetBox)
                 {
                     /* generate new box */
-                    clear_mat(fr.box);
+                    if (fr.bBox == FALSE)
+                    {
+                        clear_mat(fr.box);
+                    }
                     for (m = 0; m < DIM; m++)
                     {
                         if (newbox[m] >= 0)
                         {
                             fr.box[m][m] = newbox[m];
                         }
+                        else
+                        {
+                            if (fr.bBox == FALSE)
+                            {
+                                gmx_fatal(FARGS, "Cannot preserve a box that does not exist.\n");
+                            }
+                        }
                     }
                 }
 
index 2d86536b178e5ddbd4077a3c550f8c50bca99fb9..8829e77d6f61afd64e41cd343a2756fd9092787a 100644 (file)
@@ -1775,6 +1775,18 @@ void read_expandedparams(int *ninp_p, t_inpfile **inp_p,
     return;
 }
 
+/*! \brief Return whether an end state with the given coupling-lambda
+ * value describes fully-interacting VDW.
+ *
+ * \param[in]  couple_lambda_value  Enumeration ecouplam value describing the end state
+ * \return                          Whether VDW is on (i.e. the user chose vdw or vdw-q in the .mdp file)
+ */
+static gmx_bool couple_lambda_has_vdw_on(int couple_lambda_value)
+{
+    return (couple_lambda_value == ecouplamVDW ||
+            couple_lambda_value == ecouplamVDWQ);
+}
+
 void get_ir(const char *mdparin, const char *mdparout,
             t_inputrec *ir, t_gromppopts *opts,
             warninp_t wi)
@@ -2423,8 +2435,8 @@ void get_ir(const char *mdparin, const char *mdparout,
          */
         if (ir->efep != efepNO && ir->fepvals->n_lambda == 0 &&
             ir->fepvals->sc_alpha != 0 &&
-            ((opts->couple_lam0 == ecouplamVDW  && opts->couple_lam0 == ecouplamVDWQ) ||
-             (opts->couple_lam1 == ecouplamVDWQ && opts->couple_lam1 == ecouplamVDW)))
+            (couple_lambda_has_vdw_on(opts->couple_lam0) &&
+             couple_lambda_has_vdw_on(opts->couple_lam1)))
         {
             warning(wi, "You are using soft-core interactions while the Van der Waals interactions are not decoupled (note that the sc-coul option is only active when using lambda states). Although this will not lead to errors, you will need much more sampling than without soft-core interactions. Consider using sc-alpha=0.");
         }
index 596345a9756768ad7c83e95e90a2bdff3537e3db..7f1102a8cf110deae40759f6088151cfbb84b8fa 100644 (file)
@@ -341,8 +341,15 @@ void nbnxn_gpu_launch_kernel(gmx_nbnxn_cuda_t       *nb,
     /* turn energy calculation always on/off (for debugging/testing only) */
     bCalcEner = (bCalcEner || always_ener) && !never_ener;
 
-    /* don't launch the kernel if there is no work to do */
-    if (plist->nsci == 0)
+    /* Don't launch the non-local kernel if there is no work to do.
+       Doing the same for the local kernel is more complicated, since the
+       local part of the force array also depends on the non-local kernel.
+       So to avoid complicating the code and to reduce the risk of bugs,
+       we always call the local kernel, the local x+q copy and later (not in
+       this function) the stream wait, local f copyback and the f buffer
+       clearing. All these operations, except for the local interaction kernel,
+       are needed for the non-local interactions. */
+    if (iloc == eintNonlocal && plist->nsci == 0)
     {
         return;
     }
@@ -475,8 +482,8 @@ void nbnxn_gpu_launch_cpyback(gmx_nbnxn_cuda_t       *nb,
     bool             bCalcEner   = flags & GMX_FORCE_ENERGY;
     bool             bCalcFshift = flags & GMX_FORCE_VIRIAL;
 
-    /* don't launch copy-back if there was no work to do */
-    if (nb->plist[iloc]->nsci == 0)
+    /* don't launch non-local copy-back if there was no non-local work to do */
+    if (iloc == eintNonlocal && nb->plist[iloc]->nsci == 0)
     {
         return;
     }
@@ -531,7 +538,7 @@ void nbnxn_gpu_launch_cpyback(gmx_nbnxn_cuda_t       *nb,
     }
 
     /* With DD the local D2H transfer can only start after the non-local
-       has been launched. */
+       kernel has finished. */
     if (iloc == eintLocal && nb->bUseTwoStreams)
     {
         stat = cudaStreamWaitEvent(stream, nb->nonlocal_done, 0);
@@ -544,8 +551,8 @@ void nbnxn_gpu_launch_cpyback(gmx_nbnxn_cuda_t       *nb,
 
     /* After the non-local D2H is launched the nonlocal_done event can be
        recorded which signals that the local D2H can proceed. This event is not
-       placed after the non-local kernel because we first need the non-local
-       data back first. */
+       placed after the non-local kernel because we want the non-local data
+       back first. */
     if (iloc == eintNonlocal)
     {
         stat = cudaEventRecord(nb->nonlocal_done, stream);
@@ -634,12 +641,14 @@ void nbnxn_gpu_wait_for_gpu(gmx_nbnxn_cuda_t *nb,
     /* turn energy calculation always on/off (for debugging/testing only) */
     bCalcEner = (bCalcEner || always_ener) && !never_ener;
 
-    /* don't launch wait/update timers & counters if there was no work to do
+    /* Launch wait/update timers & counters, unless doing the non-local phase
+       when there is not actually work to do. This is consistent with
+       nbnxn_cuda_launch_kernel.
 
        NOTE: if timing with multiple GPUs (streams) becomes possible, the
        counters could end up being inconsistent due to not being incremented
        on some of the nodes! */
-    if (nb->plist[iloc]->nsci == 0)
+    if (iloc == eintNonlocal && nb->plist[iloc]->nsci == 0)
     {
         return;
     }
index 7445698b6a638a499011c55834aa561752e91170..fd4074dde3c7673e0bbe692ac9b196093a680b94 100644 (file)
@@ -1303,7 +1303,7 @@ void do_force_cutsVERLET(FILE *fplog, t_commrec *cr,
             wallcycle_start(wcycle, ewcNB_XF_BUF_OPS);
             wallcycle_sub_start(wcycle, ewcsNB_F_BUF_OPS);
             /* skip the reduction if there was no non-local work to do */
-            if (nbv->grp[eintLocal].nbl_lists.nbl[0]->nsci > 0)
+            if (nbv->grp[eintNonlocal].nbl_lists.nbl[0]->nsci > 0)
             {
                 nbnxn_atomdata_add_nbat_f_to_f(nbv->nbs, eatNonlocal,
                                                nbv->grp[eintNonlocal].nbat, f);
@@ -1398,12 +1398,8 @@ void do_force_cutsVERLET(FILE *fplog, t_commrec *cr,
         }
         wallcycle_start(wcycle, ewcNB_XF_BUF_OPS);
         wallcycle_sub_start(wcycle, ewcsNB_F_BUF_OPS);
-        if (nbv->grp[eintLocal].nbl_lists.nbl[0]->nsci > 0)
-        {
-            /* skip the reduction if there was no non-local work to do */
-            nbnxn_atomdata_add_nbat_f_to_f(nbv->nbs, eatLocal,
-                                           nbv->grp[eintLocal].nbat, f);
-        }
+        nbnxn_atomdata_add_nbat_f_to_f(nbv->nbs, eatLocal,
+                                       nbv->grp[eintLocal].nbat, f);
         wallcycle_sub_stop(wcycle, ewcsNB_F_BUF_OPS);
         wallcycle_stop(wcycle, ewcNB_XF_BUF_OPS);
     }
index c13e847ffa6659c6bf5dc1ea511206c6c4993062..1901b14576705a31643b2402acfe80356df703f2 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2014, by the GROMACS development team, led by
+ * Copyright (c) 2014,2015, 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.
 #define GMX_SIMD4_HAVE_DOUBLE  /* We can use 256-bit operations for this */
 
 /* SINGLE */
-#undef  gmx_simd_fmadd_ps
-#define gmx_simd_fmadd_ps           _mm_macc_ps
-#undef  gmx_simd_fmsub_ps
-#define gmx_simd_fmsub_ps(a, b, c)    _mm_msub_ps
-#undef  gmx_simd_fnmadd_ps
-#define gmx_simd_fnmadd_ps(a, b, c)   _mm_nmacc_ps
-#undef  gmx_simd_fnmsub_ps
-#define gmx_simd_fnmsub_ps(a, b, c)   _mm_nmsub_ps
+#undef  gmx_simd_fmadd_f
+#define gmx_simd_fmadd_f                 _mm_macc_ps
+#undef  gmx_simd_fmsub_f
+#define gmx_simd_fmsub_f                 _mm_msub_ps
+#undef  gmx_simd_fnmadd_f
+#define gmx_simd_fnmadd_f                _mm_nmacc_ps
+#undef  gmx_simd_fnmsub_f
+#define gmx_simd_fnmsub_f                _mm_nmsub_ps
 #undef  gmx_simd_fraction_f
-#define gmx_simd_fraction_f         _mm_frcz_ps
+#define gmx_simd_fraction_f              _mm_frcz_ps
 
 /* DOUBLE */
-#undef  gmx_simd_fmadd_pd
-#define gmx_simd_fmadd_pd            _mm_macc_pd
-#undef  gmx_simd_fmsub_pd
-#define gmx_simd_fmsub_pd(a, b, c)     _mm_msub_pd
-#undef  gmx_simd_fnmadd_pd
-#define gmx_simd_fnmadd_pd(a, b, c)    _mm_nmacc_pd
-#undef  gmx_simd_fnmsub_pd
-#define gmx_simd_fnmsub_pd(a, b, c)    _mm_nmsub_pd
+#undef  gmx_simd_fmadd_d
+#define gmx_simd_fmadd_d                 _mm_macc_pd
+#undef  gmx_simd_fmsub_d
+#define gmx_simd_fmsub_d                 _mm_msub_pd
+#undef  gmx_simd_fnmadd_d
+#define gmx_simd_fnmadd_d                _mm_nmacc_pd
+#undef  gmx_simd_fnmsub_d
+#define gmx_simd_fnmsub_d                _mm_nmsub_pd
 #undef  gmx_simd_fraction_d
-#define gmx_simd_fraction_d          _mm_frcz_pd
+#define gmx_simd_fraction_d              _mm_frcz_pd
 
 /* Even if the _main_ SIMD implementation for this architecture file corresponds
  * to 128-bit AVX (since it will be faster), the 256-bit operations will always
index 94701813fb08dd994ced5de2174cef7c121a2787..8b85aba4bd63c5d6694059634ce4fe58b42ae649 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2012,2013,2014, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015, 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.
@@ -192,7 +192,7 @@ TEST_F(AngleModuleTest, HandlesOneVsMultipleVectorGroupsAngles)
         "angle",
         "-g1", "vector",
         "-group1",
-        "resname RV1 and name A1 A2",
+        "resname RV2 and name A1 A2",
         "resname RV3 RV4 and name A1 A2",
         "-g2", "plane",
         "-group2",
index 954ac5fb4e7059b9e903e335ce4e65be3c3aa869..26f0b5f1da0eb95d679b4399f2af205df334d908 100644 (file)
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
 <ReferenceData>
-  <String Name="CommandLine">angle -g1 vector -group1 'resname RV1 and name A1 A2' 'resname RV3 RV4 and name A1 A2' -g2 plane -group2 'resname RP1 RP2 and name A1 A2 A3' -binw 60</String>
+  <String Name="CommandLine">angle -g1 vector -group1 'resname RV2 and name A1 A2' 'resname RV3 RV4 and name A1 A2' -g2 plane -group2 'resname RP1 RP2 and name A1 A2 A3' -binw 60</String>
   <OutputData Name="Data">
     <AnalysisData Name="angle">
       <DataFrame Name="Frame0">
           <Int Name="Count">2</Int>
           <Int Name="DataSet">0</Int>
           <DataValue>
-            <Real Name="Value">90</Real>
+            <Real Name="Value">180</Real>
           </DataValue>
           <DataValue>
-            <Real Name="Value">120.00000000000001</Real>
+            <Real Name="Value">45</Real>
           </DataValue>
         </DataValues>
         <DataValues>
@@ -34,7 +34,7 @@
         <DataValues>
           <Int Name="Count">2</Int>
           <DataValue>
-            <Real Name="Value">105</Real>
+            <Real Name="Value">112.5</Real>
           </DataValue>
           <DataValue>
             <Real Name="Value">112.5</Real>
@@ -48,7 +48,7 @@
         <DataValues>
           <Int Name="Count">2</Int>
           <DataValue>
-            <Real Name="Value">0</Real>
+            <Real Name="Value">0.0083333333333333332</Real>
             <Real Name="Error">0</Real>
           </DataValue>
           <DataValue>
@@ -62,7 +62,7 @@
         <DataValues>
           <Int Name="Count">2</Int>
           <DataValue>
-            <Real Name="Value">0.0083333333333333332</Real>
+            <Real Name="Value">0</Real>
             <Real Name="Error">0</Real>
           </DataValue>
           <DataValue>
index 535c7e93f1ef816f44b2882b1efa2c7d0bfa2771..55285b292be7a7478f34024929a35b9de2da0697 100644 (file)
@@ -587,19 +587,10 @@ void gmx_tmpnam(char *buf)
 #else
     int fd = mkstemp(buf);
 
-    switch (fd)
-    {
-        case EINVAL:
-            gmx_fatal(FARGS, "Invalid template %s for mkstemp", buf);
-            break;
-        case EEXIST:
-            gmx_fatal(FARGS, "mkstemp created existing file", buf);
-            break;
-        case EACCES:
-            gmx_fatal(FARGS, "Permission denied for opening %s", buf);
-            break;
-        default:
-            break;
+    if (fd < 0)
+    {
+        gmx_fatal(FARGS, "Creating temporary file %s: %s", buf,
+                  strerror(errno));
     }
     close(fd);
 #endif
index a85216beab4e592526333a745961210f507b63f5..4b0e81063a0d383606a9bb2bcb00080d8ac89990 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) 2011,2012,2013,2014, by the GROMACS development team, led by
+ * Copyright (c) 2011,2012,2013,2014,2015, 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.
@@ -402,7 +402,7 @@ gmx_repl_ex_t init_replica_exchange(FILE *fplog,
     snew(re->order, re->nrepl);
     for (i = 0; i < re->nrepl; i++)
     {
-        snew(re->cyclic[i], re->nrepl);
+        snew(re->cyclic[i], re->nrepl+1);
         snew(re->order[i], re->nrepl);
     }
     /* allocate space for the functions storing the data for the replicas */