alexxy/gromacs.git
4 years agoChange PaddedVector to PaddedHostVector for force CPU buffer
Artem Zhmurov [Mon, 9 Sep 2019 16:44:38 +0000 (18:44 +0200)]
Change PaddedVector to PaddedHostVector for force CPU buffer

The difference between PaddedVector and PaddedHostVector is that
in the builds where CUDA is available, cudaMalloc is used instead
of malloc. This enables one to pin the vector for asynchronous
H2D and D2H copies. Other than that and on the CPU-only builds this
change essentially only renames the data type.

Change-Id: I446ef037a8013f666a78762d37ed44e59f9548c2

4 years agoAdd release note for density fitting.
Christian Blau [Thu, 12 Sep 2019 13:15:12 +0000 (15:15 +0200)]
Add release note for density fitting.

Adds a release note that density-guided simulations are now available.

refs #2282

Change-Id: I2ae6896ba32cadfb2029a5c923db6fd76ddbf620

4 years agoAdjust test range and fix singleaccuracy tests
Erik Lindahl [Thu, 12 Sep 2019 11:20:52 +0000 (13:20 +0200)]
Adjust test range and fix singleaccuracy tests

This changes the limit of exp() tests by one ulp
to account for rounding that leads to tests failing
for a single value when the CPU uses different
denormals-to-zero modes for SIMD and non-SIMD (ARMv7).

It also fixes the singleaccuracy tests to
check the correct functions for log2/exp2/pow2/cbrt
instead of the double-precision flavors, and the
implementation of powSingleAccuracy has been
copied from the (faster) single precision type
instead of just calling the double precision version.

Change-Id: I67d027cb916c4f78f36719f9ff554e9957879763

4 years agoUpdate modular simulator tests
Pascal Merz [Thu, 12 Sep 2019 00:40:59 +0000 (18:40 -0600)]
Update modular simulator tests

This addresses a number of issues with the modular simulator tests:

1.  Relaxes the tolerance for energy tests slightly
2.  Switches the pressure test from ULP-based tolerance to relative
    tolerance
2a. Introduce relativeToleranceAsPrecisionDependentFloatingPoint()
    to define relative tolerances depending on floating point
    precision
3.  Relax the tolerance for velocity testing, allowing to remove the
    second version of the velocity propagator (differing from the
    first version only by the operation order)
3a. Introduce TrajectoryComparison argument to the simulator
    comparison test class, adapt rerun and simulator tests accordingly

Change-Id: I30fffcabf8d6e658dab6f71b407fbe162121df2e

4 years agoFix master not compiling
Berk Hess [Thu, 12 Sep 2019 10:03:49 +0000 (12:03 +0200)]
Fix master not compiling

A fast-forward merge broke compilation of tpi.cpp.

Change-Id: I067042a6e02b272e7503ae3f876418dc0a114b91

4 years agoEnable TPI with the Verlet cut-off scheme
Berk Hess [Tue, 10 Sep 2019 09:01:19 +0000 (11:01 +0200)]
Enable TPI with the Verlet cut-off scheme

This requires a special treatment for the nbnxm gridding and search,
with one grid for the system to insert in and one grid for
the molecule to insert.
Also reenabled the TPI tests.

Change-Id: Ia3888daf4b06a94b0a7a03ec17b7bbe27084ac3d

4 years agoAdded SIMD cbrt and invcbrt functions
Erik Lindahl [Wed, 11 Sep 2019 12:36:00 +0000 (14:36 +0200)]
Added SIMD cbrt and invcbrt functions

To be used in free energy kernels.

Change-Id: I074e27f7b050b37f273dbf703ff915c9c20e8c97

4 years agoAdded SIMD log2 and pow math functions
Erik Lindahl [Wed, 4 Sep 2019 23:29:44 +0000 (17:29 -0600)]
Added SIMD log2 and pow math functions

To be used in SIMD free energy kernels

Change-Id: I3c05dcc01ec56ed790cfedc543a75c17468ca284

4 years agoUpdate SIMD math tests and improve accuracy
Erik Lindahl [Sun, 1 Sep 2019 12:28:36 +0000 (14:28 +0200)]
Update SIMD math tests and improve accuracy

Improve the SIMD math function test by selecting
points to be equidistant in IEEE754 bit-space, and
specify test ranges by explcitly constructing the
threshold points used to select ranges.

This significantly extends the ranges over which
some functions are tested, and could lead to some
failed tests that were previously hidden, although they
are likely benign. With these tests, errors were found
in a few of the double-precision functions where 1/x
was evaluated for intermediate values smaller than the
lowest-magnitude single precision number, which have
now been fixed with additional masking.

Second, a fragile construct when evaluating exp() in
single precision without FMA support has been replaced
to improve precision when very small intermediate values
were flushed to zero by the intel compiler, in particular
icc19.

Change-Id: I3e4b1e5799f748b02f592398df762e1e318887e6

4 years agoMake gmx_multisim_t a C++ object
Mark Abraham [Wed, 11 Sep 2019 05:14:15 +0000 (07:14 +0200)]
Make gmx_multisim_t a C++ object

Change-Id: I1fe46090cdda44db5b5e7cc1198c6f679f7bd5a7

4 years agoRemove -sub option from trjconv
Paul Bauer [Wed, 11 Sep 2019 08:55:28 +0000 (10:55 +0200)]
Remove -sub option from trjconv

This functionality is now in gmx extract-cluster.

Change-Id: I5c74ce346f2e422f1b494663f0eb3206083c05be

4 years agoFix for the post-submit failure
Artem Zhmurov [Wed, 11 Sep 2019 18:55:25 +0000 (20:55 +0200)]
Fix for the post-submit failure

Commit 21abdb3 introduced several "unused variable" warning
in the post-submit matrix. This fixes the issue.

Change-Id: I8ba6ad16573dd7d8ca06fdd957882b4dc8486396

4 years agoDecouple GPU force buffer management from buffer ops in NBNXM
Artem Zhmurov [Wed, 11 Sep 2019 12:19:31 +0000 (14:19 +0200)]
Decouple GPU force buffer management from buffer ops in NBNXM

When GPU-side buffer operations are used, the total forces on the
device are accumulated in NBNXM module in the local GPU buffer.
By decoupling the CPU and GPU buffer operations and making the
force buffer into an argument for the reduction function, this
commit allows to take the responsibility of the GPU forces
management from the NBNXM module to the third-party instance.

