alexxy/gromacs.git
7 years agoMerge branch release-2016
Mark Abraham [Tue, 9 May 2017 11:06:37 +0000 (13:06 +0200)]
Merge branch release-2016

Change-Id: I4c632a9ac632f73afe4e9ac43f31dcc5f4b520fc

7 years agoCleaned up memory usage in gmx traj and trjconv
Mark Abraham [Mon, 17 Apr 2017 14:40:12 +0000 (16:40 +0200)]
Cleaned up memory usage in gmx traj and trjconv

These have test coverage, so their memory leaks can show up in
Jenkins, so need fixing.

Removed the frame title from t_trxframe. This was only ever relevant
for the non-binary file formats, and was not really used consistently
there. For example, trjconv always constructed a title, because it
needs to do so if the file that it read was a binary trajectory file,
which is a frequent use case when writing a non-binary trajectory file
(e.g. export xtc to pdb). The g96 format was also handled differently
from gro and pdb, which was not necessary. Because sometimes a
non-binary conformation file is read and used to create a topology, a
symbol table entry was managed when it was not required when that file
was actually being treated as a trajectory file. Nowhere was a title
being read into a t_trxframe, and later written from that t_trxframe
in a different scope, so there is no need to store it.

Removed close_trj. This duplicated function makes it hard to implement
C-style cleanup that works properly and is maintainable without
leaking memory in one place or another.

Removed premature initialization of t_topology in trjconv. The initial
contents are over-written in read_tps_conf(). Documented that the caller
of that function must call done_top().

Reading g96 files was uselessly creating a symtab. This is only needed
if fr->atoms is valid, but if so then there would be a symtab to pass
in. fr->atoms is valid when we write, and in read_stx_conf, but this
is not the case for general trajectory-frame reading.

Memory allocated by TNG was leaking, so created free_wrapper() so
we can have an RAII guard for that.

Initialized some more pointers in trjconv.

Change-Id: I3c7ca63cc39f21c69810997a90ae2b45b6845263

7 years agoXpm test for gmx clustsize
David van der Spoel [Fri, 24 Mar 2017 15:29:44 +0000 (16:29 +0100)]
Xpm test for gmx clustsize

Made computation of RGB colors for matrix double precision.

Removed printing of binary information in xpm files
since it makes the header not reproducible. This is
not very useful anyway and the alternative to write
an XPM matcher would be overkill.

Change-Id: I4b12da5aaae246e4a146496b6973d5d6880fbf91

7 years agoMinor header file cleanup in ED, IMD and CompEL modules
Carsten Kutzner [Thu, 20 Apr 2017 13:02:58 +0000 (15:02 +0200)]
Minor header file cleanup in ED, IMD and CompEL modules

- removed dependency on wallcycle.h by forward declaring gmx_wallcycle,
  same with gmx_domdec_t
- merged and sorted "struct xyz" statements in these headers
- removed an unused gmx_wallcycle declaration in bonded.h
- removed unnecessary extern "C" statement in bonbded.h
- included <cstdio> instead of <stdio.h>

Change-Id: Ic397cdccb735b409b10802971ab60d8e078cd32e

7 years agoignore OS X Finder metadata
M. Eric Irrgang [Sat, 22 Apr 2017 19:47:47 +0000 (15:47 -0400)]
ignore OS X Finder metadata

Change-Id: I15dbf21ccf4157372c0f4f2d5b699a5d36a0618c

7 years agosort ignored file extensions
M. Eric Irrgang [Sat, 22 Apr 2017 19:42:05 +0000 (15:42 -0400)]
sort ignored file extensions

Change-Id: I9c84e10c2371f841cf530239d8748dacd12c4b63

7 years agoignore g++ precompiler header output
M. Eric Irrgang [Sat, 22 Apr 2017 19:40:15 +0000 (15:40 -0400)]
ignore g++ precompiler header output

Change-Id: Id23eca3422a50817b9e3b49ff49c6fb4e85b4d11

7 years agoClean up memory usage with oenv and xvg writing
Mark Abraham [Thu, 20 Apr 2017 09:18:29 +0000 (11:18 +0200)]
Clean up memory usage with oenv and xvg writing

Change-Id: I41386eaa7a045d115599b8f8a1839d12f7e4400d

7 years agoFix bugs in double AVX(2)_256 Simd4
Berk Hess [Fri, 21 Apr 2017 13:59:37 +0000 (15:59 +0200)]
Fix bugs in double AVX(2)_256 Simd4

The double precision version of reduce() and dotProduct()
returned a float with AVX_256 and AVX2_256.
Only reduce() is used in double, in the PME force gather.

Fixes #2162.

Change-Id: Iaa44921215e726726b2da223f3677c8637bc65ae

7 years agoRemove unused forward declarations of t_commrec in two headers
Carsten Kutzner [Wed, 19 Apr 2017 14:39:13 +0000 (16:39 +0200)]
Remove unused forward declarations of t_commrec in two headers

Change-Id: If2121af1baf280ffdcf028d5093db113e8fede6e

7 years agoFix unused SIMD PME table kernel
Berk Hess [Wed, 22 Mar 2017 18:16:31 +0000 (19:16 +0100)]
Fix unused SIMD PME table kernel

The nbnxn 2xNN PME kernel with tabulated correction had incorrect
forces by a factor 1 to 2. This kernel flavor could only be selected
manually by setting an environment variable.

Change-Id: I9a0ab8b155000ed43abbea3a9a7a58f692a884ec

7 years agoSuppress two compiler warnings
Berk Hess [Thu, 13 Apr 2017 19:57:24 +0000 (21:57 +0200)]
Suppress two compiler warnings

