From 6be1d47d3a14921fce14d3527a51fd6d36a271e4 Mon Sep 17 00:00:00 2001 From: Mark Abraham Date: Fri, 20 Jan 2017 11:43:43 +0100 Subject: [PATCH 01/20] Introduced system preparation section to user guide This gives us somewhere we could document the use and limitations of vdwradii.dat better. Enchanced documentation of solvate and insert-molecules, similarly. Refs #2094 Change-Id: I019948472dfc308c1acd74d4fce271ba4d481ead --- docs/CMakeLists.txt | 3 +- docs/user-guide/index.rst | 1 + docs/user-guide/system-preparation.rst | 130 ++++++++++++++++++ .../gmxpreprocess/insert-molecules.cpp | 6 +- src/gromacs/gmxpreprocess/solvate.cpp | 10 +- 5 files changed, 143 insertions(+), 7 deletions(-) create mode 100644 docs/user-guide/system-preparation.rst diff --git a/docs/CMakeLists.txt b/docs/CMakeLists.txt index ec6e4550ef..b4ed183113 100644 --- a/docs/CMakeLists.txt +++ b/docs/CMakeLists.txt @@ -1,7 +1,7 @@ # # This file is part of the GROMACS molecular simulation package. # -# Copyright (c) 2014,2015,2016, by the GROMACS development team, led by +# Copyright (c) 2014,2015,2016,2017, 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. @@ -120,6 +120,7 @@ if (SPHINX_FOUND) user-guide/index.rst user-guide/getting-started.rst user-guide/flow.rst + user-guide/system-preparation.rst user-guide/cutoff-schemes.rst user-guide/mdrun-features.rst user-guide/mdrun-performance.rst diff --git a/docs/user-guide/index.rst b/docs/user-guide/index.rst index df631e5398..625c3d53ac 100644 --- a/docs/user-guide/index.rst +++ b/docs/user-guide/index.rst @@ -20,6 +20,7 @@ For background on algorithms and implementations, see the :maxdepth: 2 getting-started + system-preparation cutoff-schemes mdrun-features mdrun-performance diff --git a/docs/user-guide/system-preparation.rst b/docs/user-guide/system-preparation.rst new file mode 100644 index 0000000000..08e31ca9f7 --- /dev/null +++ b/docs/user-guide/system-preparation.rst @@ -0,0 +1,130 @@ +System preparation +================== + +.. toctree:: + :hidden: + +There are many ways to prepare a simulation system to run with +|Gromacs|. These often vary with the kind of scientific question being +considered, or the model physics involved. A protein-ligand atomistic +free-energy simulation might need a multi-state topology, while a +coarse-grained simulation might need to manage defaults that suit +systems with higher density. + +Steps to consider +----------------- + +The following general guidance should help with planning successful +simulations. Some stages are optional for some kinds of simulations. + +1. Clearly identify the property or phenomena of interest to be + studied by performing the simulation. Do not continue further until + you are clear on this! Do not run your simulation and then seek to + work out how to use it to test your hypothesis, because it may be + unsuitable, or the required information was not saved. + +2. Select the appropriate tools to be able to perform the simulation + and observe the property or phenomena of interest. It is important + to read and familiarize yourself with publications by other + researchers on similar systems. Choices of tools include: + + - software with which to perform the simulation (consideration of + force field may influence this decision) + + - the force field, which describes how the particles within the + system interact with each other. Select one that is appropriate + for the system being studied and the property or phenomena of + interest. This is a very important and non-trivial step! Consider + now how you will analyze your simulation data to make your + observations. + +3. Obtain or generate the initial coordinate file for each molecule to + be placed within the system. Many different software packages are + able to build molecular structures and assemble them into suitable + configurations. + +4. Generate the raw starting structure for the system by placing the + molecules within the coordinate file as appropriate. Molecules may + be specifically placed or arranged randomly. Several non-|Gromacs| + tools are useful here; within |Gromacs| :ref:`gmx solvate`, + :ref:`gmx insert-molecules` and :ref:`gmx genconf` solve frequent + problems. + +5. Obtain or generate the topology file for the system, using (for + example) :ref:`gmx pdb2gmx`, :ref:`gmx x2top`, `SwissParam + `_ (for CHARMM forcefield), `PRODRG + `_ (for GROMOS96 + 43A1), `Automated Topology Builder + `_ (for GROMOS96 53A6), + `MKTOP `_ (for OPLS/AA) or your + favourite text editor in concert with chapter 5 of the |Gromacs| + `Reference Manual`_. For the AMBER force fields, `antechamber + `_ or + `acpype `_ might be + appropriate. + +6. Describe a simulation box (e.g. using :ref:`gmx editconf`) whose + size is appropriate for the eventual density you would like, fill + it with solvent (e.g. using :ref:`gmx solvate`), and add any + counter-ions needed to neutralize the system (e.g. using :ref:`gmx + grompp` and :ref:`gmx insert-molecules`). In these steps you may + need to edit your topology file to stay current with your + coordinate file. + +7. Run an energy minimization on the system (using :ref:`gmx grompp` + and :ref:`gmx mdrun`). This is required to sort out any bad + starting structures caused during generation of the system, which + may cause the production simulation to crash. It may be necessary + also to minimize your solute structure in vacuo before introducing + solvent molecules (or your lipid bilayer or whatever else). You + should consider using flexible water models and not using bond + constraints or frozen groups. The use of position restraints and/or + distance restraints should be evaluated carefully. + +8. Select the appropriate simulation parameters for the equilibration + simulation (defined in .mdp file). You need to choose simulation + parameters that are consistent with how force field was + derived. You may need to simulate at NVT with position restraints + on your solvent and/or solute to get the temperature almost right, + then relax to NPT to fix the density (which should be done with + Berendsen until after the density is stabilized, before a further + switch to a barostat that produces the correct ensemble), then move + further (if needed) to reach your production simulation ensemble + (e.g. NVT, NVE). If you have problems here with the system `blowing + up `_, + consider using the suggestions on that page, e.g. position + restraints on solutes, or not using bond constraints, or using + smaller integration timesteps, or several gentler heating stage(s). + +9. Run the equilibration simulation for sufficient time so that the + system relaxes sufficiently in the target ensemble to allow the + production run to be commenced (using :ref:`gmx grompp` and + :ref:`gmx mdrun`, then :ref:`gmx energy` and `trajectory + visualization tools + `_). + +10. Select the appropriate simulation parameters for the production + simulation (defined in .mdp file). In particular, be careful not + to re-generate the velocities. You still need to be consistent + with how the force field was derived and how to measure the + property or phenomena of interest. + +.. _Reference Manual: `gmx-manual`_ + +Tips and tricks +--------------- + +Database files +^^^^^^^^^^^^^^ + +The ``share/top`` directory of a |Gromacs| installation contains +numerous plain-text helper files with the ``.dat`` file extension. +Some of the command-line tools (see :doc:`cmdline`) refer to these, +and each tool documents which files it uses, and how they are used. + +If you need to modify these files (e.g. to introduce new atom types +with VDW radii into ``vdwradii.dat``), you can copy the file from your +installation directory into your working directory, and the |Gromacs| +tools will automatically load the copy from your working directory +rather than the standard one. To suppress all the standard +definitions, use an empty file in the working directory. diff --git a/src/gromacs/gmxpreprocess/insert-molecules.cpp b/src/gromacs/gmxpreprocess/insert-molecules.cpp index 20fb243157..019327750f 100644 --- a/src/gromacs/gmxpreprocess/insert-molecules.cpp +++ b/src/gromacs/gmxpreprocess/insert-molecules.cpp @@ -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,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, 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. @@ -409,8 +409,10 @@ void InsertMolecules::initOptions(IOptionsContainer *options, "inserted molecule is less than the sum based on the van der Waals", "radii of both atoms. A database ([TT]vdwradii.dat[tt]) of van der", "Waals radii is read by the program, and the resulting radii scaled", - "by [TT]-scale[tt]. If radii are not found in the database, those" + "by [TT]-scale[tt]. If radii are not found in the database, those", "atoms are assigned the (pre-scaled) distance [TT]-radius[tt].", + "Note that the usefulness of those radii depends on the atom names,", + "and thus varies widely with force field.", "", "A total of [TT]-nmol[tt] * [TT]-try[tt] insertion attempts are made", "before giving up. Increase [TT]-try[tt] if you have several small", diff --git a/src/gromacs/gmxpreprocess/solvate.cpp b/src/gromacs/gmxpreprocess/solvate.cpp index 93f9ba6c49..2ee48d2fc7 100644 --- a/src/gromacs/gmxpreprocess/solvate.cpp +++ b/src/gromacs/gmxpreprocess/solvate.cpp @@ -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,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, 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. @@ -827,9 +827,11 @@ int gmx_solvate(int argc, char *argv[]) "the solvent molecule is less than the sum of the scaled van der Waals", "radii of both atoms. A database ([TT]vdwradii.dat[tt]) of van der", "Waals radii is read by the program, and the resulting radii scaled", - "by [TT]-scale[tt]. If radii are not found in the database, those" - "atoms are assigned the (pre-scaled) distance [TT]-radius[tt].[PAR]", - + "by [TT]-scale[tt]. If radii are not found in the database, those", + "atoms are assigned the (pre-scaled) distance [TT]-radius[tt].", + "Note that the usefulness of those radii depends on the atom names,", + "and thus varies widely with force field.", + "", "The default solvent is Simple Point Charge water (SPC), with coordinates ", "from [TT]$GMXLIB/spc216.gro[tt]. These coordinates can also be used", "for other 3-site water models, since a short equibilibration will remove", From a26ba934d1012e94600fb2448db0f0f267a1565d Mon Sep 17 00:00:00 2001 From: Mark Abraham Date: Tue, 7 Feb 2017 14:22:22 +0100 Subject: [PATCH 02/20] Bumped version to prepare for next patch release Change-Id: I2a2ee89a0c8123ff870292b418d76afe2d542189 --- cmake/gmxVersionInfo.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/gmxVersionInfo.cmake b/cmake/gmxVersionInfo.cmake index 3b72cf08ba..3ebc5f3789 100644 --- a/cmake/gmxVersionInfo.cmake +++ b/cmake/gmxVersionInfo.cmake @@ -188,7 +188,7 @@ # The GROMACS convention is that these are the version number of the next # release that is going to be made from this branch. set(GMX_VERSION_MAJOR 2016) -set(GMX_VERSION_PATCH 2) +set(GMX_VERSION_PATCH 3) # The suffix, on the other hand, is used mainly for betas and release # candidates, where it signifies the most recent such release from # this branch; it will be empty before the first such release, as well From 7d603de9be282beeac7c310d94059632dc93c3c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vedran=20Mileti=C4=87?= Date: Fri, 9 Dec 2016 18:31:14 +0100 Subject: [PATCH 03/20] Document running Clang static analyzer manually Change-Id: Ic1a273e9f8fc489d03b59eef70ff71bb426ba720 --- docs/dev-manual/jenkins.rst | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/docs/dev-manual/jenkins.rst b/docs/dev-manual/jenkins.rst index 40308988ee..5bdb9f0b7a 100644 --- a/docs/dev-manual/jenkins.rst +++ b/docs/dev-manual/jenkins.rst @@ -71,9 +71,18 @@ configuration should be more static. clang static analysis ^^^^^^^^^^^^^^^^^^^^^ -The exact build sequence and the CMake configuration used is in -:file:`admin/builds/clang-analysis.py`. This file also specifies the clang -version used for the analysis. +The file :file:`admin/builds/clang-analyzer.py` specifies the exact build +sequence and the CMake cache variables used for clang static analysis. This +file also specifies the clang version used for the analysis, as well as the C++ +compiler used (``clang-static-analyzer-``). + +To run the analysis outside Jenkins, you should run both ``cmake`` and ``make`` +under ``scan-build`` command using the same CMake cache variables as in the +build script. When you do the initial CMake configuration with ``scan-build``, +it sets the C++ compiler to the analyzer. Note that using ``scan-build`` like +this will also analyze C code, but Jenkins ignores C code for analysis. This +can result in extra warnings, which can be suppressed by manually setting +CMAKE_C_COMPILER to a value other than Clang static analyzer. cppcheck ^^^^^^^^ From 9c7dfd2f7739eaa7978d047f88c312bc3be934c0 Mon Sep 17 00:00:00 2001 From: Mark Abraham Date: Wed, 8 Feb 2017 10:52:29 +0100 Subject: [PATCH 04/20] Remove docs for unimplemented trjconv -clustercenter 2d8b8dd16d8 introduced a partial implementation, which was removed in 73b83321 because it introduced variables that were unused. However, the matching documentation was not removed then. Fixes #2114 Change-Id: Iedddf99b0254b772ffaebfcb27bec862493d920d --- src/gromacs/gmxana/gmx_trjconv.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/gromacs/gmxana/gmx_trjconv.cpp b/src/gromacs/gmxana/gmx_trjconv.cpp index aa00fe498f..0b91734705 100644 --- a/src/gromacs/gmxana/gmx_trjconv.cpp +++ b/src/gromacs/gmxana/gmx_trjconv.cpp @@ -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,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, 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. @@ -665,10 +665,6 @@ int gmx_trjconv(int argc, char *argv[]) " results if you in fact have a cluster. Luckily that can be checked", " afterwards using a trajectory viewer. Note also that if your molecules", " are broken this will not work either.", - "", - " The separate option [TT]-clustercenter[tt] can be used to specify an", - " approximate center for the cluster. This is useful e.g. if you have", - " two big vesicles, and you want to maintain their relative positions.", " * [TT]whole[tt] only makes broken molecules whole.", "", From deb27c1780b9c93b14d09b452d80da3d779cfd50 Mon Sep 17 00:00:00 2001 From: Erik Lindahl Date: Thu, 9 Feb 2017 15:45:51 +0100 Subject: [PATCH 05/20] Work around false xlc-13.1.5 bug in SIMD test atan2(0,0) should return 0.0, which the Gromacs simd implementation does. However, since at least one compiler produces -nan for the standard library version it's better to compare with the known correct value rather than calling std:atan2(0,0). Refs #2102. Change-Id: I60449e9f16fb1ab79486927a3e9993da0cce937f --- src/gromacs/simd/tests/simd_math.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/gromacs/simd/tests/simd_math.cpp b/src/gromacs/simd/tests/simd_math.cpp index d9aa834dec..e02efcaf95 100644 --- a/src/gromacs/simd/tests/simd_math.cpp +++ b/src/gromacs/simd/tests/simd_math.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2014,2015, by the GROMACS development team, led by + * Copyright (c) 2014,2015,2017, 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. @@ -439,8 +439,9 @@ TEST_F(SimdMathTest, atan2) GMX_EXPECT_SIMD_REAL_NEAR(setSimdRealFrom1R(std::atan2(1.0, 0.0)), atan2(rSimd_1_2_3, setZero())); GMX_EXPECT_SIMD_REAL_NEAR(setSimdRealFrom1R(std::atan2(0.0, -1.0)), atan2(setZero(), rSimd_m1_m2_m3)); GMX_EXPECT_SIMD_REAL_NEAR(setSimdRealFrom1R(std::atan2(-1.0, 0.0)), atan2(rSimd_m1_m2_m3, setZero())); - // degenerate value (origin) should return 0.0 - GMX_EXPECT_SIMD_REAL_NEAR(setSimdRealFrom1R(std::atan2(0.0, 0.0)), atan2(setSimdRealFrom3R(0.0, 0.0, 0.0), setZero())); + // degenerate value (origin) should return 0.0. At least IBM xlc 13.1.5 gets the reference + // value wrong (-nan) at -O3 optimization, so we compare to the correct value (0.0) instead. + GMX_EXPECT_SIMD_REAL_NEAR(setSimdRealFrom1R(0.0), atan2(setSimdRealFrom3R(0.0, 0.0, 0.0), setZero())); } /*! \brief Evaluate reference version of PME force correction. */ From 12e29c829e96353092ea7bdb37faf7f122f4e19a Mon Sep 17 00:00:00 2001 From: Mark Abraham Date: Fri, 10 Feb 2017 14:19:31 +0100 Subject: [PATCH 06/20] Corrected output of gmx do_dssp -sc This code has always written a probability, and not a percentage, so fixed the label. It still fits within the expected 8-character field. Fixes #2120 Change-Id: Ic3256a3942b2f2375e9f4c0771bbe3afe682acf4 --- src/gromacs/gmxana/gmx_do_dssp.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gromacs/gmxana/gmx_do_dssp.cpp b/src/gromacs/gmxana/gmx_do_dssp.cpp index f41182e48a..60619c5499 100644 --- a/src/gromacs/gmxana/gmx_do_dssp.cpp +++ b/src/gromacs/gmxana/gmx_do_dssp.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2012,2013,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2012,2013,2014,2015,2017, 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. @@ -423,8 +423,8 @@ void analyse_ss(const char *outfile, t_matrix *mat, const char *ss_string, } fprintf(fp, "\n"); - /* now print percentages */ - fprintf(fp, "%-8s %5.2f", "# SS %", total_count / static_cast(mat->nx * mat->ny)); + /* now print probabilities */ + fprintf(fp, "%-8s %5.2f", "# SS pr.", total_count / static_cast(mat->nx * mat->ny)); for (s = 0; s < static_cast(mat->nmap); s++) { fprintf(fp, " %5.2f", total[s] / static_cast(mat->nx * mat->ny)); From f3c239f6b1ef2ce62f1b51dec72a32e050fa0ddc Mon Sep 17 00:00:00 2001 From: Mark Abraham Date: Thu, 9 Feb 2017 17:58:59 +0100 Subject: [PATCH 07/20] Fix handling of previous virials These quantities get written to checkpoint files only for the Trotter pressure-coupling integrators that need them, but they were being copied in do_md for all Trotter integrators. This meant that an appending restart of md-vv plus nose-hoover plus no pressure coupling truncated off a correct edr frame and wrote one with zero virial and wrong pressure. And in the same case, a no-append restart writes a duplicate frame that does not agree with the one written before termination. Fixed by copying them only when they are useful to copy, so that in the problem case, the correctly computed post-restart virial is not wiped with zeroes from state fields that were never read from the checkpoint. Cases that use the previous-virial values are not affected. Refs #1793 Change-Id: I84908122aefbe8658f423eaf4e5bd4ae25a93d24 --- src/programs/mdrun/md.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/programs/mdrun/md.cpp b/src/programs/mdrun/md.cpp index afa3d62a75..340d692c2a 100644 --- a/src/programs/mdrun/md.cpp +++ b/src/programs/mdrun/md.cpp @@ -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,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2011,2012,2013,2014,2015,2016,2017, 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. @@ -1215,8 +1215,15 @@ double do_md(FILE *fplog, t_commrec *cr, int nfile, const t_filenm fnm[], } if (bTrotter && !bInitStep) { - copy_mat(shake_vir, state->svir_prev); - copy_mat(force_vir, state->fvir_prev); + /* TODO This is only needed when we're about to write + * a checkpoint, because we use it after the restart + * (in a kludge?). But what should we be doing if + * startingFromCheckpoint or bInitStep are true? */ + if (IR_NPT_TROTTER(ir) || IR_NPH_TROTTER(ir)) + { + copy_mat(shake_vir, state->svir_prev); + copy_mat(force_vir, state->fvir_prev); + } if (IR_NVT_TROTTER(ir) && ir->eI == eiVV) { /* update temperature and kinetic energy now that step is over - this is the v(t+dt) point */ @@ -1280,7 +1287,7 @@ double do_md(FILE *fplog, t_commrec *cr, int nfile, const t_filenm fnm[], bIMDstep = do_IMD(ir->bIMD, step, cr, bNS, state->box, state->x, ir, t, wcycle); /* kludge -- virial is lost with restart for MTTK NPT control. Must reload (saved earlier). */ - if (bStartingFromCpt && bTrotter) + if (bStartingFromCpt && (IR_NPT_TROTTER(ir) || IR_NPH_TROTTER(ir))) { copy_mat(state->svir_prev, shake_vir); copy_mat(state->fvir_prev, force_vir); From 94bbae100f413e00a10ebe7002b91579eff25732 Mon Sep 17 00:00:00 2001 From: Roland Schulz Date: Wed, 22 Feb 2017 23:13:24 -0800 Subject: [PATCH 08/20] Fix compile of GMX_SIMD=None with ICC ICC defines invsqrt in math.h Change-Id: Ic7107189cb5fb422192f986ebed53f2c2993ff35 --- src/gromacs/listed-forces/pairs.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gromacs/listed-forces/pairs.cpp b/src/gromacs/listed-forces/pairs.cpp index 8a930ccd6a..670eb6b0eb 100644 --- a/src/gromacs/listed-forces/pairs.cpp +++ b/src/gromacs/listed-forces/pairs.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2014,2015,2016,2017, 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. @@ -607,7 +607,7 @@ do_pairs_simple(int nbonds, pbc_dx_aiuc(pbc, xi, xj, dr); T rsq = dr[XX]*dr[XX] + dr[YY]*dr[YY] + dr[ZZ]*dr[ZZ]; - T rinv = invsqrt(rsq); + T rinv = gmx::invsqrt(rsq); T rinv2 = rinv*rinv; T rinv6 = rinv2*rinv2*rinv2; From 198bc2a9f8ec85064839cb702365fc8ed556d8a0 Mon Sep 17 00:00:00 2001 From: Michael Shirts Date: Tue, 21 Feb 2017 20:28:20 -0700 Subject: [PATCH 09/20] Fix for an incorrect check that nstlog !=0 The original version was accidentally reversed, causing it to fail when nstlog =/= 0. Wasn't noticed because of lack of a test. (I can add a test if told where to put it). Change-Id: I46afd608c4ea729df35128fe6f8bac4a0808364b --- src/gromacs/gmxpreprocess/readir.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gromacs/gmxpreprocess/readir.cpp b/src/gromacs/gmxpreprocess/readir.cpp index 054c0f6486..40585ad45e 100644 --- a/src/gromacs/gmxpreprocess/readir.cpp +++ b/src/gromacs/gmxpreprocess/readir.cpp @@ -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,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, 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. @@ -811,7 +811,7 @@ void check_ir(const char *mdparin, t_inputrec *ir, t_gromppopts *opts, if (expand->nstTij > 0) { sprintf(err_buf, "nstlog must be non-zero"); - CHECK(ir->nstlog != 0); + CHECK(ir->nstlog == 0); sprintf(err_buf, "nst-transition-matrix (%d) must be an integer multiple of nstlog (%d)", expand->nstTij, ir->nstlog); CHECK((expand->nstTij % ir->nstlog) != 0); From 54d906f155299a4b1ceeafaa6ceca1a022beb913 Mon Sep 17 00:00:00 2001 From: David van der Spoel Date: Fri, 10 Feb 2017 07:43:44 +0100 Subject: [PATCH 10/20] Fixes bug in gmx solvate with -shell that yielded 0 SOL. In the transition from genbox to the new solvate.cpp some incorrect logic was introduced. Added test for -shell. Implemented test for conf files that check the title and number of atoms. In principle this could be extended to other structure files. Fixes #2119 Change-Id: I88feef55f33c7076b9c27a9831ee04d890333b76 --- src/gromacs/gmxpreprocess/solvate.cpp | 110 +++++++++++------ .../refdata/SolvateTest_cs_box_Works.xml | 12 ++ .../tests/refdata/SolvateTest_cs_cp_Works.xml | 12 ++ .../refdata/SolvateTest_cs_cp_p_Works.xml | 12 ++ .../tests/refdata/SolvateTest_shell_Works.xml | 12 ++ src/gromacs/gmxpreprocess/tests/solvate.cpp | 22 +++- src/testutils/CMakeLists.txt | 3 +- src/testutils/conftest.cpp | 106 ++++++++++++++++ src/testutils/conftest.h | 114 ++++++++++++++++++ 9 files changed, 365 insertions(+), 38 deletions(-) create mode 100644 src/gromacs/gmxpreprocess/tests/refdata/SolvateTest_cs_box_Works.xml create mode 100644 src/gromacs/gmxpreprocess/tests/refdata/SolvateTest_cs_cp_Works.xml create mode 100644 src/gromacs/gmxpreprocess/tests/refdata/SolvateTest_cs_cp_p_Works.xml create mode 100644 src/gromacs/gmxpreprocess/tests/refdata/SolvateTest_shell_Works.xml create mode 100644 src/testutils/conftest.cpp create mode 100644 src/testutils/conftest.h diff --git a/src/gromacs/gmxpreprocess/solvate.cpp b/src/gromacs/gmxpreprocess/solvate.cpp index 2ee48d2fc7..e2c1d49ad9 100644 --- a/src/gromacs/gmxpreprocess/solvate.cpp +++ b/src/gromacs/gmxpreprocess/solvate.cpp @@ -491,50 +491,86 @@ static void removeSolventBoxOverlap(t_atoms *atoms, std::vector *x, } /*! \brief - * Removes solvent molecules that overlap with the solute, and optionally also - * those that are outside a given shell radius from the solute. + * Remove all solvent molecules outside a give radius from the solute. * - * \param[in,out] atoms Solvent atoms. - * \param[in,out] x Solvent positions. - * \param[in,out] v Solvent velocities (can be empty). - * \param[in,out] r Solvent exclusion radii. - * \param[in] pbc PBC information. - * \param[in] x_solute Solute positions. - * \param[in] r_solute Solute exclusion radii. - * \param[in] rshell If >0, only keep solvent atoms within a shell of - * this size from the solute. + * \param[in,out] atoms Solvent atoms. + * \param[in,out] x_solvent Solvent positions. + * \param[in,out] v_solvent Solvent velocities. + * \param[in,out] r Atomic exclusion radii. + * \param[in] pbc PBC information. + * \param[in] x_solute Solute positions. + * \param[in] rshell The radius outside the solute molecule. */ -static void removeSoluteOverlap(t_atoms *atoms, std::vector *x, - std::vector *v, std::vector *r, - const t_pbc &pbc, - const std::vector &x_solute, - const std::vector &r_solute, - real rshell) +static void removeSolventOutsideShell(t_atoms *atoms, + std::vector *x_solvent, + std::vector *v_solvent, + std::vector *r, + const t_pbc &pbc, + const std::vector &x_solute, + real rshell) { - const real maxRadius1 - = *std::max_element(r->begin(), r->end()); - const real maxRadius2 - = *std::max_element(r_solute.begin(), r_solute.end()); - gmx::AtomsRemover remover(*atoms); - // If rshell is >0, the neighborhood search looks at all pairs - // within rshell, and unmarks those that are within the cutoff. - // This line marks everything, so that solvent outside rshell remains - // marked after the loop. - // Without rshell, the neighborhood search only marks the overlapping - // solvent atoms, and all others are left alone. - if (rshell > 0.0) + gmx::AnalysisNeighborhood nb; + nb.setCutoff(rshell); + gmx::AnalysisNeighborhoodPositions posSolute(x_solute); + gmx::AnalysisNeighborhoodSearch search = nb.initSearch(&pbc, posSolute); + gmx::AnalysisNeighborhoodPositions pos(*x_solvent); + gmx::AnalysisNeighborhoodPairSearch pairSearch = search.startPairSearch(pos); + gmx::AnalysisNeighborhoodPair pair; + + // Remove everything + remover.markAll(); + // Now put back those within the shell without checking for overlap + while (pairSearch.findNextPair(&pair)) { - remover.markAll(); + remover.markResidue(*atoms, pair.testIndex(), false); + pairSearch.skipRemainingPairsForTestPosition(); } + remover.removeMarkedElements(x_solvent); + if (!v_solvent->empty()) + { + remover.removeMarkedElements(v_solvent); + } + remover.removeMarkedElements(r); + const int originalAtomCount = atoms->nr; + remover.removeMarkedAtoms(atoms); + fprintf(stderr, "Removed %d solvent atoms more than %f nm from solute.\n", + originalAtomCount - atoms->nr, rshell); +} + +/*! \brief + * Removes solvent molecules that overlap with the solute. + * + * \param[in,out] atoms Solvent atoms. + * \param[in,out] x Solvent positions. + * \param[in,out] v Solvent velocities (can be empty). + * \param[in,out] r Solvent exclusion radii. + * \param[in] pbc PBC information. + * \param[in] x_solute Solute positions. + * \param[in] r_solute Solute exclusion radii. + */ +static void removeSolventOverlappingWithSolute(t_atoms *atoms, + std::vector *x, + std::vector *v, + std::vector *r, + const t_pbc &pbc, + const std::vector &x_solute, + const std::vector &r_solute) +{ + gmx::AtomsRemover remover(*atoms); + const real maxRadius1 + = *std::max_element(r->begin(), r->end()); + const real maxRadius2 + = *std::max_element(r_solute.begin(), r_solute.end()); + // Now check for overlap. gmx::AnalysisNeighborhood nb; - nb.setCutoff(std::max(maxRadius1 + maxRadius2, rshell)); + gmx::AnalysisNeighborhoodPair pair; + nb.setCutoff(maxRadius1 + maxRadius2); gmx::AnalysisNeighborhoodPositions posSolute(x_solute); gmx::AnalysisNeighborhoodSearch search = nb.initSearch(&pbc, posSolute); gmx::AnalysisNeighborhoodPositions pos(*x); gmx::AnalysisNeighborhoodPairSearch pairSearch = search.startPairSearch(pos); - gmx::AnalysisNeighborhoodPair pair; while (pairSearch.findNextPair(&pair)) { if (remover.isMarked(pair.testIndex())) @@ -647,8 +683,14 @@ static void add_solv(const char *fn, t_topology *top, } if (top->atoms.nr > 0) { - removeSoluteOverlap(atoms_solvt, &x_solvt, &v_solvt, &exclusionDistances_solvt, pbc, - *x, exclusionDistances, rshell); + if (rshell > 0.0) + { + removeSolventOutsideShell(atoms_solvt, &x_solvt, &v_solvt, + &exclusionDistances_solvt, pbc, *x, rshell); + } + removeSolventOverlappingWithSolute(atoms_solvt, &x_solvt, &v_solvt, + &exclusionDistances_solvt, pbc, *x, + exclusionDistances); } if (max_sol > 0 && atoms_solvt->nres > max_sol) diff --git a/src/gromacs/gmxpreprocess/tests/refdata/SolvateTest_cs_box_Works.xml b/src/gromacs/gmxpreprocess/tests/refdata/SolvateTest_cs_box_Works.xml new file mode 100644 index 0000000000..8bd8870418 --- /dev/null +++ b/src/gromacs/gmxpreprocess/tests/refdata/SolvateTest_cs_box_Works.xml @@ -0,0 +1,12 @@ + + + + + + + Generated by gmx solvate + 141 + + + + diff --git a/src/gromacs/gmxpreprocess/tests/refdata/SolvateTest_cs_cp_Works.xml b/src/gromacs/gmxpreprocess/tests/refdata/SolvateTest_cs_cp_Works.xml new file mode 100644 index 0000000000..b38a36ee36 --- /dev/null +++ b/src/gromacs/gmxpreprocess/tests/refdata/SolvateTest_cs_cp_Works.xml @@ -0,0 +1,12 @@ + + + + + + + Test system for solvate/insert-molecules + 2664 + + + + diff --git a/src/gromacs/gmxpreprocess/tests/refdata/SolvateTest_cs_cp_p_Works.xml b/src/gromacs/gmxpreprocess/tests/refdata/SolvateTest_cs_cp_p_Works.xml new file mode 100644 index 0000000000..b38a36ee36 --- /dev/null +++ b/src/gromacs/gmxpreprocess/tests/refdata/SolvateTest_cs_cp_p_Works.xml @@ -0,0 +1,12 @@ + + + + + + + Test system for solvate/insert-molecules + 2664 + + + + diff --git a/src/gromacs/gmxpreprocess/tests/refdata/SolvateTest_shell_Works.xml b/src/gromacs/gmxpreprocess/tests/refdata/SolvateTest_shell_Works.xml new file mode 100644 index 0000000000..f3cdafbea4 --- /dev/null +++ b/src/gromacs/gmxpreprocess/tests/refdata/SolvateTest_shell_Works.xml @@ -0,0 +1,12 @@ + + + + + + + Test system for solvate/insert-molecules + 762 + + + + diff --git a/src/gromacs/gmxpreprocess/tests/solvate.cpp b/src/gromacs/gmxpreprocess/tests/solvate.cpp index 445e184f75..f1858fc9b5 100644 --- a/src/gromacs/gmxpreprocess/tests/solvate.cpp +++ b/src/gromacs/gmxpreprocess/tests/solvate.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2017, 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. @@ -45,8 +45,11 @@ #include "gromacs/gmxpreprocess/solvate.h" #include "gromacs/utility/futil.h" +#include "gromacs/utility/textreader.h" #include "testutils/cmdlinetest.h" +#include "testutils/conftest.h" +#include "testutils/refdata.h" #include "testutils/testfilemanager.h" #include "testutils/textblockmatchers.h" @@ -54,14 +57,14 @@ namespace { using gmx::test::CommandLine; -using gmx::test::NoTextMatch; +using gmx::test::ConfMatch; class SolvateTest : public gmx::test::CommandLineTestBase { public: SolvateTest() { - setOutputFile("-o", "out.gro", NoTextMatch()); + setOutputFile("-o", "out.gro", ConfMatch()); } void runTest(const CommandLine &args) @@ -70,6 +73,7 @@ class SolvateTest : public gmx::test::CommandLineTestBase cmdline.merge(args); ASSERT_EQ(0, gmx_solvate(cmdline.argc(), cmdline.argv())); + checkOutputFiles(); } }; @@ -109,4 +113,16 @@ TEST_F(SolvateTest, cs_cp_p_Works) runTest(CommandLine(cmdline)); } +TEST_F(SolvateTest, shell_Works) +{ + // use default solvent box (-cs without argument) + const char *const cmdline[] = { + "solvate", "-cs" + }; + setInputFile("-cp", "spc-and-methanol.gro"); + commandLine().addOption("-shell", 1.0); + + runTest(CommandLine(cmdline)); +} + } // namespace diff --git a/src/testutils/CMakeLists.txt b/src/testutils/CMakeLists.txt index 2bd34f4b64..da1fc6a660 100644 --- a/src/testutils/CMakeLists.txt +++ b/src/testutils/CMakeLists.txt @@ -1,7 +1,7 @@ # # This file is part of the GROMACS molecular simulation package. # -# Copyright (c) 2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by +# Copyright (c) 2011,2012,2013,2014,2015,2016,2017, 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. @@ -35,6 +35,7 @@ include_directories(BEFORE SYSTEM ${GMOCK_INCLUDE_DIRS}) set(TESTUTILS_SOURCES cmdlinetest.cpp + conftest.cpp integrationtests.cpp interactivetest.cpp mpi-printer.cpp diff --git a/src/testutils/conftest.cpp b/src/testutils/conftest.cpp new file mode 100644 index 0000000000..dc591eea3a --- /dev/null +++ b/src/testutils/conftest.cpp @@ -0,0 +1,106 @@ +/* + * This file is part of the GROMACS molecular simulation package. + * + * Copyright (c) 2017, 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. + */ +/*! \internal \file + * \brief + * Implements routine to check the content of conf files. + * + * \author David van der Spoel + * \ingroup module_testutils + */ +#include "gmxpre.h" + +#include "conftest.h" + +#include +#include + +#include "gromacs/utility/gmxassert.h" +#include "gromacs/utility/stringutil.h" +#include "gromacs/utility/textstream.h" + +#include "testutils/refdata.h" +#include "testutils/testasserts.h" +#include "testutils/textblockmatchers.h" + +namespace gmx +{ + +namespace test +{ + +namespace +{ + +class ConfMatcher : public ITextBlockMatcher +{ + public: + explicit ConfMatcher(const ConfMatchSettings &settings) : settings_(settings) + { + } + + virtual void checkStream(TextInputStream *stream, + TestReferenceChecker *checker) + { + checkConfFile(stream, checker, settings_); + } + private: + ConfMatchSettings settings_; +}; + +} // namespace + +void checkConfFile(TextInputStream *input, + TestReferenceChecker *checker, + const ConfMatchSettings &) +{ + + TestReferenceChecker groChecker(checker->checkCompound("GroFile", "Header")); + // Just check the first two lines of the output file + std::string line; + EXPECT_TRUE(input->readLine(&line)); + line = stripSuffixIfPresent(line, "\n"); + groChecker.checkString(line, "Title"); + EXPECT_TRUE(input->readLine(&line)); + line = stripSuffixIfPresent(line, "\n"); + groChecker.checkInteger(std::atoi(line.c_str()), "Number of atoms"); +} + +TextBlockMatcherPointer ConfMatch::createMatcher() const +{ + return TextBlockMatcherPointer(new ConfMatcher(settings_)); +} + +} // namespace test +} // namespace gmx diff --git a/src/testutils/conftest.h b/src/testutils/conftest.h new file mode 100644 index 0000000000..1ef81de315 --- /dev/null +++ b/src/testutils/conftest.h @@ -0,0 +1,114 @@ +/* + * This file is part of the GROMACS molecular simulation package. + * + * Copyright (c) 2017, 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. + */ +/*! \libinternal \file + * \brief + * Declares function to add the content of a conf file to a checker. + * + * \author David van der Spoel + * \inlibraryapi + * \ingroup module_testutils + */ +#ifndef GMX_TESTUTILS_CONFTEST_H +#define GMX_TESTUTILS_CONFTEST_H + +#include + +#include "testutils/testasserts.h" +#include "testutils/textblockmatchers.h" + +namespace gmx +{ + +class TextInputStream; + +namespace test +{ + +class TestReferenceChecker; + +struct ConfMatchSettings +{ + ConfMatchSettings() : tolerance(defaultRealTolerance()) + { + } + + FloatingPointTolerance tolerance; +}; + +/*! \brief + * Adds content of a gro file to TestReferenceChecker object. + * + * \param[in] input Stream that provides the gro content. + * \param[in,out] checker Checker to use. + * \param[in] settings Settings to use for matching. + * + * Parses a gro file from the input stream, and checks the contents against + * reference data (only first two lines for now). + * + * \see ConfMatch + */ +void checkConfFile(TextInputStream *input, + TestReferenceChecker *checker, + const ConfMatchSettings &settings); + +/*! \libinternal \brief + * Match the contents as an gro file. + * + * \see checkGroFile() + * + * \inlibraryapi + * \ingroup module_testutils + */ +class ConfMatch : public ITextBlockMatcherSettings +{ + public: + //! Sets the tolerance for matching floating point values. + ConfMatch &tolerance(const FloatingPointTolerance &tolerance) + { + settings_.tolerance = tolerance; + return *this; + } + + virtual TextBlockMatcherPointer createMatcher() const; + + private: + ConfMatchSettings settings_; +}; + +} // namespace test + +} // namespace gmx + +#endif From aa905d647e272792f67d93994578d0bb0eeb0f3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vedran=20Mileti=C4=87?= Date: Wed, 1 Mar 2017 15:52:25 +0100 Subject: [PATCH 11/20] Enable avx512 in fftw only if compiler supports it Enabling avx512 requires GCC 4.9 or newer or Clang 3.9 or newer. Since we support compilers older than those, we can not afford to enable avx512 in own fftw unconditionally. Change-Id: I17dba4e16f3d3566c1f5188497d0467d1d2665a0 --- docs/install-guide/index.rst | 2 ++ src/contrib/fftw/CMakeLists.txt | 7 ++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/docs/install-guide/index.rst b/docs/install-guide/index.rst index 6add227204..eab5e87284 100644 --- a/docs/install-guide/index.rst +++ b/docs/install-guide/index.rst @@ -101,10 +101,12 @@ frequently provides the best performance. You should strive to use the most recent version of your compiler. Minimum supported compiler versions are + * GNU (gcc) 4.6 * Intel (icc) 14 * LLVM (clang) 3.4 * Microsoft (MSVC) 2015 + Other compilers may work (Cray, Pathscale, older clang) but do not offer competitive performance. We recommend against PGI because the performance with C++ is very bad. diff --git a/src/contrib/fftw/CMakeLists.txt b/src/contrib/fftw/CMakeLists.txt index 5c061659c4..8432df588f 100644 --- a/src/contrib/fftw/CMakeLists.txt +++ b/src/contrib/fftw/CMakeLists.txt @@ -1,7 +1,7 @@ # # This file is part of the GROMACS molecular simulation package. # -# Copyright (c) 2012,2013,2014,2015,2016, by the GROMACS development team, led by +# Copyright (c) 2012,2013,2014,2015,2016,2017, 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. @@ -73,7 +73,12 @@ elseif(${GMX_SIMD} MATCHES "^(AVX)") # Support for --enable-avx2 was only added in 3.3.5, but # configuring with it is at worst a warning, even on an earlier # version. +if((CMAKE_COMPILER_IS_GNUCC AND (C_COMPILER_VERSION VERSION_GREATER 4.9 OR CXX_COMPILER_VERSION VERSION_GREATER 4.9)) OR + (CMAKE_C_COMPILER_ID MATCHES "Clang" AND (C_COMPILER_VERSION VERSION_GREATER 3.9 OR CXX_COMPILER_VERSION VERSION_GREATER 3.9))) set(_fftw_simd_support_level --enable-sse2;--enable-avx;--enable-avx2;--enable-avx512) +elseif() + set(_fftw_simd_support_level --enable-sse2;--enable-avx;--enable-avx2) +endif() elseif(${GMX_SIMD} MATCHES "^(VSX)") set(_fftw_simd_support_level --enable-vsx) endif() From 46dc5e12c8a83880c19f0f6343ec4d8e6fad8522 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vedran=20Mileti=C4=87?= Date: Thu, 2 Mar 2017 15:36:52 +0100 Subject: [PATCH 12/20] Document that we now support AMD GCN on Mesa/LLVM AMD GPUs using Mesa 17.0+ and LLVM 4.0+ run GROMACS using OpenCL. Change-Id: I899c4f1c0581fdb3ea635c1f19f37b66c5dc3411 --- docs/user-guide/mdrun-performance.rst | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/docs/user-guide/mdrun-performance.rst b/docs/user-guide/mdrun-performance.rst index 405a6096ac..80f9e55a37 100644 --- a/docs/user-guide/mdrun-performance.rst +++ b/docs/user-guide/mdrun-performance.rst @@ -709,8 +709,12 @@ Running the OpenCL version of mdrun ----------------------------------- The current version works with GCN-based AMD GPUs, and NVIDIA CUDA -GPUs. Make sure that you have the latest drivers installed. The -minimum OpenCL version required is |REQUIRED_OPENCL_MIN_VERSION|. See +GPUs. Make sure that you have the latest drivers installed. For AMD GPUs, +Mesa version 17.0 or newer with LLVM 4.0 or newer is supported in addition +to the proprietary driver. For NVIDIA GPUs, using the proprietary driver is +required as the open source nouveau driver (available in Mesa) does not +provide the OpenCL support. +The minimum OpenCL version required is |REQUIRED_OPENCL_MIN_VERSION|. See also the :ref:`known limitations `. Devices from the AMD GCN architectures (all series) and NVIDIA Fermi From f05743b09bef9b6af452b29a00bddc7fcc956a38 Mon Sep 17 00:00:00 2001 From: Mark Abraham Date: Fri, 27 Jan 2017 18:57:10 +0100 Subject: [PATCH 13/20] Fixes for xl compilers 13.1.5 on Power8 Applied Erik's recent fix also for the atan2SinglePrecisionAccuracy test. Refs #2102 Change-Id: I230dac8084be2d0693cb616b5a5951b0ae4b71a6 --- cmake/gmxManageSimd.cmake | 19 +++++++++- .../simd/impl_ibm_vsx/impl_ibm_vsx_general.h | 4 +- .../impl_ibm_vsx/impl_ibm_vsx_simd4_float.h | 12 +----- .../impl_ibm_vsx/impl_ibm_vsx_simd_double.h | 27 ++------------ .../impl_ibm_vsx/impl_ibm_vsx_simd_float.h | 37 ++----------------- .../impl_ibm_vsx/impl_ibm_vsx_util_float.h | 25 ++++++++----- src/gromacs/simd/tests/simd_math.cpp | 5 ++- 7 files changed, 44 insertions(+), 85 deletions(-) diff --git a/cmake/gmxManageSimd.cmake b/cmake/gmxManageSimd.cmake index f3bf27bde9..01150d19be 100644 --- a/cmake/gmxManageSimd.cmake +++ b/cmake/gmxManageSimd.cmake @@ -1,7 +1,7 @@ # # This file is part of the GROMACS molecular simulation package. # -# Copyright (c) 2012,2013,2014,2015,2016, by the GROMACS development team, led by +# Copyright (c) 2012,2013,2014,2015,2016,2017, 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. @@ -74,6 +74,11 @@ macro(prepare_power_vsx_toolchain TOOLCHAIN_C_FLAGS_VARIABLE TOOLCHAIN_CXX_FLAGS message(FATAL_ERROR "Using VSX SIMD in double precision with GCC requires GCC-4.9 or later.") endif() endif() + if(${CMAKE_CXX_COMPILER_ID} MATCHES "XL" OR ${CMAKE_C_COMPILER_ID} MATCHES "XL") + if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "13.1.5" OR CMAKE_C_COMPILER_VERSION VERSION_LESS "13.1.5") + message(FATAL_ERROR "Using VSX SIMD requires XL compiler version 13.1.5 or later.") + endif() + endif() endmacro() # Issue a fatal error with an appropriate message, when the toolchain @@ -418,7 +423,12 @@ elseif(GMX_SIMD STREQUAL "IBM_VSX") SIMD_${GMX_SIMD}_C_FLAGS SIMD_${GMX_SIMD}_CXX_FLAGS "-mvsx" "-maltivec -mabi=altivec" "-qarch=auto -qaltivec") - if(NOT SIMD_${GMX_SIMD}_C_FLAGS OR NOT SIMD_${GMX_SIMD}_CXX_FLAGS) + # Usually we check also for the C compiler here, but a C compiler + # is not required for SIMD support on this platform. cmake through + # at least version 3.7 cannot pass this check with the C compiler + # in the latest xlc 13.1.5, but the C++ compiler has different + # behaviour and is OK. See Redmine #2102. + if(NOT SIMD_${GMX_SIMD}_CXX_FLAGS) gmx_give_fatal_error_when_simd_support_not_found("IBM VSX" "disable SIMD support (slower)" "${SUGGEST_BINUTILS_UPDATE}") endif() @@ -476,11 +486,16 @@ endif() # rather than actual vector data. For now we disable __vectorcall with clang # when using the reference build. # +# xlc 13.1.5 does not seem recognize any attribute, and warns about invalid ones +# so we avoid searching for any. +# if(NOT DEFINED GMX_SIMD_CALLING_CONVENTION) if(GMX_TARGET_BGQ) set(CALLCONV_LIST " ") elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND GMX_SIMD STREQUAL "REFERENCE") set(CALLCONV_LIST __regcall " ") + elseif(CMAKE_CXX_COMPILER_ID MATCHES "XL") + set(CALLCONV_LIST " ") else() set(CALLCONV_LIST __vectorcall __regcall " ") endif() diff --git a/src/gromacs/simd/impl_ibm_vsx/impl_ibm_vsx_general.h b/src/gromacs/simd/impl_ibm_vsx/impl_ibm_vsx_general.h index e80fcae74e..89adcd4efd 100644 --- a/src/gromacs/simd/impl_ibm_vsx/impl_ibm_vsx_general.h +++ b/src/gromacs/simd/impl_ibm_vsx/impl_ibm_vsx_general.h @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2014,2015, by the GROMACS development team, led by + * Copyright (c) 2014,2015,2017, 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. @@ -43,7 +43,7 @@ static inline void simdPrefetch(const void * m) { #if defined(__ibmxl__) || defined(__xlC__) - __dcbt(m); + __dcbt((void *)m); #elif defined __GNUC__ __builtin_prefetch(m); #endif diff --git a/src/gromacs/simd/impl_ibm_vsx/impl_ibm_vsx_simd4_float.h b/src/gromacs/simd/impl_ibm_vsx/impl_ibm_vsx_simd4_float.h index 7843aa0d80..2ce5bd1a83 100644 --- a/src/gromacs/simd/impl_ibm_vsx/impl_ibm_vsx_simd4_float.h +++ b/src/gromacs/simd/impl_ibm_vsx/impl_ibm_vsx_simd4_float.h @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2014,2015, by the GROMACS development team, led by + * Copyright (c) 2014,2015,2017, 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. @@ -105,25 +105,15 @@ store4(float *m, Simd4Float a) static inline Simd4Float gmx_simdcall load4U(const float *m) { -#if defined(__ibmxl__) || defined(__xlC__) - return { - vec_xlw4(0, const_cast(m)) - } -#else return { *reinterpret_cast(m) }; -#endif } static inline void gmx_simdcall store4U(float *m, Simd4Float a) { -#if defined(__ibmxl__) || defined(__xlC__) - vec_xstw4(a.simdInternal_, 0, m); -#else *reinterpret_cast<__vector float *>(m) = a.simdInternal_; -#endif } static inline Simd4Float gmx_simdcall diff --git a/src/gromacs/simd/impl_ibm_vsx/impl_ibm_vsx_simd_double.h b/src/gromacs/simd/impl_ibm_vsx/impl_ibm_vsx_simd_double.h index 0ef9954924..19a6b08a69 100644 --- a/src/gromacs/simd/impl_ibm_vsx/impl_ibm_vsx_simd_double.h +++ b/src/gromacs/simd/impl_ibm_vsx/impl_ibm_vsx_simd_double.h @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2014,2015,2016,2017, 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. @@ -99,19 +99,8 @@ class SimdDIBool __vector vsxBool int simdInternal_; }; -// The VSX load & store operations are a bit of a mess. The interface is different -// for xlc version 12, xlc version 13, and gcc. Long-term IBM recommends -// simply using pointer dereferencing both for aligned and unaligned loads. -// That's nice, but unfortunately xlc still bugs out when the pointer is -// not aligned. Sticking to vec_xl/vec_xst isn't a solution either, since -// that appears to be buggy for some _aligned_ loads :-) -// -// For now, we use pointer dereferencing for all aligned load/stores, and -// for unaligned ones with gcc. On xlc we use vec_xlw4/vec_xstw4 for -// unaligned memory operations. The latest docs recommend using the overloaded -// vec_xl/vec_xst, but that is not supported on xlc version 12. We'll -// revisit things once xlc is a bit more stable - for now you probably want -// to stick to gcc... +// Note that the interfaces we use here have been a mess in xlc; +// currently version 13.1.5 is required. static inline SimdDouble gmx_simdcall simdLoad(const double *m) @@ -130,25 +119,15 @@ store(double *m, SimdDouble a) static inline SimdDouble gmx_simdcall simdLoadU(const double *m) { -#if defined(__ibmxl__) || defined(__xlC__) - return { - vec_xlw4(0, const_cast(m)) - } -#else return { *reinterpret_cast(m) }; -#endif } static inline void gmx_simdcall storeU(double *m, SimdDouble a) { -#if defined(__ibmxl__) || defined(__xlC__) - vec_xstw4(a.simdInternal_, 0, m); -#else *reinterpret_cast<__vector double *>(m) = a.simdInternal_; -#endif } static inline SimdDouble gmx_simdcall diff --git a/src/gromacs/simd/impl_ibm_vsx/impl_ibm_vsx_simd_float.h b/src/gromacs/simd/impl_ibm_vsx/impl_ibm_vsx_simd_float.h index 73169a3f69..12353fc350 100644 --- a/src/gromacs/simd/impl_ibm_vsx/impl_ibm_vsx_simd_float.h +++ b/src/gromacs/simd/impl_ibm_vsx/impl_ibm_vsx_simd_float.h @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2014,2015,2016,2017, 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. @@ -99,19 +99,8 @@ class SimdFIBool __vector vsxBool int simdInternal_; }; -// The VSX load & store operations are a bit of a mess. The interface is different -// for xlc version 12, xlc version 13, and gcc. Long-term IBM recommends -// simply using pointer dereferencing both for aligned and unaligned loads. -// That's nice, but unfortunately xlc still bugs out when the pointer is -// not aligned. Sticking to vec_xl/vec_xst isn't a solution either, since -// that appears to be buggy for some _aligned_ loads :-) -// -// For now, we use pointer dereferencing for all aligned load/stores, and -// for unaligned ones with gcc. On xlc we use vec_xlw4/vec_xstw4 for -// unaligned memory operations. The latest docs recommend using the overloaded -// vec_xl/vec_xst, but that is not supported on xlc version 12. We'll -// revisit things once xlc is a bit more stable - for now you probably want -// to stick to gcc... +// Note that the interfaces we use here have been a mess in xlc; +// currently version 13.1.5 is required. static inline SimdFloat gmx_simdcall simdLoad(const float *m) @@ -130,25 +119,15 @@ store(float *m, SimdFloat a) static inline SimdFloat gmx_simdcall simdLoadU(const float *m) { -#if defined(__ibmxl__) || defined(__xlC__) - return { - vec_xlw4(0, const_cast(m)) - } -#else return { *reinterpret_cast(m) }; -#endif } static inline void gmx_simdcall storeU(float *m, SimdFloat a) { -#if defined(__ibmxl__) || defined(__xlC__) - vec_xstw4(a.simdInternal_, 0, m); -#else *reinterpret_cast<__vector float *>(m) = a.simdInternal_; -#endif } static inline SimdFloat gmx_simdcall @@ -176,25 +155,15 @@ store(std::int32_t * m, SimdFInt32 a) static inline SimdFInt32 gmx_simdcall simdLoadUFI(const std::int32_t *m) { -#if defined(__ibmxl__) || defined(__xlC__) - return { - vec_xlw4(0, const_cast(m)) - } -#else return { *reinterpret_cast(m) }; -#endif } static inline void gmx_simdcall storeU(std::int32_t * m, SimdFInt32 a) { -#if defined(__ibmxl__) || defined(__xlC__) - vec_xstw4(a.simdInternal_, 0, m); -#else *reinterpret_cast<__vector int *>(m) = a.simdInternal_; -#endif } static inline SimdFInt32 gmx_simdcall diff --git a/src/gromacs/simd/impl_ibm_vsx/impl_ibm_vsx_util_float.h b/src/gromacs/simd/impl_ibm_vsx/impl_ibm_vsx_util_float.h index 8dedb9a66d..8863765784 100644 --- a/src/gromacs/simd/impl_ibm_vsx/impl_ibm_vsx_util_float.h +++ b/src/gromacs/simd/impl_ibm_vsx/impl_ibm_vsx_util_float.h @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2014,2015,2016, by the GROMACS development team, led by + * Copyright (c) 2014,2015,2016,2017, 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. @@ -55,15 +55,17 @@ gatherLoadTranspose(const float * base, SimdFloat * v2, SimdFloat * v3) { - *v0 = simdLoad( base + align * offset[0] ); - *v1 = simdLoad( base + align * offset[1] ); - *v2 = simdLoad( base + align * offset[2] ); - *v3 = simdLoad( base + align * offset[3] ); - - __vector float t0 = vec_mergeh(v0->simdInternal_, v2->simdInternal_); - __vector float t1 = vec_mergel(v0->simdInternal_, v2->simdInternal_); - __vector float t2 = vec_mergeh(v1->simdInternal_, v3->simdInternal_); - __vector float t3 = vec_mergel(v1->simdInternal_, v3->simdInternal_); + __vector float l0, l1, l2, l3; + + l0 = simdLoad( base + align * offset[0] ).simdInternal_; + l1 = simdLoad( base + align * offset[1] ).simdInternal_; + l2 = simdLoad( base + align * offset[2] ).simdInternal_; + l3 = simdLoad( base + align * offset[3] ).simdInternal_; + + __vector float t0 = vec_mergeh(l0, l2); + __vector float t1 = vec_mergel(l0, l2); + __vector float t2 = vec_mergeh(l1, l3); + __vector float t3 = vec_mergel(l1, l3); v0->simdInternal_ = vec_mergeh(t0, t2); v1->simdInternal_ = vec_mergel(t0, t2); v2->simdInternal_ = vec_mergeh(t1, t3); @@ -316,6 +318,9 @@ expandScalarsToTriplets(SimdFloat scalar, triplets2->simdInternal_ = vec_perm(scalar.simdInternal_, t1, perm2); } +/* TODO In debug mode, xlc 13.1.5 seems to overwrite v0 on the stack, + leading to segfaults. Possibly the calling convention doesn't + implement __vector int correctly. Release mode is OK. gcc is OK. */ template static inline void gmx_simdcall gatherLoadBySimdIntTranspose(const float * base, diff --git a/src/gromacs/simd/tests/simd_math.cpp b/src/gromacs/simd/tests/simd_math.cpp index e02efcaf95..532ab3ec88 100644 --- a/src/gromacs/simd/tests/simd_math.cpp +++ b/src/gromacs/simd/tests/simd_math.cpp @@ -692,8 +692,9 @@ TEST_F(SimdMathTest, atan2SingleAccuracy) GMX_EXPECT_SIMD_REAL_NEAR(setSimdRealFrom1R(std::atan2(1.0, 0.0)), atan2SingleAccuracy(rSimd_1_2_3, setZero())); GMX_EXPECT_SIMD_REAL_NEAR(setSimdRealFrom1R(std::atan2(0.0, -1.0)), atan2SingleAccuracy(setZero(), rSimd_m1_m2_m3)); GMX_EXPECT_SIMD_REAL_NEAR(setSimdRealFrom1R(std::atan2(-1.0, 0.0)), atan2SingleAccuracy(rSimd_m1_m2_m3, setZero())); - // degenerate value (origin) should return 0.0 - GMX_EXPECT_SIMD_REAL_NEAR(setSimdRealFrom1R(std::atan2(0.0, 0.0)), atan2SingleAccuracy(setSimdRealFrom3R(0.0, 0.0, 0.0), setZero())); + // degenerate value (origin) should return 0.0. At least IBM xlc 13.1.5 gets the reference + // value wrong (-nan) at -O3 optimization, so we compare to the correct value (0.0) instead. + GMX_EXPECT_SIMD_REAL_NEAR(setSimdRealFrom1R(0.0), atan2SingleAccuracy(setSimdRealFrom3R(0.0, 0.0, 0.0), setZero())); } TEST_F(SimdMathTest, pmeForceCorrectionSingleAccuracy) From e5242964a563c81e91e04ceea94c141a1772c1d1 Mon Sep 17 00:00:00 2001 From: David van der Spoel Date: Fri, 3 Mar 2017 07:46:05 +0100 Subject: [PATCH 14/20] Removes rogue printing to xvg file in gmx mindist -xvg none is now adhered to, and printing is preceded by a comment. Fixes #2129 Change-Id: Idf7135c7e74ea17747e0f5cacc9298a619e6c90d --- src/gromacs/gmxana/gmx_mindist.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/gromacs/gmxana/gmx_mindist.cpp b/src/gromacs/gmxana/gmx_mindist.cpp index 8947baed50..399256ba2b 100644 --- a/src/gromacs/gmxana/gmx_mindist.cpp +++ b/src/gromacs/gmxana/gmx_mindist.cpp @@ -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,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, 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. @@ -413,15 +413,16 @@ void dist_plot(const char *fn, const char *afile, const char *dfile, sprintf(buf, "%simum Distance", bMin ? "Min" : "Max"); respertime = xvgropen(rfile, buf, output_env_get_time_label(oenv), "Distance (nm)", oenv); xvgr_legend(respertime, ng-1, (const char**)leg, oenv); - if (bPrintResName) + if (bPrintResName && output_env_get_print_xvgr_codes(oenv) ) { fprintf(respertime, "# "); + + for (j = 0; j < nres; j++) + { + fprintf(respertime, "%s%d ", *(atoms->resinfo[atoms->atom[index[0][residue[j]]].resind].name), atoms->atom[index[0][residue[j]]].resind); + } + fprintf(respertime, "\n"); } - for (j = 0; j < nres; j++) - { - fprintf(respertime, "%s%d ", *(atoms->resinfo[atoms->atom[index[0][residue[j]]].resind].name), atoms->atom[index[0][residue[j]]].resind); - } - fprintf(respertime, "\n"); } From a2d8c56cc76248823248130626b799420d414c93 Mon Sep 17 00:00:00 2001 From: Mark Abraham Date: Tue, 7 Mar 2017 13:16:19 +0100 Subject: [PATCH 15/20] Fix minor issues in gmx traj -av -af Made the description of the xvg y-axis more useful. Also works for option -af. Refs #2133 Change-Id: If3796ddbd9841fc442b765afab9ad249954f9316 --- src/gromacs/gmxana/gmx_traj.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gromacs/gmxana/gmx_traj.cpp b/src/gromacs/gmxana/gmx_traj.cpp index 28dbbd9e79..e7025cdd23 100644 --- a/src/gromacs/gmxana/gmx_traj.cpp +++ b/src/gromacs/gmxana/gmx_traj.cpp @@ -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,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, 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. @@ -461,7 +461,7 @@ static void write_pdb_bfac(const char *fname, const char *xname, svmul(scale, sum[index[i]], sum[index[i]]); } - fp = xvgropen(xname, title, "Atom", "", oenv); + fp = xvgropen(xname, title, "Atom", "Spatial component", oenv); for (i = 0; i < isize; i++) { fprintf(fp, "%-5d %10.3f %10.3f %10.3f\n", 1+i, From 66ec44e6ffaf2a72b17a01aa16cd451bf7968217 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Szil=C3=A1rd=20P=C3=A1ll?= Date: Tue, 7 Mar 2017 03:49:52 +0100 Subject: [PATCH 16/20] Fix mdrun hanging upon exit with sep PME ranks Commit 1d2d95e introduced a check and early return to skip printing perf stats when no valid wallcycle data was collected (due to missed reset). However, as the validity of wallcycle data does not get checked/recorded on separate PME ranks, mdrun deadlocks before exit in collective comm that PME ranks never enter. This change fixes the hang by refactoring the printing code to use a boolean rather than an early return. This means the normal code path is unaffected in all cases (only the simulation master can ever write reports), and the case where it is invalid to write a report (premature termination) works correctly because all ranks communicate the data for the report that is never written (and efficiency is not of concern in this case). Fixes #2131 Change-Id: If8b0813444d0b00a1a9a4a21d30fc8655c52752a --- src/gromacs/mdlib/sim_util.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/gromacs/mdlib/sim_util.cpp b/src/gromacs/mdlib/sim_util.cpp index 11a2f4faca..4973896b2c 100644 --- a/src/gromacs/mdlib/sim_util.cpp +++ b/src/gromacs/mdlib/sim_util.cpp @@ -2574,12 +2574,22 @@ void finish_run(FILE *fplog, t_commrec *cr, elapsed_time_over_all_ranks, elapsed_time_over_all_threads, elapsed_time_over_all_threads_over_all_ranks; + /* Control whether it is valid to print a report. Only the + simulation master may print, but it should not do so if the run + terminated e.g. before a scheduled reset step. This is + complicated by the fact that PME ranks are unaware of the + reason why they were sent a pmerecvqxFINISH. To avoid + communication deadlocks, we always do the communication for the + report, even if we've decided not to write the report, because + how long it takes to finish the run is not important when we've + decided not to report on the simulation performance. */ + bool printReport = SIMMASTER(cr); if (!walltime_accounting_get_valid_finish(walltime_accounting)) { md_print_warn(cr, fplog, "Simulation ended prematurely, no performance report will be written."); - return; + printReport = false; } if (cr->nnodes > 1) @@ -2617,7 +2627,7 @@ void finish_run(FILE *fplog, t_commrec *cr, } #endif - if (SIMMASTER(cr)) + if (printReport) { print_flop(fplog, nrnb_tot, &nbfs, &mflop); } @@ -2640,7 +2650,7 @@ void finish_run(FILE *fplog, t_commrec *cr, wallcycle_scale_by_num_threads(wcycle, cr->duty == DUTY_PME, nthreads_pp, nthreads_pme); auto cycle_sum(wallcycle_sum(cr, wcycle)); - if (SIMMASTER(cr)) + if (printReport) { struct gmx_wallclock_gpu_t* gputimes = use_GPU(nbv) ? nbnxn_gpu_get_timings(nbv->gpu_nbv) : NULL; From 6cc8a422f03742fd1943fc4b7e8943e025a133ae Mon Sep 17 00:00:00 2001 From: Teemu Murtola Date: Sat, 11 Mar 2017 13:25:40 +0100 Subject: [PATCH 17/20] Update copyright year for gmx -version Change-Id: Ic981569e7bf73457341ac8c804a4c32eb476dca2 --- src/gromacs/utility/binaryinformation.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gromacs/utility/binaryinformation.cpp b/src/gromacs/utility/binaryinformation.cpp index a366b2f827..9feb963c50 100644 --- a/src/gromacs/utility/binaryinformation.cpp +++ b/src/gromacs/utility/binaryinformation.cpp @@ -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,2016, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017, 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. @@ -135,7 +135,7 @@ void printCopyright(FILE *fp) }; static const char * const CopyrightText[] = { "Copyright (c) 1991-2000, University of Groningen, The Netherlands.", - "Copyright (c) 2001-2015, The GROMACS development team at", + "Copyright (c) 2001-2017, The GROMACS development team at", "Uppsala University, Stockholm University and", "the Royal Institute of Technology, Sweden.", "check out http://www.gromacs.org for more information." From 7acdd88af6ffde8f77c00c98e36745200bc3a3f8 Mon Sep 17 00:00:00 2001 From: Ake Sandgren Date: Thu, 9 Mar 2017 14:54:43 +0100 Subject: [PATCH 18/20] Fix spacing in tune_pme call to thread-mpi mdrun Change-Id: I6443ec513a1e4f92d1dc4b65b5ffd4826f93bc24 --- src/gromacs/gmxana/gmx_tune_pme.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gromacs/gmxana/gmx_tune_pme.cpp b/src/gromacs/gmxana/gmx_tune_pme.cpp index 90dc653b1a..f8089d2041 100644 --- a/src/gromacs/gmxana/gmx_tune_pme.cpp +++ b/src/gromacs/gmxana/gmx_tune_pme.cpp @@ -669,7 +669,7 @@ static void check_mdrun_works(gmx_bool bThreads, if (bThreads) { snew(command, std::strlen(cmd_mdrun) + std::strlen(cmd_np) + std::strlen(filename) + 50); - sprintf(command, "%s%s-version -maxh 0.001 1> %s 2>&1", cmd_mdrun, cmd_np, filename); + sprintf(command, "%s%s -version -maxh 0.001 1> %s 2>&1", cmd_mdrun, cmd_np, filename); } else { From 1ba7669ea341489d4db2a8bec0f88f6a73f0a328 Mon Sep 17 00:00:00 2001 From: Ake Sandgren Date: Thu, 9 Mar 2017 14:57:07 +0100 Subject: [PATCH 19/20] Fix tune_pme detection of GPU support Change-Id: I60540cefe912f9ae3f602f90fa962bcf62bc61b4 --- src/gromacs/gmxana/gmx_tune_pme.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gromacs/gmxana/gmx_tune_pme.cpp b/src/gromacs/gmxana/gmx_tune_pme.cpp index f8089d2041..02cdca3fce 100644 --- a/src/gromacs/gmxana/gmx_tune_pme.cpp +++ b/src/gromacs/gmxana/gmx_tune_pme.cpp @@ -659,10 +659,10 @@ static void check_mdrun_works(gmx_bool bThreads, * gmx_print_version_info() in the GMX_MPI section */ const char match_mpi[] = "MPI library: MPI"; const char match_mdrun[] = "Executable: "; - const char match_gpu[] = "GPU support: enabled"; + const char match_nogpu[] = "GPU support: disabled"; gmx_bool bMdrun = FALSE; gmx_bool bMPI = FALSE; - gmx_bool bHaveGpuSupport = FALSE; + gmx_bool bHaveGpuSupport = TRUE; /* Run a small test to see whether mpirun + mdrun work */ fprintf(stdout, "Making sure that mdrun can be executed. "); @@ -702,9 +702,9 @@ static void check_mdrun_works(gmx_bool bThreads, { bMPI = TRUE; } - if (str_starts(line, match_gpu) ) + if (str_starts(line, match_nogpu) ) { - bHaveGpuSupport = TRUE; + bHaveGpuSupport = FALSE; } } } From 078ecb7e8aa8a6c8294212666aca8d3876d0057f Mon Sep 17 00:00:00 2001 From: Mark Abraham Date: Mon, 13 Mar 2017 18:11:56 +0100 Subject: [PATCH 20/20] Version 2016.3 Bumped regressiontests hash and minor soversion as usual. Change-Id: I9cd923d17fd9de1a873d316fdac168d986326d8c --- cmake/gmxVersionInfo.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/gmxVersionInfo.cmake b/cmake/gmxVersionInfo.cmake index 3ebc5f3789..0c60c9f672 100644 --- a/cmake/gmxVersionInfo.cmake +++ b/cmake/gmxVersionInfo.cmake @@ -205,7 +205,7 @@ set(GMX_VERSION_SUFFIX "") # code being able to dynamically link with a version of libgromacs # that might not work. set(LIBRARY_SOVERSION_MAJOR 2) -set(LIBRARY_SOVERSION_MINOR 2) +set(LIBRARY_SOVERSION_MINOR 3) set(LIBRARY_VERSION ${LIBRARY_SOVERSION_MAJOR}.${LIBRARY_SOVERSION_MINOR}.0) ##################################################################### @@ -228,7 +228,7 @@ endif() set(REGRESSIONTEST_VERSION "${GMX_VERSION_STRING}") set(REGRESSIONTEST_BRANCH "refs/heads/release-2016") -set(REGRESSIONTEST_MD5SUM "e4d24e3c5f28602c2429b3a389121de8" CACHE INTERNAL "MD5 sum of the regressiontests tarball") +set(REGRESSIONTEST_MD5SUM "bed92d1d9cdca66fbd2efa142b6e0dd3" CACHE INTERNAL "MD5 sum of the regressiontests tarball") math(EXPR GMX_VERSION_NUMERIC "${GMX_VERSION_MAJOR}*10000 + ${GMX_VERSION_PATCH}")