This commit is refactoring of the code in preparation for the
introduction of the GPU-side PropagatorStateData object.

TODO: Use DeviceBuffer when passing the PME GPU forces buffer.

Refs. #2816

Change-Id: I2a1f9d12fad3fb5b2ce37ca3ed3d0cb91777c468

4 years agoAdd missing gmxapi requirements
Paul Bauer [Wed, 11 Sep 2019 09:35:56 +0000 (11:35 +0200)]
Add missing gmxapi requirements

Those where missing while trying to use the package. Please advise on
recommended minimum version numbers.

Change-Id: I65f4bf7b6892a74667b1fa2c641b7b97be923656

4 years agoUse GROMACS CMake toolchain file for gmxapi Python package build.
M. Eric Irrgang [Tue, 10 Sep 2019 18:15:51 +0000 (21:15 +0300)]
Use GROMACS CMake toolchain file for gmxapi Python package build.

Refs #2961

Change-Id: If085425879f00a8a8573627dbec197afa39c2ab0

4 years agoBasic toolchain to facilitate GMXAPI build
Paul Bauer [Thu, 5 Sep 2019 12:28:11 +0000 (14:28 +0200)]
Basic toolchain to facilitate GMXAPI build

Adds a basic toolchain file and install directives for it.
This is aimed at having one point for the API to look up how
a native GROMACS installation was build and allow the bindings for the
API to be build in the same way.

Added hint for directory to GMXRC so that it will be easier to find.

Refs #2961

Change-Id: Icefe89e97009110be55dc8e1f3db5726ec1fe53a

4 years agoDecouple coordinates buffer management from buffer ops in NBNXM
Artem Zhmurov [Tue, 10 Sep 2019 20:52:37 +0000 (22:52 +0200)]
Decouple coordinates buffer management from buffer ops in NBNXM

To make transition to the new device-side state propagator data
manager easier, the copy and plain buffers management have to be
decoupled from the actual operations on data in the buffers.
This commit splits the corresponding functions into two, and
decouples CPU- and GPU-based coordinate buffer ops one from
another. Since the coordinates are now clearly communicated
between PME and NBNXM, the plain pointer on the CPU-side code is
replaced with the DeviceBuffer<float>. The getters for the device-
side buffer now never return nullptr, but exit with the assertion
if the corresponding data is not intialized.

Change-Id: Ic793f815870a8b4f414a9b7ca0a5001e58f49c7a

4 years agoReorganize PME code:
Artem Zhmurov [Tue, 10 Sep 2019 11:42:06 +0000 (13:42 +0200)]
Reorganize PME code:

1. Split H2D copy and spread launch
2. Add getter for the padding, required in coordinates buffer
3. Add the getter for the GPU stream

TODO: Make use of DeviceBuffer

This is a part of preparation for the GPU version of the
StatePropagatorData, needed to connect all GPU routines.

Refs. #2816.

Change-Id: Icf0d621ce931f8fa66e948b5240afbddef7bfb0d

4 years agoAdd gmxapi.modify_input operation.
M. Eric Irrgang [Mon, 9 Sep 2019 16:29:06 +0000 (19:29 +0300)]
Add gmxapi.modify_input operation.

modify_input can consume and produce simulation input data in the
manner of gmxapi.simulation module operations.

Change-Id: I2639022801b5c72a8fad9fb68f1990c87444cbca

4 years agoProvide a gmxapi.read_tpr operation.
M. Eric Irrgang [Mon, 9 Sep 2019 15:17:34 +0000 (18:17 +0300)]
Provide a gmxapi.read_tpr operation.

Convert a simulation input file to a data flow stream that can be
consumed by other operations in gmxapi.simulation in a standard way.

Change-Id: Ic6339317956f248712a3038eab583fbca517ba16

4 years agoUpdate gmxapi.simulation.context details.
M. Eric Irrgang [Mon, 9 Sep 2019 14:44:33 +0000 (17:44 +0300)]
Update gmxapi.simulation.context details.

Combine and improve the implementation detail from gmxapi 0.0.7 handling
of trivial ensembles (single-trajectory).

This simplifies the 0.1 implementation of gmxapi.mdrun as a dispatcher
to the gmxapi 0.0.7 implementation.

Change-Id: I17fe722ee7509e8bc402c6d5848d01a2c04b18fd

4 years agoAllow gmxapi.mdrun to properly dispatch simulation ensembles.
M. Eric Irrgang [Mon, 9 Sep 2019 15:08:52 +0000 (18:08 +0300)]
Allow gmxapi.mdrun to properly dispatch simulation ensembles.

Update the gmxapi.simulation.mdrun implementation to be more normative.
Dispatch the simulation work to the gmxapi 0.0.7 implementation in
gmxapi.simulation.workflow and gmxapi.simulation.context.

Change-Id: Id223507fc064e178992bc87d6fcf89bdd4029523

4 years agoAdd comments to grompp generated .mdp output for densityfitting
Christian Blau [Mon, 9 Sep 2019 15:45:53 +0000 (17:45 +0200)]
Add comments to grompp generated .mdp output for densityfitting

Adds additional explanatory comments to the grompp generated mdout.mdp
file for densityfitting.

refs #2282

Change-Id: I496cccced2cc87cb2434f877c0caf04cb29c1903

4 years agoUpdate gmxapi Python package infrastructure for new operations.
M. Eric Irrgang [Mon, 9 Sep 2019 14:38:00 +0000 (17:38 +0300)]
Update gmxapi Python package infrastructure for new operations.

* Improve support for stand-alone operation implementations.
* Create a registry of operation implementations for use by the
  gmxapi.operation module Contexts.
* Flesh out the data model and add more modularity to the execution
  model.
* Clean up various output.

Change-Id: Id63c7883e3ed7e4d0172a7a18672b950afc4c25d

4 years agoNormalize some testing resources for the Python packages.
M. Eric Irrgang [Thu, 5 Sep 2019 12:05:16 +0000 (15:05 +0300)]
Normalize some testing resources for the Python packages.

* Add a gmxapi.testsupport submodule.
  Move the pytesthelpers.py test support module to the new
  gmxapi.testsupport module.