Change-Id: I61c0d9921e6e7a29d7e1380036a7519d91787128

7 years agoFixed AVX-512F compiler flags
Erik Lindahl [Sat, 1 Apr 2017 08:14:03 +0000 (10:14 +0200)]
Fixed AVX-512F compiler flags

Avoid using the MIC code generation flags for
the Xeon code path.

Change-Id: Ife0d36b95dda53edcd62959bd513c7d74b263766

7 years agoMinor change to GPU compatibility reporting handling
Mark Abraham [Mon, 17 Apr 2017 14:22:12 +0000 (16:22 +0200)]
Minor change to GPU compatibility reporting handling

The old code returned an int that was used to look up an
array of strings, and analysis programs can't tell whether
the use was valid.

While we could try to return an enum, instead the logic
of whether a device is compatible is separated from
describing why it isn't.

Noted TODO to move the definition of those strings to a good single
place, when there is one.

Change-Id: I504f4e7efcfcb76f97873ff1f98bee9c67b157a3

7 years agoPropose a post-submit matrix
Mark Abraham [Thu, 9 Mar 2017 17:49:12 +0000 (18:49 +0100)]
Propose a post-submit matrix

A recent bug would have been prevented if some testing of
separate PME ranks had been occuring.

Extended gromacs.py to permit regressiontests to run
with separate PME ranks, and/or designated numbers of
ranks, or GPU ids.

Quieted some newly exposed warnings.

Documented more of the reasoning behind matrix choices, to help us
maintain better. Noted various TODOs for better testing coverage.

Refs #2134

Change-Id: Ib9828ca769d7a446c61fb8bb7a68128a38991aba

7 years agoConsistent approach for whole-program tests
Teemu Murtola [Fri, 31 Mar 2017 19:34:02 +0000 (22:34 +0300)]
Consistent approach for whole-program tests

All tests that essentially execute one command-line program as the test
are now using CommandLineTestBase, which makes them much simpler, easier
to read, and a better source for copy-pasting new tests.  Move the
functionality of IntegrationTestFixture to a helper class that can be
used in any kind of test and not excluding other types of useful
fixtures from tests that need that functionality.

Tests that execute mdrun are not changed here to keep the scope limited.

Change-Id: Ic49593d6e27c48be43021e4fc9b1fcd685d43ffd

7 years agoImprove key-value tree gmx dump support
Teemu Murtola [Sun, 26 Mar 2017 11:31:08 +0000 (14:31 +0300)]
Improve key-value tree gmx dump support

Add test coverage for basic option types with the functionality used by
gmx dump, and implement missing types.  Move the dump functionality into
a free function.  Expose the to-string conversion for basic Variant
values outside keyvaluetree.cpp, as that will be at least transitionally
needed elsewhere, and it can also be useful for debugging.

Change-Id: I8d85ea308bec9369557b54528622948ead3fbed5

7 years agoReally enable avx512 in fftw only for select compilers
Vedran Miletić [Mon, 3 Apr 2017 15:46:05 +0000 (17:46 +0200)]
Really enable avx512 in fftw only for select compilers

Commit aa905d6 attempted to enable avx512 on GCC 4.9 or newer and
Clang 3.9 or newer, but had elseif() in place of else() and resulted
in no SIMD being enabled.

This patch really enables avx512 on supported compilers, and takes
care of all compilers we officially support (MSVC, GCC, Clang, ICC).

Change-Id: Ia626b4cc6c82a2155d633f1482b99d3b2601fa3a

7 years agoFix memory access issues in gmx solvate
Teemu Murtola [Tue, 28 Mar 2017 17:16:38 +0000 (20:16 +0300)]
Fix memory access issues in gmx solvate

There were out-of-bounds access if
 1) the solvent configuration was given as a .pdb file, or
 2) there were more than one type of residue in the solvent (which
    triggered sorting).

Also fix a memory leak in the sorting routine.

Should fix crashes mentioned in #2148.

Change-Id: If08a7bea989803dc5641f53478004e830268750d

7 years agoConsistent naming for gmxana tests
Teemu Murtola [Fri, 31 Mar 2017 14:54:34 +0000 (17:54 +0300)]
Consistent naming for gmxana tests

Move gmxana tests from legacytests/ to tests/ to make them conform with
the same approach as other tests.  Split the tests for different tools
to different test files, conforming to the name of the tool source file.
Some other minor cleanup.

Change-Id: I5df79ebe0fdb7a8fcc8057d54994ec64e531e2a4

7 years agoUtility functions for formatting string values
Teemu Murtola [Sun, 26 Mar 2017 11:30:25 +0000 (14:30 +0300)]
Utility functions for formatting string values

Add functions to convert various values to strings to strconvert.h, and
use these in a few places for consistency.  Move a related function from
stringutil.h as well to the same location.

Change-Id: Iac9e1574c3571e26011a32598d51bd3349d33329

7 years agoRemove do_pbc_first
Mark Abraham [Mon, 27 Mar 2017 20:33:49 +0000 (22:33 +0200)]
Remove do_pbc_first

mdrun hasn't used this in nearly a decade, since ec5d23831. Also
genion stopped using it too.

Change-Id: I6d63d79281ead261765ecaafc6cef691893ab6ab

7 years agoMerge branch release-2016
Mark Abraham [Fri, 31 Mar 2017 14:29:54 +0000 (16:29 +0200)]
Merge branch release-2016

Change-Id: I536af0bcfba93ecf3e2afeb847120dc8f637cc92

7 years agoFix parameter description for dihedral_restraints
Mark Abraham [Tue, 21 Mar 2017 10:14:15 +0000 (11:14 +0100)]
Fix parameter description for dihedral_restraints

The force-constant parameter for dihedral_restraints was not
documented in the table of interaction types.

Refs #2144

Change-Id: Iac28e88e966f1c2b7a8fe533e97abe94173470eb

7 years agoRefactor CUDA kernel use of tables
Szilárd Páll [Mon, 27 Mar 2017 16:24:28 +0000 (18:24 +0200)]
Refactor CUDA kernel use of tables

In prepartion for supporting fallback texture-less parameter loads.

Change-Id: I89b9a1af1bb8954449cf540e88a20855c68fa7f9

7 years agoAdd CUDA util function for constant loads
Szilárd Páll [Tue, 21 Mar 2017 20:41:50 +0000 (21:41 +0100)]
Add CUDA util function for constant loads

The __ldg instrinsic can be useful for loading through either texture or
L1 cache (former until CC 3.x latter in later arch). This change
provides an inline-able implementation with a fallback for older
architectures.

The function is used only a single not performance-relevant place
and it is mainly added in preparation for PME-CUDA and clang-CUDA changes.

Change-Id: I2789f47e444519b4d4bcf840ff844a01adb68078

7 years agoConditional tweak in the nonbonded GPU kernels
Szilárd Páll [Sun, 19 Mar 2017 23:47:32 +0000 (00:47 +0100)]
Conditional tweak in the nonbonded GPU kernels

GPU compilers miss an easy optimization of a loop invariant in the
inner-lop conditional. Precomputing part of the conditional together
with using bitwise instead of logical and/or improves performance with
most compilers by up to 5%.

Change-Id: I3ba0b9025b11af3d8465e0d26ca69a78e32a0ece

7 years agoAdd section to user guide for managing simulations
Mark Abraham [Sat, 18 Mar 2017 00:24:58 +0000 (01:24 +0100)]
Add section to user guide for managing simulations

Reworked wiki documentation on extending simulations, doing restarts
and reproducibility.

Documented mdp option simulation-part.

Change-Id: I3bbae8f25cb5e2fef6163bb073f90bd48af4a0a7

7 years agoUse OpenMP up to 16 threads with AMD Ryzen
Erik Lindahl [Sun, 19 Mar 2017 16:57:33 +0000 (17:57 +0100)]
Use OpenMP up to 16 threads with AMD Ryzen

AMD Ryzen appears to always perform slightly better with OpenMP
than MPI, up to using all 16 threads on the 8-core die.

Change-Id: Iaaf77c87b7f69cabfd3dd7f1b080f3ee45d4ce89

7 years ago128-bit AVX2 SIMD for AMD Ryzen
Erik Lindahl [Tue, 14 Mar 2017 13:35:35 +0000 (14:35 +0100)]
128-bit AVX2 SIMD for AMD Ryzen

While Ryzen supports 256-bit AVX2, the internal units are organized
to execute either a single 256-bit instruction or two 128-bit SIMD
instruction per cycle. Since most of our kernels are slightly
less efficient for wider SIMD, this improves performance by roughly
10%.

Change-Id: Ie601b1dbe13d70334cdf9284e236ad9132951ec9

7 years agoFix string handling for gcc 7
Mark Abraham [Thu, 16 Mar 2017 14:29:48 +0000 (15:29 +0100)]
Fix string handling for gcc 7

Pre-release gcc 7 warns about potential buffer overflows, so we may as
well fix them.

Change-Id: Ia154faf13b84473f073e5d553c7c275c19cbccec

7 years agoMerge "Merge branch release-2016"
Gerrit Code Review [Sat, 18 Mar 2017 13:07:10 +0000 (14:07 +0100)]
Merge "Merge branch release-2016"

7 years agoAllow bypassing OpenCL device compatibility check
Szilárd Páll [Wed, 3 Aug 2016 19:29:33 +0000 (21:29 +0200)]
Allow bypassing OpenCL device compatibility check

An environment variable added to allow testing on platforms
(e.g. Intel iGPU) without source modification.

Change-Id: I1daef54509427475267e3e6b1a8fcbe4ed529b48

7 years agoAdd an extra verbose target for docs
M. Eric Irrgang [Fri, 10 Mar 2017 20:36:23 +0000 (15:36 -0500)]
Add an extra verbose target for docs

In reference to issue #2138

The "full" documentation does not include
several options that make it easier to dig
through the code so a new build target
may be in order rather than changing the
behavior of "doxygen-full".

I expect verbose builds to be most useful
during development when new graphs and
diagrams are not needed, but in attempt to
follow current conventions, I use DEPGRAPHS
and the automatically generated `-fast`
version of the doc target.

Additionally Doxyfile-compact (inclusion
triggered with `cmake -DGMX_COMPACT_DOXYGEN=ON`)
is not as compact as it could be.

Change-Id: I932aef30420f8da182a9aa3f5de03348cdaeea71

7 years agoFix dereferencing nullptr in PME solve work destructor
Aleksei Iupinov [Fri, 17 Mar 2017 13:17:26 +0000 (14:17 +0100)]
Fix dereferencing nullptr in PME solve work destructor

Change-Id: I14fd0108cec6ebe61ea67556ca99b95440087f0e

7 years agoReplace instance of group by coord in pull mdp docs
Berk Hess [Thu, 16 Mar 2017 11:45:00 +0000 (12:45 +0100)]
Replace instance of group by coord in pull mdp docs

Change-Id: I8d778f93c445b74764596f33f5cbfc39ee2ff1f4