* Remove unused details in sample_restraint/tests. mpi4py was imported
  unnecessarily, and some directories created, but that was left over
  from older versions of the test.
* Remove pytest.ini for gmxapi Python package tests.
  These values can be set on the command line, and having them in the
  pytest.ini adds developer overhead when trying to determine default
  behavior or get custom behavior. In the future, consider per-test
  configuration through the caplog pytest fixture, or various command
  line options.

gmxapi and sample_restraint Python packages can now use essentially
identical pytest testing framework. This change synchronizes the
testing frameworks. Future changes can combine some of the facilities
for simplification and ease of maintenance.

Future changes could address the following.
* Move some pytest scripting to gmxapi package resources.
* Combine the Python and C++ resources for the test input file in
  sample_restraint.
* Retrieve test data directly from the GROMACS installation.
* gmxapi.testsupport could alternatively be a separate optional package.
* More facilities can be provided, such as the test input file.

Change-Id: Ia745c75aecd97e3a8fc3053b424aa40d4c89de32

4 years agoEnd to end test for density fitting
Christian Blau [Wed, 11 Sep 2019 06:49:48 +0000 (08:49 +0200)]
End to end test for density fitting

Implement an end to end test for the density fitting module.

refs #2282

Change-Id: Ic94013cae6820ccf6fa7415887b280daff25d83c

4 years agoDensityfitting write int64_t indices instead of gmx::index
Christian Blau [Wed, 11 Sep 2019 06:50:42 +0000 (08:50 +0200)]
Densityfitting write int64_t indices instead of gmx::index

When serializing atom indices to a key-value-tree that is subsequently
written to file, the type of the indices needs to be independent of
gmx::index (aka ptrdiff_t) type definition.

This patch introduces this behaviour.

refs #2282

Change-Id: I1384158204354e2267674c266f91c133a01bc5f7

4 years agoFix multi-sim restart handling in corner cases
Mark Abraham [Tue, 10 Sep 2019 12:02:06 +0000 (14:02 +0200)]
Fix multi-sim restart handling in corner cases

If different simulations would have different starting behaviour,
e.g. some checkpoint files are found and some are not, then we should
not allow a restart, and do so with a useful error message.

Refs #2375

Change-Id: I8845784e8310ab6ca81db189e4a42754add03def

4 years agoDisable false positive warning in ICC and MSVC
Paul Bauer [Tue, 10 Sep 2019 13:09:15 +0000 (15:09 +0200)]
Disable false positive warning in ICC and MSVC

Post submit was warning about constant selector expression in the
modularsimulator code when building with ICC. The warning
looked like a false positive so I added the flag to exclude it for ICC
both in native mode and with MSVC.

Change-Id: Ic0a9f2935b07d72d46940d0d5a165eb1b417a1ad

4 years agoTidy up the FE kernel
Magnus Lundborg [Thu, 5 Sep 2019 15:09:30 +0000 (17:09 +0200)]
Tidy up the FE kernel

Mainly moving variable declaration to where they are used and
making them const where appropriate.

Change-Id: I006092c39d40d0e4124cd443a16fa814e896ce93

4 years agoFix gpucomm matrix
Szilárd Páll [Wed, 11 Sep 2019 00:06:13 +0000 (02:06 +0200)]
Fix gpucomm matrix

While switching a config to thread-MPI, the "mpi" tag as not been
removed which took precedence rendering commti 3820ad ineffective.

Change-Id: I0a6f79d24dda157e15d2e26bba3e3fca4e16d60d

4 years agoAvoid warning in no-mpi build
Mark Abraham [Tue, 10 Sep 2019 13:16:47 +0000 (15:16 +0200)]
Avoid warning in no-mpi build

clang 8 with no MPI warns about this.

Change-Id: I65afd07d3d6dacbf67c309e5a62f0720efd66485

4 years agoMaking DeviceBuffer availible in non-GPU builds
Artem Zhmurov [Tue, 10 Sep 2019 11:12:09 +0000 (13:12 +0200)]
Making DeviceBuffer availible in non-GPU builds

Having DeviceBuffer availible in host-side code in all builds
allows to avoid passing the void-pointers for the device-side
buffers.

This is a part of preparation for the GPU version of the
StatePropagatorData, needed to connect all GPU routines.

Refs. #2816.

Change-Id: I174754de72999ff5299b3ddb8c8a0d05494f7f4c

4 years agoAdd indication on how to enable ImageMagick convert
Paul Bauer [Tue, 10 Sep 2019 14:33:43 +0000 (16:33 +0200)]
Add indication on how to enable ImageMagick convert

Change-Id: Ief6136f1218b11fdf28ce3c3028e8d6dbdf11913

4 years agoFix nightly build
Paul Bauer [Tue, 10 Sep 2019 08:28:30 +0000 (10:28 +0200)]
Fix nightly build

Fixes the clang-tidy error in the OpenCL build and disables the listed
forces tests when compiling with intel to avoid the test failures only
showing up there.

Refs #3083

Change-Id: Ie8d437b00cb9376d9eb7f8ac2d3402dee2152948

4 years agoAdd method to extract clusters from trajectory
Paul Bauer [Tue, 16 Apr 2019 10:01:25 +0000 (12:01 +0200)]
Add method to extract clusters from trajectory

Ported the -sub functionality of gmx trjconv to independent method based
on the new output manager functionality.

Added simple test to show that the routine can run.

Change-Id: I33bc056f8c44b795728ae15218a9211652b40772

4 years agoFix parameter key look-up in gmxapi TPR reader.
M. Eric Irrgang [Tue, 10 Sep 2019 12:07:59 +0000 (15:07 +0300)]
Fix parameter key look-up in gmxapi TPR reader.

A copy-paste error caused one member to be initialized twice and another
to be uninitialized.

Also, rename an inappropriate overload to indicate what it really does.

Change-Id: I35790e6de868303bd398aa21619841c8c5844e4e

4 years agoMake gmxcli pytest fixture more robust.
M. Eric Irrgang [Mon, 9 Sep 2019 13:23:04 +0000 (16:23 +0300)]
Make gmxcli pytest fixture more robust.

Look for multiple possible `gmx` command line executables.

This change may be followed up, amended, replaced, or superseded by
change Icefe89e97009110be55dc8e1f3db5726ec1fe53a but is necessary
now to support child changes under review.