7 years agoPrint code of unknown OpenCL error
Szilárd Páll [Tue, 14 Mar 2017 14:39:08 +0000 (15:39 +0100)]
Print code of unknown OpenCL error

Change-Id: I1e7f6e7065a5f0470e0005ae35e6535bff86269f

7 years agoFix gcc compiles of AVX-512 SIMD
Erik Lindahl [Tue, 14 Mar 2017 17:58:04 +0000 (17:58 +0000)]
Fix gcc compiles of AVX-512 SIMD

A previous change to improve shuffling for AVX-512 was
likely only tested on icc, while gcc requires an explicit
pointer cast. Tested on AVX-512 hardware.

Change-Id: I9f4a35f52a54487ff4f403b135391187b1682f8f

7 years agoMerge branch release-2016
Mark Abraham [Tue, 14 Mar 2017 14:40:05 +0000 (15:40 +0100)]
Merge branch release-2016

Change-Id: I14f7cd22447b8a76110d8b41487666eb49835835

7 years agoBumped version to prepare for next patch release
Mark Abraham [Tue, 14 Mar 2017 13:08:55 +0000 (14:08 +0100)]
Bumped version to prepare for next patch release

Change-Id: Ic368ff6186fb35d86fc2e7dfb6c6513eb48235d5

7 years agoMake grompp -r obligatory with posres
Berk Hess [Fri, 9 Dec 2016 08:40:13 +0000 (09:40 +0100)]
Make grompp -r obligatory with posres

With position restraints it would often occur that users accidentally
used equilibrated coordinates instead of the original coordinates
for position restraint coordinates due to grompp -r defaulting to -c.
Now -r always need to be supplied with position restraints, but using
the same file name as with -c will reproduce the old behavior.

Change-Id: Ie4d931897e155114d1162b329c9336627af39a45

7 years agoVersion 2016.3
Mark Abraham [Mon, 13 Mar 2017 17:11:56 +0000 (18:11 +0100)]
Version 2016.3

Bumped regressiontests hash and minor soversion as usual.

Change-Id: I9cd923d17fd9de1a873d316fdac168d986326d8c

7 years agoModernize write_inpfile
Mark Abraham [Sun, 1 Jan 2017 10:13:13 +0000 (10:13 +0000)]
Modernize write_inpfile

Used std::string, gmx::TextOutputFile and gmx::TextWriter to simplify
and permit testing.

To do so, modified the interface of various helper functionality so
that it can use a TextWriter that the caller could build with
something other than a FILE stream if they wanted to. This would also
be more convenient for testing them, if we ever do that.

Moved nice_header to utility/niceheader.h, renamed it
niceHeader, and permitted its caller to specify the comment character.

Moved string-handling behaviour out of cuda_version_information,
while ensuring no C++11 functionality is needed.

Updated documentation of intended scope of sysinfo.h, and removed c++
guard.

Change-Id: I6ab250c982a8e9e9ee3dacb6575ccc04f17e689c

7 years agoModernize read_inpfile
Mark Abraham [Wed, 21 Dec 2016 05:19:22 +0000 (16:19 +1100)]
Modernize read_inpfile

Used std::string and gmx::TextReader to simplify this. It is likely no
longer as efficient because it now makes several std::string objects
per line, but this is not a significant part of the execution time of
e.g. grompp.

Move COMMENTSIGN to cstringutil.cpp, now that this is an
implementation detail of string-handling code, rather than also used
in readinp.cpp.

Moved responsibility for stripping of comments to TextReader, reworked
its whitespace-trimming behaviour, and introduced some tests for that
class.

Introduced some TODO items to reconsider multiple behaviours where
read_inpfile ignores what could be malformed input. It is used for
grompp, xpm2ps and membed, however, so it is not immediately clear
what fixes might be appropriate, and we might anyway remove this
code shortly.

Introduced catches for exceptions that might be thrown while calling
read_inpfile (and related code that might change soon).

Added tests for newly introduced split-and-trim functionality that
supports read_inpfile.

Refs #2074

Change-Id: Id9c46d60a3ec7ecdcdb9529bba2fdb68ce241914

7 years agoFix tune_pme detection of GPU support
Ake Sandgren [Thu, 9 Mar 2017 13:57:07 +0000 (14:57 +0100)]
Fix tune_pme detection of GPU support

Change-Id: I60540cefe912f9ae3f602f90fa962bcf62bc61b4

7 years agoFix spacing in tune_pme call to thread-mpi mdrun
Ake Sandgren [Thu, 9 Mar 2017 13:54:43 +0000 (14:54 +0100)]
Fix spacing in tune_pme call to thread-mpi mdrun

Change-Id: I6443ec513a1e4f92d1dc4b65b5ffd4826f93bc24

7 years agoTests for grompp -f -po
Mark Abraham [Mon, 13 Feb 2017 17:39:45 +0000 (18:39 +0100)]
Tests for grompp -f -po

This requires slight refactoring so that when testing we can avoid
writing the header. The header has useful things embedded in it (date,
user name, etc.) but those are not reproducible in a test. All the old
callers of write_inpfile now pass a value that triggers the same
behaviour they used to have, of writing the helpful header. The new
testcase fixture avoids writing that header.

It would be preferable not to write files during testing, which will
be possible with some follow-up changes permit read_inpfile and
write_inputfile to use text stream interfaces.

A bug in the handling of mdp reading and handling was exposed and is
fixed. The use of inp_count is poorly designed, and does not work in
the edge case where there are no keys in the input file. Touching an
empty file to give to grompp for it to fill is something that people
actually do to get a full mdp file to edit, so we should make it work
soundly.

Fixes #2074