Refs #2961

Change-Id: I7d9d830c1b16fbd2af86aded3f1fea5f3a63307f

4 years agoMore templating of gmx_nb_free_energy_kernel()
Magnus Lundborg [Tue, 27 Aug 2019 07:40:59 +0000 (09:40 +0200)]
More templating of gmx_nb_free_energy_kernel()

Kernel templated on interaction types.

Refs #2997.

Change-Id: Id02a6daab817705bdaca2ef610b793f1ddab6829

4 years agoEliminate raw force flags in do_force_lowlevel()
Szilárd Páll [Tue, 3 Sep 2019 10:20:28 +0000 (12:20 +0200)]
Eliminate raw force flags in do_force_lowlevel()

Change-Id: I4c54810a9130aaad0514738cc1026bc2d9f2fe5e

4 years agoUse more RAII semantics with t_commrec
Mark Abraham [Mon, 9 Sep 2019 15:06:41 +0000 (17:06 +0200)]
Use more RAII semantics with t_commrec

This permitted simplifying building the Mdrunner

Fixes #3081

Change-Id: I4ac5fb2017d960d3d0cfd0103e1d7232da9f1c3a

4 years agoUse the current mass instead of massA in density fitting code.
Christian Blau [Tue, 10 Sep 2019 09:35:10 +0000 (11:35 +0200)]
Use the current mass instead of massA in density fitting code.

When using masses to determine the weights of the spread amplitudes,
massA instead of the correct massT was used. This commit fixes this
behavior.

refs #2282

Change-Id: I58deb14b4b45c122ab3c9caf3f6b76c89f9ae739

4 years agoAccount for reference density origin shift in pbc correction
Christian Blau [Mon, 9 Sep 2019 13:41:48 +0000 (15:41 +0200)]
Account for reference density origin shift in pbc correction

When the refernce density is shifted from the origin, this shift has to
be added to the reference density center. This patch fixes incorrect pbc
correction behaviour, due to not taking this shift into account.

refs #2282

Change-Id: I953f717ecf6ab53985a59195eab896d50965039e

4 years agoUse thread-MPI in the gpucomm matrix
Szilárd Páll [Fri, 6 Sep 2019 21:54:52 +0000 (23:54 +0200)]
Use thread-MPI in the gpucomm matrix

Initial versions of the direct communication do not support MPI and do
not implement graceful fallback to staged communication. Until they do
so we need to avoid library MPI in these matrices.

Change-Id: Ie7ab579f6058831229596fd6ba09a185d3a0685f

4 years agoCompositeSimulatorElement for the modular simulator
Pascal Merz [Tue, 9 Jul 2019 04:35:48 +0000 (22:35 -0600)]
CompositeSimulatorElement for the modular simulator

This element allows to have a list of elements act as a single one.
This will simplify building algorithms.

This commit is part of the commit chain introducing the new modular
simulator. Please see docs/doxygen/lib/modularsimulator.md for details
on the chosen approach. As the elements of the new simulator cannot all
be introduced in one commit, it might be worth to view Iaae1e205 to see
a working prototype of the approach.

Change-Id: If2153923dd9421288ad57337c7255000bb7c1d91

4 years agoCoordinate Propagators
Pascal Merz [Tue, 9 Jul 2019 04:34:25 +0000 (22:34 -0600)]
Coordinate Propagators

This change introduces the propagator element, which, thanks to templating,
can cover the different propagation types used in NVE MD. The combination
of templating, static functions, and having only the inner-most operations in
the static functions allows to have performance comparable to fused update
elements while keeping easily reordable single instructions.

Note that the two velocity update functions are only necessary to allow
exact replication of the legacy do_md code for both md and md-vv. The
parentheses or the lack thereof lead to numerical errors which build up very
rapidly to make the (very strict) integrator comparison test fail. Relaxing this
condition will make getting rid of one of the two variants possible.

An interesting further development would be to unify the OpenMP loops for
coordinate propagation and constraining by using loops over constraint
groups in both cases.

Change-Id: I1a1f66f1efe63c791ef3fe51ce2f99da3367adca

4 years agoStatePropagatorData: Introduced const box accessor and fixed legacy flags
Pascal Merz [Sat, 7 Sep 2019 05:48:16 +0000 (23:48 -0600)]
StatePropagatorData: Introduced const box accessor and fixed legacy flags

Two improvements for the StatePropagatorData:

The current implementation only gave access to the non-const box
matrix. This introduces a const version of it, and changes the elements
using the simulation box to use the const version where appropriate.

The current implementation also kept using the legacy flags it got
from the global_state in all further usages. This is not correct -
when StatePropagatorData creates a deep copy as a t_state object, it
only populates certain fields. This commit fixes this.

Change-Id: I783491d9f8a0825b169880b7ab8ef7e677623d50

4 years agoAdd trivial const qualifiers to shellfc and EnergyOutput
Pascal Merz [Sat, 7 Sep 2019 05:40:31 +0000 (23:40 -0600)]
Add trivial const qualifiers to shellfc and EnergyOutput

Change-Id: I2ce3ef7c777aa6f7b93706553c44545fc5962b4f

4 years agoConstraint element for the modular simulator
Pascal Merz [Tue, 9 Jul 2019 04:33:10 +0000 (22:33 -0600)]
Constraint element for the modular simulator

This change introduces a constraint element, which is implemented for the
position-and-velocity and the velocity-only case. This change does not change
the constraint implementation itself, but replaces the `constrain_coordinates`
and `constrain_velocities` calls from update.h by elements implementing the
ISimulatorElement interface and using the new data management.

This commit is part of the commit chain introducing the new modular
simulator. Please see docs/doxygen/lib/modularsimulator.md for details
on the chosen approach. As the elements of the new simulator cannot all
be introduced in one commit, it might be worth to view Iaae1e205 to see
a working prototype of the approach.

Change-Id: Ie04b995fc34801967427825bb2842411a448a677

4 years agoAssert the types of OpenCL kernels arguments
Szilárd Páll [Mon, 9 Sep 2019 15:31:37 +0000 (17:31 +0200)]
Assert the types of OpenCL kernels arguments

Certain types are not allowed to be passed as kernel argument in OpenCL.
This change adds a static assert to the prepareGpuKernelArgument wrapper
to make sure that we do not accidentalyl pass such a type.