Change-Id: Ibd3901d39333eb601e716430dec65f0c290af858

7 years agoImprove option support & tests for key-value trees
Teemu Murtola [Sat, 11 Mar 2017 13:14:30 +0000 (15:14 +0200)]
Improve option support & tests for key-value trees

Add basic tests for the behavior of different option types with
key-value tree handling.  For now, the test covers only the "adjust"
function.  Make enum options serialize as strings instead of integers,
which improves behavior of gmx dump and gmx check, and can also be more
robust for backward/forward compatibility.

Improve the way the key-value tree serialization tests are done: use the
in-memory serializer to test roundtrips, instead of relying on the
reference data.  There is less code this way, and the tests behave
better in the absence of reference data.

Change-Id: I5e52265333f397bd6e058636691cbfd21092df0d

7 years agoRemove manual alignment from InMemorySerializer
Teemu Murtola [Sat, 11 Mar 2017 17:00:54 +0000 (19:00 +0200)]
Remove manual alignment from InMemorySerializer

This makes the serialized form more compact, and removes one source of
uncertainty on whether the code works in all possible scenarios.

Also, fix a case that seems to crash on Windows debug builds if a string
is serialized last, indexing the buffer beyond the end even though the
pointer is never dereferenced.

Change-Id: I95ffaefc2296dda1b4f9302003c90fac9ace2a9e

7 years agoConsistent TextWriter trailing whitespace handling
Teemu Murtola [Sat, 11 Mar 2017 08:06:11 +0000 (10:06 +0200)]
Consistent TextWriter trailing whitespace handling

Depending on how exactly the writer was called, trailing whitespace in
the input strings was either preserved or removed.  Now it behaves at
least more predictably.  Add tests.

The actual change is in the line wrapper.

Change-Id: I44d545cac53bc2c3aef363ec259ec82cbd1aec90

7 years agoAdded tests for gmx clustsize.
David van der Spoel [Tue, 7 Mar 2017 18:39:25 +0000 (19:39 +0100)]
Added tests for gmx clustsize.

Some bone headed stuff to allow development of a new
version later. Unfortunately this now touches code
outside the analysis tool due to memory leaks that have to be
fixed.

Part of #2132

Change-Id: I32558e3a7cd7448954cf093208c15ce7014942ff

7 years agoUpdate copyright year for gmx -version
Teemu Murtola [Sat, 11 Mar 2017 12:25:40 +0000 (13:25 +0100)]
Update copyright year for gmx -version

Change-Id: Ic981569e7bf73457341ac8c804a4c32eb476dca2

7 years agoFix mdrun hanging upon exit with sep PME ranks
Szilárd Páll [Tue, 7 Mar 2017 02:49:52 +0000 (03:49 +0100)]
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

7 years agoRefactor GPU selection handling
Mark Abraham [Mon, 20 Feb 2017 16:23:22 +0000 (17:23 +0100)]
Refactor GPU selection handling

Some code was largely duplicated between CUDA and OpenCL
implementations, which has been reduced by extracting the single line
of implementation-specific logic, and calling that from code that can
now live in the general hardware module.

There's also some related clean-up of allocation, logic, string
handling, and documentation.

Change-Id: I9eeade90e2fe44490e1a517e4c045e61ad4afc80

7 years agoFix minor issues in gmx traj -av -af
Mark Abraham [Tue, 7 Mar 2017 12:16:19 +0000 (13:16 +0100)]
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

7 years agoRemove MDModules use from mdlib
Teemu Murtola [Sun, 26 Feb 2017 19:07:15 +0000 (21:07 +0200)]
Remove MDModules use from mdlib

This reduces coupling by reducing the scope where MDModules (which, in
turn, knows all modules) is known.  It also removes a cyclic
module-level dependency that was introduced earlier in the refactoring.

Change-Id: I7ae3b4ad90a2cb99d97c2ece69e9c5d34fcceb9e

7 years agoRemoves rogue printing to xvg file in gmx mindist
David van der Spoel [Fri, 3 Mar 2017 06:46:05 +0000 (07:46 +0100)]
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

7 years agoSplit md module facets to different interfaces
Teemu Murtola [Sun, 26 Feb 2017 18:45:13 +0000 (20:45 +0200)]
Split md module facets to different interfaces

Now that IInputRecExtension is no longer embedded in t_inputrec, split
the interface to more focused interfaces.  Put each interface to its own
file, and introduce IMDModule that allows getting an instance of each
interface symmetrically from a module.  This also allows modules to
return null for interfaces they do now need to implement, but that is
not supported very well yet.

Change-Id: I7641e90fea3f63d7c5f987fd7595912a1286cce9

7 years agoFixes for xl compilers 13.1.5 on Power8
Mark Abraham [Fri, 27 Jan 2017 17:57:10 +0000 (18:57 +0100)]
Fixes for xl compilers 13.1.5 on Power8

Applied Erik's recent fix also for the atan2SinglePrecisionAccuracy
test.

Refs #2102

Change-Id: I230dac8084be2d0693cb616b5a5951b0ae4b71a6

7 years agoDocument that we now support AMD GCN on Mesa/LLVM
Vedran Miletić [Thu, 2 Mar 2017 14:36:52 +0000 (15:36 +0100)]
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

7 years agoRemove outdated CUDA version check
Aleksei Iupinov [Tue, 28 Feb 2017 15:29:38 +0000 (16:29 +0100)]
Remove outdated CUDA version check

Change-Id: I48aae494a0385ed1f923d6956b181b6d1256e259

7 years agoRemove unnecessary include
Carsten Kutzner [Thu, 2 Mar 2017 16:15:50 +0000 (17:15 +0100)]
Remove unnecessary include

Change-Id: I08920182fc1644bfd23e594c23bca13ccaa59f38

7 years agoEnable avx512 in fftw only if compiler supports it
Vedran Miletić [Wed, 1 Mar 2017 14:52:25 +0000 (15:52 +0100)]
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

7 years agoAdd load balance fraction to DLB print
Berk Hess [Fri, 7 Oct 2016 14:43:42 +0000 (16:43 +0200)]
Add load balance fraction to DLB print

DLB can often be based on a small fraction of the total step time,
especially with GPUs. Now this is printed to md.log and stderr.
Also restructured and clarified print_dd_load_av().

Change-Id: Ibe8040b22b5995f0017c9a13e4f707fab02112ab

7 years agoMerge "Merge branch release-5-1 into release-2016" into release-2016
Gerrit Code Review [Tue, 28 Feb 2017 13:13:33 +0000 (14:13 +0100)]
Merge "Merge branch release-5-1 into release-2016" into release-2016

7 years agoMore documentation for key-value trees
Teemu Murtola [Sat, 25 Feb 2017 19:27:42 +0000 (21:27 +0200)]
More documentation for key-value trees

Document most of the builder APIs for key-value trees, and some of the
functions in the data structures themselves.  This should cover most of
the functionality that is currently visible to IInputRecExtension modules.

Some clean-up and additional asserts for the builder API.

Change-Id: Ifa0d86bcd62661616008ec61db47ddd0ba7a6ead

7 years agoFixes bug in gmx solvate with -shell that yielded 0 SOL.
David van der Spoel [Fri, 10 Feb 2017 06:43:44 +0000 (07:43 +0100)]
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

7 years agoDecouple t_inputrec from MDModules
Teemu Murtola [Sun, 26 Feb 2017 13:02:43 +0000 (15:02 +0200)]
Decouple t_inputrec from MDModules

t_inputrec no longer depends on IInputRecExtension fields being
initialized, so it is not necessary to initialize it in gmx::MDModules.
Now t_inputrec can again be initialized without gmx::MDModules,
clarifying responsibilities.

For now, this again removes the need to use gmx::MDModules for just
reading t_inputrec.  These locations may need further changes as
responsibilities move around more, but in any case, t_inputrec ownership
should be better somewhere else than in MDModules.

Add constructor and destructor to t_inputrec to make it easier to manage
its instances.  Disallow copying (since that is tricky to implement
correctly), and do a manual only-what-is-required copy in PME
reinitialization, which is the only place that relied on copying

Change-Id: I52e0a17b13a0b7dad886fdf1b7d09bcbfcf961aa

7 years agoRemove module references from t_inputrec
Teemu Murtola [Sun, 26 Feb 2017 07:12:26 +0000 (09:12 +0200)]
Remove module references from t_inputrec

Do not use t_inputrec to pass around pointers to the electric field
module, reducing it back to a value-like data structure.

For now, use gmx::MDModules to do this.  This introduces an
mdlib <-> mdrunutility cyclic dependency, which is suppressed for now.
Further refactoring will again get rid of this after some futher work on
the module structure, but left it here to keep the changes smaller.

Change-Id: I05a8c8b7673e9827a1ec5ee5f48a8738026e3faf

7 years agoFix for an incorrect check that nstlog !=0
Michael Shirts [Wed, 22 Feb 2017 03:28:20 +0000 (20:28 -0700)]
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

7 years agoFix compile of GMX_SIMD=None with ICC
Roland Schulz [Thu, 23 Feb 2017 07:13:24 +0000 (23:13 -0800)]
Fix compile of GMX_SIMD=None with ICC

ICC defines invsqrt in math.h

Change-Id: Ic7107189cb5fb422192f986ebed53f2c2993ff35

7 years agoRemove unused function cu_synchstream_atdat()
Aleksei Iupinov [Tue, 21 Feb 2017 15:31:54 +0000 (16:31 +0100)]
Remove unused function cu_synchstream_atdat()

Change-Id: I363010ca73a9d0e3e1ebb13cf20a42fa834fb573

7 years agoAdd tests for old gmx energy functionality
Mark Abraham [Thu, 19 Jan 2017 20:58:23 +0000 (21:58 +0100)]
Add tests for old gmx energy functionality

Imported the edr and tpr files from the proposed new energyanalysis
tests so that we can observe that the old and new code are materially
the same, so we have a more stable change process for the large amount
of new code.

Extended gmx energy temporarily so that Einstein viscosity output
files are not hard coded (otherwise writing them in tests spams
output files).

Memory leak in inputrec.cpp was fixed (that only was detected
due to the dhdl test). A number of memory leaks in gmx_energy
were fixed as well.

Change-Id: I374b04bb20bb99df344b5b60a315b82c8c28828d

7 years agoUse gmx::Mutex and gmx::lock_guard to fix some issues
Mark Abraham [Tue, 14 Feb 2017 23:37:33 +0000 (00:37 +0100)]
Use gmx::Mutex and gmx::lock_guard to fix some issues

Refactored a few uses of raw thread-MPI mutexes to fix known leaks, so
valgrind and LeakSanitizer become more useful.

Discovered that the thread-MPI trylock behaviour has always been buggy
on Windows, and cannot be fixed so that the return code is consistent
across the two current implementations in the case where the calling
thread might already own the lock. Fortunately, we don't use trylocks
anywhere, and the problematic case is unlikely to occur, but the
limitation is now documented.

Added unit tests for whichever mutex implementation we are using, now
and in the future. These cover the above case.