Change-Id: I748dccd1b8350a5b0c86d770f7fc3975112e1467

4 years agoPass gmx::ForceFlags to CPU nbnxm dispatch code
Szilárd Páll [Fri, 30 Aug 2019 14:01:21 +0000 (16:01 +0200)]
Pass gmx::ForceFlags to CPU nbnxm dispatch code

Also added one last missing flag, ForceFlags.computeDhdl.

Change-Id: Ibcfea7f3975685f2219c5a5e3c8e45c716be1789

4 years agoPass the new gmx::ForceFlags to the nbnxm module
Szilárd Páll [Fri, 30 Aug 2019 13:16:24 +0000 (15:16 +0200)]
Pass the new gmx::ForceFlags to the nbnxm module

- Changed in NB kernel dispatch
- NB GPU transfer launch and wait

Change-Id: Idd2738797ddcdd372e90cdfcc066b056a29d8de2

4 years agoRemove incorrect check with rf-zero
Berk Hess [Mon, 9 Sep 2019 14:39:36 +0000 (16:39 +0200)]
Remove incorrect check with rf-zero

Change-Id: Ia6ae62bc128c38470d42fd1ab919215ce13bc6ec

4 years agoDomain decomposition and PME load balancing for modular simulator
Pascal Merz [Tue, 9 Jul 2019 04:27:20 +0000 (22:27 -0600)]
Domain decomposition and PME load balancing for modular simulator

This change introduces two infrastructure elements responsible for
domain decomposition and PME load balancing, respectively. These
encapsulate function calls which are important for performance, but
outside the scope of this effort. They rely on legacy data structures
for the state (both) and the topology (domdec).

The elements do not implement the ISimulatorElement interface, as
the Simulator is calling them explicitly between task queue population
steps. This allows elements to receive the new topology before
deciding what functionality they need to run.

This commit is part of the commit chain introducing the new modular
simulator. Please see docs/doxygen/lib/modularsimulator.md for details
on the chosen approach. As the elements of the new simulator cannot all
be introduced in one commit, it might be worth to view Iaae1e205 to see
a working prototype of the approach.

Change-Id: I1be444270e79cf1391f5a228c8ce3a9934d92701

4 years agoRelative entropy as density similarity measure
Christian Blau [Thu, 5 Sep 2019 14:45:17 +0000 (16:45 +0200)]
Relative entropy as density similarity measure

Adds a new density similarity measure that uses the relative entropy of
two densities to compare them to one another. Also adds the gradient of
this measure.

refs #2282

Change-Id: I3be18ec3fad3c2551ce7c9fe896dc257d5789cdf

4 years agoAdd gmx convert-trj
Paul Bauer [Thu, 30 Aug 2018 13:40:16 +0000 (15:40 +0200)]
Add gmx convert-trj

Adds a new module gmx convert-trj, aimed at providing the minimal
functionality to convert different GROMACS supported trajectory formats
into each other, as well as supporting selections to chose atoms for
writing to disk.

The tool is based on the OutputManager and OutputAdapter framework for
writing new trajectory files and for setting meta information in the
coordinate datastructures.

Refs #2115, #2396

Change-Id: I1413721faa1383a9d3b8f14cdbea2bcc3089273f

4 years agoExtract Cartesian data from DDRankSetup
Berk Hess [Fri, 6 Sep 2019 08:45:02 +0000 (10:45 +0200)]
Extract Cartesian data from DDRankSetup

The data related to the Cartesian MPI communication setup is now
extracted from DDRankSetup to CartesianRankSetup.

This change is only refactoring.

Change-Id: Ifa05c6fecad7ad0e80d0b64ee7f0b1df5f65b327

4 years agoRename DDSetup to DDGridSetup
Berk Hess [Fri, 6 Sep 2019 12:00:07 +0000 (14:00 +0200)]
Rename DDSetup to DDGridSetup

Moved the definition of DDGridSetup and declarations for
omdec_setup.cpp to a new file called domdec_setup.h.
Also added documentation.

Change-Id: Ic14416e8acfa3b832ceff4bf529abdaf8ceb3728

4 years agoAdd option to normalize densities prior to density fitting
Christian Blau [Fri, 6 Sep 2019 11:55:24 +0000 (13:55 +0200)]
Add option to normalize densities prior to density fitting

Adds an mdp option that makes sure that the sum of voxel values
for both input densities is unity.

refs #2282

Change-Id: I9d3c63d7548bca72a083cdafa6818ded4fcdd400

4 years agoClean up PME rank variables
Berk Hess [Thu, 5 Sep 2019 19:29:47 +0000 (21:29 +0200)]
Clean up PME rank variables

Clarified the naming of several PME rank count variables and added
a boolean to DDRankSetup that tells whether we use separate PME ranks.
Fixes several misuses of npmenodes, all of which did not cause issues
in pratice.

Todo: Remove npmenodes from t_commrec.

Change-Id: I03b4547c975e3ffa354b53b35abcd91b4f3f6b26

4 years agoAdding every N-steps option to densityfitting
Christian Blau [Wed, 4 Sep 2019 13:26:19 +0000 (15:26 +0200)]
Adding every N-steps option to densityfitting

Adds an option to the density fitting module to apply forces only every
N steps.

refs #2282

Change-Id: I8d264734e1d9a82ff9717d270552e38a28b34729

4 years agoRefactor init_domain_decomposition()
Berk Hess [Thu, 5 Sep 2019 15:10:28 +0000 (17:10 +0200)]
Refactor init_domain_decomposition()

The creation of both the whole (Cartesian) communicator and the PP
and PME communicators is now extracted to separate functions.
The first part is done before initializing gmx_domdec_t, so the role
of nodes is know before gmx_domdec_t is created.

This change is only refactoring.

Change-Id: I6d02b8c3af55570353331fa05f998a7b6de79572

4 years agoMake pme_loadbal_do() independent of t_state
Pascal Merz [Fri, 6 Sep 2019 00:21:21 +0000 (18:21 -0600)]
Make pme_loadbal_do() independent of t_state

Similar to I28b58df4 and other recent patches, this changes
pme_loadbal_do() to take the const box and a const view of the
positions as input instead of the full t_state object. This makes
subsequent changes to the t_state object easier.