Found bugs in _where, which presumably wasn't an issue if it only
ran when handling errors. But it runs multiple times per MD step.

Refs #2122
Refs #2123

Change-Id: If1b2f092c569f47d67ce39e6decb56f04cea314a

7 years agoMerge branch release-5-1 into release-2016
Mark Abraham [Wed, 15 Feb 2017 02:46:23 +0000 (03:46 +0100)]
Merge branch release-5-1 into release-2016

There's an awkward clash with a bug fix from release-5-1 from
subsequent cleanup in release-2016 while it was still
master. Fortunately, the code path for bExchanged only happens when
!bTrotter, and all the other code paths require bTrotter (which has
several sub cases), so those two groups of code commute. (And the
implementation of checking what the inputrec requires has changed
between branches only in name.)

Change-Id: I2382dad5c484452d023524884c025e77c2a624c4

7 years agoFix handling of previous virials
Mark Abraham [Thu, 9 Feb 2017 16:58:59 +0000 (17:58 +0100)]
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

7 years agoReduce compilation coupling
Mark Abraham [Tue, 14 Feb 2017 16:22:31 +0000 (17:22 +0100)]
Reduce compilation coupling

Only tree reduction uses CPU-side atomic operations, so we can stop
e.g. all the Verlet-scheme kernels including details of the thread-MPI
implementation.

Change-Id: If7c6c9c1c9b17230901bece81322a0587a50d160

7 years agoCorrected output of gmx do_dssp -sc
Mark Abraham [Fri, 10 Feb 2017 13:19:31 +0000 (14:19 +0100)]
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

7 years agoRemove duplicate AVX512 gather definitions
Roland Schulz [Thu, 9 Feb 2017 01:52:08 +0000 (17:52 -0800)]
Remove duplicate AVX512 gather definitions

Better code reuse by having all gather functions call the same
function. Also more consistent optimization of align
multiplication.

Change-Id: I446bee828655be9010919456215041a35eb36efb

7 years agoCheck log output in thread affinity tests
Teemu Murtola [Fri, 3 Jun 2016 03:31:22 +0000 (06:31 +0300)]
Check log output in thread affinity tests

Use the ability to redirect the logging to actually check that the
correct warnings get produced for the tests.  For now, most expected
texts are partially duplicated in each test that produces them, but
these can be centralized if it becomes a problem.

All regular output from thread affinity setting now goes through mdlog,
except for one to stderr.

Change-Id: I603e838693b6593d116fb2597eda7f1bf97c9454

7 years agoMulti-rank thread affinity tests
Teemu Murtola [Sun, 15 May 2016 07:23:14 +0000 (10:23 +0300)]
Multi-rank thread affinity tests

Add tests for setting the thread affinity on multiple MPI ranks,
including various heterogeneous run setups where thread affinity setting
fails only on a subset of the nodes.

Allow simulating multi-node environments, including heterogeneous nodes,
with both MPI flavors.

Change-Id: I69628d8e3d8f2d87cd40f8393da4b251ce1cba94

7 years agoComplete the removal of stateful RNG
Mark Abraham [Tue, 20 Dec 2016 11:25:19 +0000 (22:25 +1100)]
Complete the removal of stateful RNG

Only checkpoint files from several version ago can contain these
fields, and reading checkpoint files written with different major
versions is already unsupported. The enumerations should not change
because the numerical values in supported files should remain the
same.

Changed the enum values and matching strings to make this
situation explicit when reading the code.

Change-Id: I93d57ee3791202c33c2312c4b5d8927b5d7ad351

7 years agoImproved state_change_natoms and used it more
Mark Abraham [Tue, 20 Dec 2016 10:26:56 +0000 (21:26 +1100)]
Improved state_change_natoms and used it more

If the t_state control flags indicate that per-atom arrays will be
used, resize them appropriately whenever this routine is called.

CG minimization and non-DD simulations take care of organizing their
own state flags and allocations, rather than relying on code located
elsewhere. Non-DD used to rely on the allocation of x made when
reading the tpr, and perhaps one for v made in set_state_entries (if
not read from the tpr), and one for f made in do_md or init_em.

Commented more widely about why allocations for force arrays are
of size natoms+1.

Change-Id: I803c2695969f78616016520cdd8e9425507ab7c1

7 years agoWork around false xlc-13.1.5 bug in SIMD test
Erik Lindahl [Thu, 9 Feb 2017 14:45:51 +0000 (15:45 +0100)]
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

7 years agoRemove EST_DISTR from state.h
Mark Abraham [Wed, 21 Dec 2016 00:01:16 +0000 (11:01 +1100)]
Remove EST_DISTR from state.h

This was only used in DD code, and now that there are fewer per-atom
state arrays, its definition and use led to more complicated and
slower code than needed.

Refactored so that we operate directly on the only state entries that
redistribute with DD.

Localized some iteration variables while I was there.

Change-Id: I56d4d15e1c1877908c513838c3e3825a4c8a467f

7 years agoEnhance warninp
Mark Abraham [Thu, 29 Dec 2016 13:55:18 +0000 (13:55 +0000)]
Enhance warninp

Permit the counts of warnings of different types to be reset, which
may prove useful in testing.

Provides overloads that accept messages as std::string.

Change-Id: I25d94e3169352deb941ed73d096cc75deb6b57e2

7 years agoAdd initialization to dvdlambda in bonded forces tests
Aleksei Iupinov [Thu, 9 Feb 2017 12:39:44 +0000 (13:39 +0100)]
Add initialization to dvdlambda in bonded forces tests

Should fix #2093.

Change-Id: I7c99200443bd13c26757615d3101da1c52c8859d