Change-Id: I6ba3459fa1de80c0ed8bcf0310f4565be78d3d97

4 years agoForceElement and ShellFCElement for the modular simulator
Pascal Merz [Tue, 6 Aug 2019 23:29:51 +0000 (17:29 -0600)]
ForceElement and ShellFCElement for the modular simulator

These elements encapsulate the calls to do_force and relax_shell_flexcon,
respectively. Rewriting calls to force routines is not within the scope
of this effort, so this allows us not to worry about it.

This commit is part of the commit chain introducing the new modular
simulator. Please see docs/doxygen/lib/modularsimulator.md for details
on the chosen approach. As the elements of the new simulator cannot all
be introduced in one commit, it might be worth to view Iaae1e205 to see
a working prototype of the approach.

Change-Id: I0923ddfc9f8f477b8920d212bcbdcf641075f80b

4 years agoAdding energy output field for density fitting
Christian Blau [Mon, 2 Sep 2019 13:47:24 +0000 (15:47 +0200)]
Adding energy output field for density fitting

Added a new energy output field for energies that stem from the density
fitting code.

refs #2282

Change-Id: I78c64213f4b958f00a938f0a67c586c2f4e9033e

4 years agoComputeGlobalsElement for the modular simulator
Pascal Merz [Tue, 9 Jul 2019 13:14:35 +0000 (07:14 -0600)]
ComputeGlobalsElement for the modular simulator

This element encapsulates the calls to `compute_globals`. A new
approach to fit the global computation calls into the client approach has
been proposed in I44a7193c, but a complete rewriting is currently outside
the scope of this effort. This element therefore aims at offering an
interface to the legacy implementation which is compatible with the new
simulator approach.

The element comes in 3 (templated) flavors: the leap-frog case, the first
call during a velocity-verlet integrator, and the second call during a
velocity-verlet integrator.

This commit is part of the commit chain introducing the new modular
simulator. Please see docs/doxygen/lib/modularsimulator.md for details
on the chosen approach. As the elements of the new simulator cannot all
be introduced in one commit, it might be worth to view Iaae1e205 to see
a working prototype of the approach.

Change-Id: I35f310daed6355dc9ea6b574d855929ec2fee6fe

4 years agoClean up commrec uniformly
Mark Abraham [Fri, 6 Sep 2019 12:08:14 +0000 (14:08 +0200)]
Clean up commrec uniformly

This was leaking commrec from gmx help during the building of
command-line completions, which the ASAN build sometimes complained
about.

Change-Id: I4ce53ba13187ea71102f5a93118978525da7061a

4 years agoAdd gpuupdate and gpucomm OnDemand tokens
Szilárd Páll [Thu, 5 Sep 2019 10:26:59 +0000 (12:26 +0200)]
Add gpuupdate and gpucomm OnDemand tokens

These allow triggering the GPU update-constraints and the GPU direct
communcation development features (both PP-PME and halo exchange),
respectively.

Also added matrix configs for both with configs identical to those in
the gpubufferops for the sake of simplicity.

Added an OpenCL config to ensure the additons of uninmpled features on
that codepath don't break things.

Change-Id: Iaf308d9b55ff10d8e43b655c2e1708eb05a5b43c

4 years agoPeriodic boundary correction for density fitting
Christian Blau [Mon, 2 Sep 2019 18:07:12 +0000 (20:07 +0200)]
Periodic boundary correction for density fitting

Corrects the periodic boundaries for density fittinng
such that always the periodic image closest to the center
of the density is chosen.

ref #2282

Change-Id: I46d9546d7dbb659e03070b4ba6ffd401eb7368c4

4 years agoExtract getting of DDRankSetup
Berk Hess [Thu, 5 Sep 2019 13:33:46 +0000 (15:33 +0200)]
Extract getting of DDRankSetup

This change is only refactoring.

Change-Id: I9a7f8ce16fe81f0016b33139933336fcb49b48b4

4 years agoAdd PP grid info to DDRankSetup
Berk Hess [Thu, 5 Sep 2019 12:14:28 +0000 (14:14 +0200)]
Add PP grid info to DDRankSetup

This enables many functions to use only DDRankSetup instead of
the whole gmx_domdec_t.
This change is only refactoring.

Change-Id: I6467481e3e1fa27c035c70d34591a6db0eeae90d

4 years agoIntroduce topology class for modular simulator
Pascal Merz [Thu, 27 Jun 2019 07:09:57 +0000 (01:09 -0600)]
Introduce topology class for modular simulator

The topology object owns the local topology and holds a pointer to the global
topology owned by the ISimulator.

The local topology is only infrequently changed if domain decomposition is
on, and never otherwise. The topology therefore offers elements to register
as ITopologyClients. If they do so, they get an updated local topology whenever
it is changed, and can rely that their copy is valid until the next update. The
domain decomposition element is defined as friend class to be able to update
the local topology when needed.

This commit is part of the commit chain introducing the new modular
simulator. Please see docs/doxygen/lib/modularsimulator.md for details
on the chosen approach. As the elements of the new simulator cannot all
be introduced in one commit, it might be worth to view Iaae1e205 to see
a working prototype of the approach.

Change-Id: I89e4006809ac74785205c549781a90b2d8233688

4 years agoUpdate mdrun test comparison infrastructure
Mark Abraham [Wed, 4 Sep 2019 15:18:22 +0000 (17:18 +0200)]
Update mdrun test comparison infrastructure

This change is refactoring and extension, no use is made of any new
capabilities.

Referred to position coordinates as coordinates, in line with
agreement elsewhere. Also referred to energy terms consistently,
rather than energy fields or tolerances.

Extended the range of mdp option parameters able to be tested
configurably with the contents of the simulation database.

Made energy and trajectory comparison machinery easier to use.

Trajectory comparison is now more configurable. Sometimes the test
runner will know that it is OK to compare the data in a test frame
with a reference frame even though one of them has data that the other
does not have, or will differ, etc. So, it is now possible to compare
e.g. a test trajectory that has a frame with velocities and not forces
with a reference trajectory whose frame has both velocities and
forces, and have the comparison be valid or not according to whether
the test runner expected the mismatch in contents.

Fixed issue with trajectory frame comparison assuming that coordinates
would always be present.

More use of std::string.

Change-Id: I6926380e271344e7bd1a7c6594cc604d7a68e67a

4 years agoRename MicroState to StatePropagatorData for modular simulator
Pascal Merz [Thu, 5 Sep 2019 02:59:18 +0000 (20:59 -0600)]
Rename MicroState to StatePropagatorData for modular simulator

The name of the t_state replacement is changed from MicroState
to StatePropagatorData. Also, the write and read access to x/v/f
data is renamed to xxxView() and constXxxView() for additional
clarity and to avoid confusion with file writing operations.

This also removes the constraint element from the list of friend
classes, as there is no need for direct access to the state
anymore thanks to I28b58df4.

Change-Id: I1b5b966aafbfa6fe5c44c36416ebb25f38505b58

4 years agoExtract DDRankSetup from gmx_domdec_comm_t
Berk Hess [Thu, 5 Sep 2019 09:57:08 +0000 (11:57 +0200)]
Extract DDRankSetup from gmx_domdec_comm_t

Change-Id: I5b16d624a375478928546788d1f8319e9d796100

4 years agoAdd reference density file option to densityfitting
Christian Blau [Mon, 2 Sep 2019 08:20:25 +0000 (10:20 +0200)]
Add reference density file option to densityfitting

Add option to density fitting to read reference density for
density fitting code.

refs #2282

Change-Id: I598b679a3c1c63b913a104d7ccff8e1643b3946d

4 years agoAdapt inheritance intendation to uncrustify
Pascal Merz [Wed, 4 Sep 2019 22:36:49 +0000 (16:36 -0600)]
Adapt inheritance intendation to uncrustify

As discussed in I35f310da and some other commits along the modular
simulator chain, uncrustify insists on aligning the first inheritance
with the `final` keyword, as in

template <ComputeGlobalsAlgorithm algorithm>
class ComputeGlobalsElement final :
    public                  ISimulatorElement,
    public IEnergySignallerClient,
    public ITrajectorySignallerClient,
    public ITopologyHolderClient

It was therefore decided to align all inheritances to the same level,
as in

template <ComputeGlobalsAlgorithm algorithm>
class ComputeGlobalsElement final :
    public                  ISimulatorElement,
    public                  IEnergySignallerClient,
    public                  ITrajectorySignallerClient,
    public                  ITopologyHolderClient

This formatting will be reevaluated when uncrustify is replaced by
clang-format.

This commit applies this decision to the classes previously introduced
along the commit chain. It also addresses two typos in trajectoryelement.h.

Change-Id: I03b9fd142d822f7a7523e351f08a4044bff2cff4

4 years agoMake do_constrain_first() independent of t_state
Pascal Merz [Thu, 5 Sep 2019 02:27:31 +0000 (20:27 -0600)]
Make do_constrain_first() independent of t_state

This changes the do_constrain_first() function to directly take the
required state data (natoms, x, v, box, lambda[efptBONDED]) as input
instead of a pointer to the full t_state object. This makes subsequent
changes to the t_state object easier.

This also adds some trivial const qualifier for the box matrix in the
constraining functions.

Change-Id: I28b58df45481549cd93076334b0778e23e228154

4 years agoSplit off getting of the DD setup
Berk Hess [Wed, 4 Sep 2019 10:53:34 +0000 (12:53 +0200)]
Split off getting of the DD setup

Change-Id: I19e956b04a14df75e91b721954bba52abe49d1d8

4 years agoCollect settings for DD in DDSettings
Berk Hess [Wed, 4 Sep 2019 11:49:10 +0000 (13:49 +0200)]
Collect settings for DD in DDSettings

This change is only refactoring.

Change-Id: Icb32f8f5211ff3033c4d5c70afbfd24d4a8ffbf3

4 years agoExtract getting of DDSystemInfo
Berk Hess [Wed, 4 Sep 2019 07:53:36 +0000 (09:53 +0200)]
Extract getting of DDSystemInfo

This change is only refactoring.

Change-Id: Ie7127f0fd8219108de1385978a781a3c15fc6239

4 years agoSimplify handling of DD bonded distances
Berk Hess [Wed, 4 Sep 2019 08:03:46 +0000 (10:03 +0200)]
Simplify handling of DD bonded distances

To simplify and clarify the DD setup code, we now always always store
the systemInfo.minCutoffForMultiBody and use a separate flag to tell
if we should increase the cut-off distance for bonded communication.
There is a minor behavioral change in that with large domains and
bonded communication filtering or DLB, the bonded cut-off is now
5% of the bonded cut-off longer as the margin is now included.
This has a negligible effect on performance in all cases.

Change-Id: Id409353c517181ac56e8d3f1f36c22c705aa8077

4 years agoMove constraint and bonded filtering info into DDSystemInfo
Berk Hess [Wed, 4 Sep 2019 06:45:19 +0000 (08:45 +0200)]
Move constraint and bonded filtering info into DDSystemInfo

Change-Id: Ic3cc4b5da309ab3f8e719739a5a162cd2c2d62bf

4 years agoBump ARM HPC toolchain in post-submit to v19.3
Szilárd Páll [Wed, 4 Sep 2019 00:33:10 +0000 (02:33 +0200)]
Bump ARM HPC toolchain in post-submit to v19.3

Change-Id: Id27642e016ee47888c7c3a7dac426309288aff9e

4 years agoFix double overload in LocalAtomSet code when gmx::index is int
Christian Blau [Tue, 3 Sep 2019 10:36:09 +0000 (12:36 +0200)]
Fix double overload in LocalAtomSet code when gmx::index is int

In cases where the int type matches the gmx::index (aka ptrdiff) type
two overloaded constructors in LocalAtomSetData became the same, as well
as the overloaded add method. This is now avoided by an enable_if
clause.

Change-Id: I139c7feff141928f71c71d6f6db3ee1bffe325b7

4 years agoAdd back a clang-tidy exception
Szilárd Páll [Fri, 23 Aug 2019 16:12:35 +0000 (18:12 +0200)]
Add back a clang-tidy exception

Previous commit (658819) removed a clang-tidy exception that was
needed with clang 8, but the SIMD + GPU path have not been enabled
yet with clang-8 tidy. To be able to enable the pending CI configs
this change adds back the nolint exception.