7 years agoDocument key-value tree transforms and improve checks
Teemu Murtola [Fri, 11 Nov 2016 19:02:19 +0000 (21:02 +0200)]
Document key-value tree transforms and improve checks

Add assertions to provide better messages in case of unintended usage,
and document the interface used to specify rules.  This should cover all
of the key-value tree code that is currently exposed for mdp input
handling through IInputRecExtension, with the exception of
KeyValueTreeObjectBuilder that is exposed if one uses toObject().

Change-Id: Ic36a2c41ba418abfa46cc9b37d6cd7eed5a896b6

7 years agoFix typo (Dihedarl -> Dihedral)
Aleksei Iupinov [Thu, 9 Feb 2017 10:46:57 +0000 (11:46 +0100)]
Fix typo (Dihedarl -> Dihedral)

Change-Id: I35a17a488bcc354c0bd4bfa9b8ee7f84e8dfb786

7 years agoOverview documentation for new mdp input scheme
Teemu Murtola [Sun, 30 Oct 2016 13:12:07 +0000 (15:12 +0200)]
Overview documentation for new mdp input scheme

Change-Id: I22368dd9cf19bf43a942dde98b6d30ff6be6d605

7 years agoExtend serialization to gmx_int64_t
Mark Abraham [Sun, 1 Jan 2017 19:12:55 +0000 (19:12 +0000)]
Extend serialization to gmx_int64_t

Change-Id: Ib48b89d3f6e75e47ab6462c4505227e3f14913a5

7 years agoGeneric KeyValueTree broadcast
Teemu Murtola [Sun, 23 Oct 2016 07:14:42 +0000 (10:14 +0300)]
Generic KeyValueTree broadcast

Broadcast the KeyValueTree as part of inputrec, instead of having
special code in each module and a method in IInputRecExtension for this
purpose.  Now the only thing the electric field code needs to do for mdp
input/inputrec is to declare the options it accepts (and how they map
from mdp options).

Change-Id: Ia40120d4dd887c533cb6fcb60535852436dbd781

7 years agoGeneric gmx check implementation with KeyValueTree
Teemu Murtola [Sun, 23 Oct 2016 04:31:43 +0000 (07:31 +0300)]
Generic gmx check implementation with KeyValueTree

Implement gmx check as a generic comparison of KeyValueTree objects,
instead of calling IInputRecExtension.  This removes all special code in
the modules needed to support gmx check.

Only bare minimum comparison functionality is implemented for now to
support the cases that are possible with the electric field module.

Change-Id: I2b9a025c61022919f1c6730b9523983416d08364

7 years agoGeneric gmx dump implementation for KeyValueTree
Teemu Murtola [Sat, 22 Oct 2016 03:45:48 +0000 (06:45 +0300)]
Generic gmx dump implementation for KeyValueTree

Instead of calling IInputRecExtension, make gmx dump directly write out
the KeyValueTree structure.  This removes the need for any special code
in the modules to support gmx dump.

This does not work with the mdp output from gmx dump, but neither did
the old code.  This should be relatively easy to put back once we have a
structured mdp format.

Change-Id: Ie1420ce6e1ae14e73da1be09ce48faf1b5ed9daf

7 years agoAVX512: Use double-sized gather for pairs of floats
Roland Schulz [Tue, 7 Feb 2017 19:14:13 +0000 (11:14 -0800)]
AVX512: Use double-sized gather for pairs of floats

Also remove unnecessary cast and multiplication

Change-Id: Idb3ccadf5b6c39e2fd0b84c223e29510df2ed543

7 years agoRemove docs for unimplemented trjconv -clustercenter
Mark Abraham [Wed, 8 Feb 2017 09:52:29 +0000 (10:52 +0100)]
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

7 years agoMerge "Merge branch release-2016"
Gerrit Code Review [Wed, 8 Feb 2017 17:09:33 +0000 (18:09 +0100)]
Merge "Merge branch release-2016"

7 years agoGeneric tpr handling for electric field
Teemu Murtola [Tue, 11 Oct 2016 19:30:47 +0000 (22:30 +0300)]
Generic tpr handling for electric field

Remove special code to store inputrec values to tpr files from
IInputRecExtension, and instead store them as a generic KeyValueTree.

Currently, there is no support for changing the storage format, other
than by adding new options. We may not need this immediately, and we
think it should not be any extra work to introduce it later (rather
than right now). With the present approach, tpr backwards
compatibility is essentially the same as mdp backwards compatibility.

There are now two paths to setting up modules for use, depending
whether the data is coming from mdp parsing in e.g. grompp or tests,
or from tpr parsing in e.g. mdrun, dump or check (but not tpbconv).

Change-Id: I0a0f552041b2a7401bc82972c9648d1f3a64af34

7 years agoCreate applied-forces module group
Mark Abraham [Mon, 30 Jan 2017 16:20:23 +0000 (17:20 +0100)]
Create applied-forces module group

Some more formal grouping should emerge later on, but for now the
responsibilities are handled close to where they should be handled.

Change-Id: Ic8de97eccb0311f94e8e1818ca9b5368a05729b4

7 years agoPME force gathering tests
Aleksei Iupinov [Thu, 29 Dec 2016 23:21:59 +0000 (00:21 +0100)]
PME force gathering tests

Unit tests for PME force gathering on CPU.
Test 2 grid sizes, PME orders from 3 to 5, normal and triclinic boxes,
configurations of 1, 2 and 13 atoms, with and without input forces reduction.
Forces gathered from the grid are tested as outputs.

Change-Id: I1b624e0019f2c8401084db5af4dab7c0efc932fb