Change-Id: I6be4856c64161a1a5f57849d13b4cdea335cc3bb

4 years agoRead mrc file using file name
Christian Blau [Mon, 2 Sep 2019 08:12:31 +0000 (10:12 +0200)]
Read mrc file using file name

Provide a higher level class for reading an mrc file given file name and
convert the information read from the density file into coordinate
transformation and three-dimensional density data.

Change-Id: I30ac5c044c5433043224be288340b794455f8fc9

4 years agoMove update grouping to DDSystemInfo
Berk Hess [Tue, 3 Sep 2019 20:43:34 +0000 (22:43 +0200)]
Move update grouping to DDSystemInfo

Change-Id: Ida28b87a4a0ff004d25ca4d6f0f78f30a19536dd

4 years agoInline functions of calculations of FE interaction types.
Magnus Lundborg [Wed, 19 Jun 2019 14:13:33 +0000 (16:13 +0200)]
Inline functions of calculations of FE interaction types.

The functions are so far only templated on the real
requirements of the softcore that is used.

This is one step towards templating the calculations
for SIMD.

Refs #2997.

Change-Id: I3fd119dce30f95eba4f8cd6f139f99260acf0e22

4 years agoChange DD pme force buffer to std::vector
Berk Hess [Tue, 3 Sep 2019 18:52:08 +0000 (20:52 +0200)]
Change DD pme force buffer to std::vector

Change-Id: I8cf00535fab713911e3dbb24a4daed3eeb0b46ee

4 years agoInitialize all members of gmx_domdec_t
Berk Hess [Tue, 3 Sep 2019 12:59:17 +0000 (14:59 +0200)]
Initialize all members of gmx_domdec_t

Change-Id: I78958c9c0e72de77d6226685401b9a5ff19434aa

4 years agoCentralize more MD/force shedule flags
Szilárd Páll [Thu, 20 Jun 2019 18:54:01 +0000 (20:54 +0200)]
Centralize more MD/force shedule flags

This change creates an MdScheduleWorkload top-level class to store
information related to per-step, per search-phase, or per run schedule
information and moving the previous PpForceWorkload call into it.

This change also migrates force flags bitmask into a new class
stored in the MdWorkload class.

Change-Id: I142a76d9515e82b16b9a4100ffb00469d7f3d3c2

4 years agoExtract DDSystemInfo from gmx_domdec_comm_t
Berk Hess [Tue, 3 Sep 2019 09:06:54 +0000 (11:06 +0200)]
Extract DDSystemInfo from gmx_domdec_comm_t

This is only refactoring.
This is preparation for separating the DD grid choice from
the initialization of gmx_domdec_t.

Change-Id: I83d8ecdd1a4d21d0a791c463d092f66d0b28df51

4 years agoUnify manual and auto DD grid choices
Berk Hess [Tue, 3 Sep 2019 08:45:02 +0000 (10:45 +0200)]
Unify manual and auto DD grid choices

This change is only refactoring, except that now an assert is added
for consistency of the auto grid choice with the cell size limit.

Change-Id: I36306495881826de809e3d048d0ced52543674e2

4 years agoRemove gmx_domdec_t from dd_choose_grid()
Berk Hess [Tue, 3 Sep 2019 08:30:36 +0000 (10:30 +0200)]
Remove gmx_domdec_t from dd_choose_grid()

This change is only refactoring.

Change-Id: I2d658739da1f0ff185ab89a5efe2361da0c7fa82

4 years agoExtact UnitCellInfo from gmx_domdec_t
Berk Hess [Tue, 3 Sep 2019 07:40:10 +0000 (09:40 +0200)]
Extact UnitCellInfo from gmx_domdec_t

This required adding an explicit constructor for gmx_domdec_t,
which is currently incomplete.

Change-Id: Iba39fec36945465bffaf97d499c56501500ecb3b

4 years agoPython wrapping code for gmxapi mdrun bindings.
M. Eric Irrgang [Thu, 29 Aug 2019 18:28:43 +0000 (21:28 +0300)]
Python wrapping code for gmxapi mdrun bindings.

Expose the mdrun bindings to the Python interface.

Updates workflow.py and context.py from 0.0.7.4 tagged release of external project.

Refs #2893
Refs #2912
Refs #3027

Change-Id: I44a66646eceb191a2ec755169671af326f22526a

4 years agoIntroduce energy element for modular simulator
Pascal Merz [Thu, 27 Jun 2019 07:09:43 +0000 (01:09 -0600)]
Introduce energy element for modular simulator

The energy element owns energy related data (energies for output,
tensors for virial and pressure, mu_tot vector), and holds pointers
to energy-related data owned by ISimulator (enerd, ekind). It is
responsible for calculating energies at steps, and writing energies
to trajectory files. It offers interface access to add data to the
virials, but also offers raw pointers, as not a lot of functionality
across GROMACS relies on getting raw pointers to the tensors /
mu_tot vector.

This commit is part of the commit chain introducing the new modular
simulator. Please see docs/doxygen/lib/modularsimulator.md for details
on the chosen approach. As the elements of the new simulator cannot all
be introduced in one commit, it might be worth to view Iaae1e205 to see
a working prototype of the approach.

Improved handling of MSVC warning 4244 about possible lossy conversion.

Change-Id: Iae8d666e1c38b5a817d7ef2018adb13567d4760b

4 years agoSimplify energy-file comparisons in tests
Mark Abraham [Tue, 27 Aug 2019 11:44:24 +0000 (13:44 +0200)]
Simplify energy-file comparisons in tests

Now that we use newer infrastructure, we can use lambdas.

Also made FramePairManager and ContinuationFramePairManager
more consistent.

Change-Id: I8ccc9dd3134e5e188c3ea2b8b6ab335b4f267b10

4 years agoAdd Parrinello-Rahman pressure coupling to CUDA Leap-Frog integrator
Artem Zhmurov [Fri, 9 Aug 2019 10:31:08 +0000 (12:31 +0200)]
Add Parrinello-Rahman pressure coupling to CUDA Leap-Frog integrator

Parrinello-Rahman isotropic pressure coupling scheme is now
added to CUDA version of the Leap-Frog integrator. The
Leap-Frog tests are updated to check the new addition.

Refs. #2887, #2888.

Change-Id: Icf42667621c16a994e68baf5158ea4abac387928