alexxy/gromacs.git
3 years agoMake EnergyOutput::addDataAtEnergyStep independent of t_state
Pascal Merz [Mon, 7 Sep 2020 20:23:36 +0000 (20:23 +0000)]
Make EnergyOutput::addDataAtEnergyStep independent of t_state

EnergyOutput::addDataAtEnergyStep took a pointer to a full t_state,
although it only uses a small part of the object. This makes the
dependencies explicit. This is a necessary step to make EnergyData
independent of t_state.

Refs #3419

3 years agoRemove in-body comment from init_forcerec(...) function
Artem Zhmurov [Mon, 7 Sep 2020 10:58:02 +0000 (13:58 +0300)]
Remove in-body comment from init_forcerec(...) function

Fixes doxygen warning

3 years agoFix clang-format
Artem Zhmurov [Mon, 7 Sep 2020 17:44:03 +0000 (20:44 +0300)]
Fix clang-format

3 years agoReplace filename-based initialization functions.
M. Eric Irrgang [Mon, 7 Sep 2020 16:13:31 +0000 (16:13 +0000)]
Replace filename-based initialization functions.

Decouple Mdrunner from the details of `-s` and `-cpi`
filename arguments when establishing initial simulation state.

Declare gmx::SimulationInput and the library utilities needed to
replace direct reference to TPR and CPT files in Mdrunner.
Use SimulationInput and accompanying utilities to remove read_tpx_state
and load_checkpoint from Mdrunner.

Allows TPR and checkpoint file handling to be considered separately
from Mdrunner initialization in future development.

Refs #3374

3 years agoImplement affine coordinate transformation
Christian Blau [Mon, 7 Sep 2020 13:46:40 +0000 (13:46 +0000)]
Implement affine coordinate transformation

Introduce a new class and tests for affine coordinate transformations.
Allows to perform a matrix multiplication and shift to coordinates of the form A*x+t with a 3x3 real valued matrix A and a translation vector t.

3 years agoAccess the device status directly, remove the getter
Artem Zhmurov [Mon, 7 Sep 2020 06:09:04 +0000 (06:09 +0000)]
Access the device status directly, remove the getter

DeviceInformation is a basic contained and does not need the getters.

3 years agoPrepare legacy checkpoint for modular simulator checkpointing
Pascal Merz [Sun, 6 Sep 2020 18:15:55 +0000 (18:15 +0000)]
Prepare legacy checkpoint for modular simulator checkpointing

* Extend legacy checkpointing functionality to accept a CheckpointDataHolder
  for reading and writing
* Bump checkpoint version to reflect above change
* Turn off some checkpoint sanity checks when using modular simulator
* Pass CheckpointDataHolder object into checkpoint reading in runner, and
  move this object in SimulatorBuilder and then ModularSimulator for element
  setup

Refs #3517
Refs #3422
Refs #3419

3 years agoModular simulator: Simplify velocity update dispatch
Pascal Merz [Sun, 6 Sep 2020 12:01:42 +0000 (12:01 +0000)]
Modular simulator: Simplify velocity update dispatch

This simplifies the velocity update dispatch of the modular simulator
propagator. This is pure rebasing reducing the number of branches
required to dispatch the right templated version of the velocity
update.

3 years agoString to array conversion functions
Christian Blau [Fri, 4 Sep 2020 11:59:43 +0000 (11:59 +0000)]
String to array conversion functions

Introduce and test a function that allows to convert a string into
a fixed-size array of arbitrary ElementType.

3 years agoIntroduce CheckpointData
Pascal Merz [Thu, 30 Apr 2020 02:25:41 +0000 (20:25 -0600)]
Introduce CheckpointData

CheckpointData exposes methods to read and write scalar values,
ArrayRefs, and tensors. It also allows to create a "sub-object" of
type CheckpointData which allows to have more complex members
implement their own checkpointing routines. All methods are templated
on the chosen operation, CheckpointDataOperation::Read or
CheckpointDataOperation::Write, allowing clients to use the same code
to read and write to checkpoint. Type traits and constness are used to
catch as many errors as possible at compile time. CheckpointData uses
a KV-tree to store the data internally. This is however never exposed
to the client. Having this abstraction layer gives freedom to change
the internal implementation in the future.

All CheckpointData objects are owned by a ReadCheckpointDataHolder or
WriteCheckpointDataHolder. These holder classes own the internal
KV-tree, and offer deserialize(ISerializer*) and
serialize(ISerializer*) functions, respectively, which allow to read
from / write to file. This separation clearly defines ownership and
separates the interface aimed at file IO from the interface aimed at
objects reading/writing checkpoints.

Refs #3517
Refs #3422
Refs #3419

3 years agoRemove unnecessary friend declaration
Pascal Merz [Thu, 3 Sep 2020 15:28:59 +0000 (09:28 -0600)]
Remove unnecessary friend declaration

3 years agoPrint lambda state to log file if using AWH for FEP.
Magnus Lundborg [Tue, 1 Sep 2020 11:24:20 +0000 (13:24 +0200)]
Print lambda state to log file if using AWH for FEP.

Change-Id: I08c7e6d51a299eb53556d5bde63c29f7c7640f6e

3 years agoFix bug it GPU halo exchange initialization for continuation runs
Alan Gray [Sun, 23 Aug 2020 13:05:51 +0000 (06:05 -0700)]
Fix bug it GPU halo exchange initialization for continuation runs

Fixes a bug introduced in fdf8c9064e2289bb01b1536a06f83755450caee8
where, due to the presence of !(bFirstStep && ir->bContinuation) in
the if statement predicate of the block in which the init call was
located. In the case of continuation runs the halo exchange would not
be initialized until the second search step, causing the code to
crash. This change moves the init call to a separate block with the
correct logic in the if statement.

3 years agoMake dd_collect_vec independent of t_state
Pascal Merz [Thu, 3 Sep 2020 05:27:38 +0000 (23:27 -0600)]
Make dd_collect_vec independent of t_state

This removes the explicit dependency of dd_collect_vec on the
t_state object.

This is a prerequisite for !440.

Refs #3422 #3419

3 years agoMove listed and wall forces out of do_force_lowlevel()
Berk Hess [Wed, 2 Sep 2020 21:02:55 +0000 (21:02 +0000)]
Move listed and wall forces out of do_force_lowlevel()

Renamed do_force_lowlevel() to calculateLongRangeElectrostatics().

Also replace C pointer for coordinates by ArrayRefWithPadding
in calculate() of ListedForces and do_walls().

3 years agoEnable splitting of listed interaction calculation
Berk Hess [Wed, 2 Sep 2020 15:27:23 +0000 (15:27 +0000)]
Enable splitting of listed interaction calculation

This replaces the ListedForces unique_ptr in t_forcerec by a vector
of unique_ptr and adds a selection mechanism for bonded interactions.

Also moved the t_fcdata storage out of ListedForces into t_forcerec
because we need only one instance.

3 years agoFix improved SIMD angles()
Gilles Gouaillardet [Wed, 2 Sep 2020 09:01:44 +0000 (09:01 +0000)]
Fix improved SIMD angles()

avoid division by zero when the angle is (too close to) zero.

Fix a regression introduced in fb7a6480db5914a50a97618b3e6316663041aafb

3 years agoMerge branch 'release-2020' into master
Paul Bauer [Mon, 31 Aug 2020 15:15:45 +0000 (17:15 +0200)]
Merge branch 'release-2020' into master

Resolved Conflicts:
CMakeLists.txt
admin/ci-scripts/build-and-test-py-gmxapi-0.1.sh
admin/ci-scripts/build-and-test-sample_restraint-2020.sh
admin/clang-tidy.sh
admin/gitlab-ci/global.gitlab-ci.yml
admin/gitlab-ci/gromacs.gitlab-ci.yml
admin/gitlab-ci/python-gmxapi.gitlab-ci.yml
cmake/gmxManageGPU.cmake
cmake/gmxManageNvccConfig.cmake
cmake/gmxVersionInfo.cmake
share/CMakeLists.txt
src/config.h.cmakein
src/gromacs/CMakeLists.txt
src/gromacs/analysisdata/CMakeLists.txt
src/gromacs/ewald/pme.cpp
src/gromacs/fileio/tpxio.cpp
src/gromacs/fileio/writeps.cpp
src/gromacs/gmxana/gmx_hbond.cpp
src/gromacs/gmxana/gmx_lie.cpp
src/gromacs/gmxana/gmx_xpm2ps.cpp
src/gromacs/gmxpreprocess/genrestr.cpp
src/gromacs/gmxpreprocess/tests/CMakeLists.txt
src/gromacs/gpu_utils/gpu_utils.cu
src/gromacs/gpu_utils/tests/pinnedmemorychecker.cpp
src/gromacs/math/CMakeLists.txt
src/gromacs/options/CMakeLists.txt
src/gromacs/pbcutil/CMakeLists.txt
src/gromacs/topology/mtop_util.cpp
src/gromacs/trajectoryanalysis/CMakeLists.txt
src/gromacs/utility/CMakeLists.txt

Change-Id: I9c364fc3a8e1d9ba9821e06155136ffc6f46b8cd

3 years agoAdd SIMD version of harmonic bonds
Berk Hess [Fri, 28 Aug 2020 22:34:40 +0000 (22:34 +0000)]
Add SIMD version of harmonic bonds

Change-Id: I63ea7d9b76127112c221a9b6910604a09bbb0bb7

3 years agoAvoid seg fault when PME-PP GPU comm flag is used in isolation
Alan Gray [Sun, 23 Aug 2020 12:31:56 +0000 (05:31 -0700)]
Avoid seg fault when PME-PP GPU comm flag is used in isolation

Improves stability by ensuring that GPU buffer ops flag is
automatically set if GPU PME-PP flag is set (in the same way as was
already done for GPU DD flag). Otherwise get a seg fault if PME-PP GPU
env trigger is used without either GPU DD or GPU Buffer ops env
triggers).

3 years agoClarify t_inputrec allocation logic in runner.cpp.
M. Eric Irrgang [Thu, 27 Aug 2020 11:09:23 +0000 (14:09 +0300)]
Clarify t_inputrec allocation logic in runner.cpp.

Closes #3637

3 years agoUse a heap object for inputrec in gmx::Mdrunner::mdrunner().
M. Eric Irrgang [Thu, 27 Aug 2020 07:04:43 +0000 (07:04 +0000)]
Use a heap object for inputrec in gmx::Mdrunner::mdrunner().

Convert the inputrec pointer to a unique_ptr to combine the clean-up
behavior from both local variables. Remove the explicit inputrecInstance
local variable, converting to a heap object created through make_unique.
This allows the t_inputrec to be moved via its handle for more flexible
management, and allows the allocation to be moved closer to the
initialization.

3 years agoAdd ForceBuffers class
Berk Hess [Thu, 27 Aug 2020 06:09:17 +0000 (06:09 +0000)]
Add ForceBuffers class

This change replaces the type of the force buffer in mdrun from
PaddedHostVector<RVec> to a new class ForceBuffers. This new class
currently only holds one force buffer, but this is in preparation for
multiple time stepping where a second force buffer is needed.

3 years agoPermit build with CUDA 11.0
Mark Abraham [Wed, 26 Aug 2020 10:41:26 +0000 (10:41 +0000)]
Permit build with CUDA 11.0

The unannounced removal of SM 30 means cmake fails on all
GROMACS releases prior to this.

Fixes isHostMemoryPinned for changes in CUDA 11.0 and improves
test coverage.

Adapts tested and reviewed changes from !407 and !434

Refs #3631
Fixes #3632

3 years agofix check_assign_interactions_atom()
Gilles Gouaillardet [Fri, 21 Aug 2020 02:17:35 +0000 (11:17 +0900)]
fix check_assign_interactions_atom()

fix a bug introduced in gromacs/gromacs@c507ae4d3f4b0d516e53896dac35a52911a8a44b

Thanks Berk Hess for the guidance to the right fix

Refs. gromacs/gromacs#3635

3 years agoAvoid log(0) if probability is too low
Magnus Lundborg [Tue, 25 Aug 2020 13:01:59 +0000 (13:01 +0000)]
Avoid log(0) if probability is too low

Change-Id: I96f5aa61f21303c4c382b8a0664cffd20e85bbd6

3 years agoMove GPU devices management into hardware subfolder
Artem Zhmurov [Mon, 24 Aug 2020 08:39:46 +0000 (08:39 +0000)]
Move GPU devices management into hardware subfolder

This consolidate the GPU management in CUDA and OpenCL into one
place.

3 years agoAccept Python versions higher than 3.8.
M. Eric Irrgang [Thu, 20 Aug 2020 15:41:24 +0000 (18:41 +0300)]
Accept Python versions higher than 3.8.

This change allows GROMACS 2021 to detect Python versions that users
will encounter during its lifetime.

Refs #3479

3 years agoRemove conditional for CMake < 3.12.
M. Eric Irrgang [Mon, 15 Jun 2020 11:26:06 +0000 (14:26 +0300)]
Remove conditional for CMake < 3.12.

Simplify CMakeLists.txt now that CMake 3.13 is required.

3 years agoMake it possible to use FEP lambda states as a reaction coordinate in AWH. Atom masse...
Magnus Lundborg [Thu, 20 Aug 2020 12:15:28 +0000 (12:15 +0000)]
Make it possible to use FEP lambda states as a reaction coordinate in AWH. Atom masses and constraints cannot be perturbed (yet). It is possible to use a multidimensional bias where the lambda state is one dimension. An AWH FEP lambda state dimension is always using a discrete Gibbs sampler (umbrella), even if another dimension is using a convolved bias potential.

3 years agoEnable CI testing of OpenAPI / OpenCL
Erik Lindahl [Thu, 20 Aug 2020 10:42:57 +0000 (10:42 +0000)]
Enable CI testing of OpenAPI / OpenCL

For now this will run on the Intel CPU device
in our testing infrastructure.

3 years agoFix bug in Lincs GPU setup
Alan Gray [Thu, 20 Aug 2020 08:49:39 +0000 (08:49 +0000)]
Fix bug in Lincs GPU setup

Memory re-allocation was previously only triggered if the number of
constraints threads increases. But the sizes also depend on the value
of "maxCoupledConstraints", and its possible that this can increase
without the number of constraints threads increasing. This change
fixes by also triggering the reallocation when the value of
maxCoupledConstraints is increased.

3 years agoAllow more granularity for public interfaces in build tree.
M. Eric Irrgang [Mon, 17 Aug 2020 14:24:25 +0000 (17:24 +0300)]
Allow more granularity for public interfaces in build tree.

Move the gmxapi installed headers from api/include/gmxapi to
api/gmxapi/include/gmxapi, making room for api/nblib/include installed
headers or others. This allows CMake targets in the build tree to
restrict access to public headers as well as private headers such that
the `gmxapi` target allows `#include "gmxapi/someheader.h"` but does not
inadvertently allow `#include "nblib/anotherheader.h"` without an
explicit `target_link_libraries`.

Fix some disordered header inclusions.

Refs #3288

3 years agoUse proper doxygen tags in modular simulator
Pascal Merz [Sun, 21 Jun 2020 00:16:57 +0000 (18:16 -0600)]
Use proper doxygen tags in modular simulator

Files in src/gromacs/modularsimulator/ were partially using @tag instead
of \tag for Doxygen tags. GROMACS style prefers \tag, so this change
updates these tags.

Closes #3565

3 years agoAllow simpler use of scripted container builds
Mark Abraham [Thu, 6 Aug 2020 07:24:57 +0000 (09:24 +0200)]
Allow simpler use of scripted container builds

There's no need to have a list of supported versions of things in the
script that supports building CI images. We should have a list, e.g.
in the install guide, but not here.

One of the primary use cases for the script is building new
images. Those are most often needed for new versions of things, and
expanding the supported versions list is needless work.

Removed use of const and relaxed types for versions that e.g. need
not be integers.

Made suggestions in the doc strings of valid choices.

Note, had to force-push this branch to get out of non-linear merge
history hell.

Fixes #3622

3 years agoRestore use of CUDA 11.0 in CI
Mark Abraham [Mon, 17 Aug 2020 10:16:40 +0000 (12:16 +0200)]
Restore use of CUDA 11.0 in CI

This reverts commit 0cc3567fe2d0ddb599cda21de6322981f6b0ceec.

Refs #3609

3 years agoFix clang-format
Paul Bauer [Mon, 17 Aug 2020 09:45:29 +0000 (11:45 +0200)]
Fix clang-format

Change-Id: I469d539a741a5eed12214267530fedb3f5ccf367

3 years agoBuild fewer unnecessary SIMD kernels in CI
Mark Abraham [Mon, 17 Aug 2020 09:34:48 +0000 (09:34 +0000)]
Build fewer unnecessary SIMD kernels in CI

The docs, webpage and simple builds all use GMX_SIMD=none, but still
compile many kernel flavors. This spends build and cache time that
we don't need. It does mean the simple-build's tests run a bit longer,
however.

Refs #3272

3 years agoSupport oneAPI in gitlab CI
Mark Abraham [Mon, 17 Aug 2020 09:04:34 +0000 (09:04 +0000)]
Support oneAPI in gitlab CI

Generalizes the TSAN build stage to a compiler build stage, and uses
it for containing the installation process for the free Intel tools

Fixed or worked around several bugs

Updated install guide section on tested platforms to describe
what we actually do

Refs #3459, #3620

3 years agoReduce artifact size
Paul Bauer [Mon, 17 Aug 2020 08:39:17 +0000 (08:39 +0000)]
Reduce artifact size

Remove object files from build archives to reduce size.

Fixes #3630

Change-Id: Id841b91b8ab31d79579685c4aebaa67dec464962

3 years agoStopped using images in biophysics Docker repository
Mark Abraham [Mon, 17 Aug 2020 04:39:09 +0000 (06:39 +0200)]
Stopped using images in biophysics Docker repository

Also avoided compiling SIMD kernels for the build that
merely produces content for the tarballs.

Fixes #3619

3 years agoAvoid builds with RelWithDebInfo
Mark Abraham [Sun, 16 Aug 2020 08:01:10 +0000 (10:01 +0200)]
Avoid builds with RelWithDebInfo

These produce object and binary files that are larger than we need. If
we need that information to diagnose an issue, we can turn it on, or
build locally using the same Docker image.

Refs #3630

3 years agoFix isHostMemoryPinned for changes in CUDA 11.0
Mark Abraham [Mon, 17 Aug 2020 07:23:55 +0000 (07:23 +0000)]
Fix isHostMemoryPinned for changes in CUDA 11.0

Improved test coverage and output

Restored some test code to compile and execute.

Fixes #3631

3 years agoModular simulator: Don't wrap std::function in unique_ptr
Pascal Merz [Sun, 16 Aug 2020 08:48:03 +0000 (08:48 +0000)]
Modular simulator: Don't wrap std::function in unique_ptr

3 years agoAdd SIMD bonded tests and improve SIMD angles()
Berk Hess [Fri, 14 Aug 2020 19:23:02 +0000 (19:23 +0000)]
Add SIMD bonded tests and improve SIMD angles()

The listed_forces module bonded tests are now also executed for the
force-only and SIMD flavor of the bonded kernels, when available.

Improved precision of SIMD angles kernel for small angles by avoiding
two invsqrt operations for computing the sin.

3 years agoFix DeviceStreamManager tests
Artem Zhmurov [Fri, 14 Aug 2020 14:16:01 +0000 (14:16 +0000)]
Fix DeviceStreamManager tests

Wrong CMake macros was used which lead to DeviceStreamManager not
running for GPU builds.

3 years agoIntroduce flexible ModularSimulatorAlgorithmBuilder: Helper structs to connect propag...
Pascal Merz [Fri, 14 Aug 2020 12:21:48 +0000 (12:21 +0000)]
Introduce flexible ModularSimulatorAlgorithmBuilder: Helper structs to connect propagators to thermo/barostats

3 years agoAdd new FEP perturbation check functions
Berk Hess [Thu, 13 Aug 2020 13:13:10 +0000 (15:13 +0200)]
Add new FEP perturbation check functions

Added functions to check whether the system has perturbed masses
and perturbed constraints. Simplified the perturbed atoms check.

3 years agoCMake SYCL & Intel OpenMP handling
Erik Lindahl [Tue, 11 Aug 2020 11:25:09 +0000 (13:25 +0200)]
CMake SYCL & Intel OpenMP handling

This enables CMake handling of SYCL support in Intel
compilers, we warn the user to use the HPC toolkit
compilers that support OpenMP instead of the default
dpcpp. We attempt to disable SYCL by default when
using dpcpp (to avoid warnings). Source files that
need SYCL support should add SYCL_CXX_FLAGS.

For now it will not work to actually compile with
GMX_GPU=SYCL, since that enables code paths that
depend on the SYCL buffer implementations in the
pipeline.

3 years agoRemove superfluous math utility functions
Christian Blau [Thu, 13 Aug 2020 07:18:13 +0000 (09:18 +0200)]
Remove superfluous math utility functions

Remove max_cutoff and gmx_greatest_common_divisor from utilities.h.

max_cutoff was never used

C++17 introduces std::gcd, replacing gmx_greatest_common_divisor

3 years agoRevert to CUDA 10 image for CI
Mark Abraham [Wed, 12 Aug 2020 15:17:57 +0000 (17:17 +0200)]
Revert to CUDA 10 image for CI

Some pinning behaviors don't work with CUDA 11.0

Refs #3609

3 years agoimplement AVX-512 second FMA detection
Jeff Hammond [Wed, 12 Aug 2020 12:47:28 +0000 (12:47 +0000)]
implement AVX-512 second FMA detection

This uses the CPUID processor name.

We use the condensed method developed for Google cpu_features:
https://github.com/jeffhammond/cpu_features/blob/avx512_fma_count/src/cpuinfo_x86.c#L119
(this link will expire when it is merged into the upstream project)

A more pedantic approach is shown here:
https://github.com/jeffhammond/vpu-count/blob/master/vpu-count.c

This code must be updated when new Intel processors are released.
The author of this commit will bear that maintenance burden as long as possible.

Signed-off-by: Hammond, Jeff R <jeff.r.hammond@intel.com>
3 years agoFix virtual site vsiten indexing bug
Berk Hess [Wed, 12 Aug 2020 06:01:26 +0000 (06:01 +0000)]
Fix virtual site vsiten indexing bug

Fix bug introduced in b16cc028.

Change-Id: I9e4421851bbb3c4bd80e2810ecbfd4a987dde020

3 years agoMove density fitting checkpointing into state
Christian Blau [Mon, 10 Aug 2020 10:52:11 +0000 (10:52 +0000)]
Move density fitting checkpointing into state

The density fitting state and the data to checkpoint are one and the
same and should be treated in the same place. Moving the checkpointing
infrastructure for density fitting code into the state and closer to the
data that is to be checkpointed makes it easier to ensure that all
necessary data is writtten to a checkpoint file.

Introduced variable names to make sure that reading and writing from the
key-value-tree is symmetric and does not include typos.

Added read/write functions in checkpoint.h to simplify checkpoint
writing for this and other modules.

Change-Id: Ie7fa5e22333251db9050bb4491e61681651aa5c2

3 years agoFix typo in docs
Mark Abraham [Sat, 8 Aug 2020 15:47:10 +0000 (15:47 +0000)]
Fix typo in docs

3 years agoFixed the mis-fix
Christian Blau [Fri, 7 Aug 2020 20:30:02 +0000 (20:30 +0000)]
Fixed the mis-fix

Wrong variable being used was the issue instead of increase by one.

3 years agoIntroduce GlobalCommunicationHelper
Pascal Merz [Thu, 6 Aug 2020 22:30:23 +0000 (16:30 -0600)]
Introduce GlobalCommunicationHelper

In view of #3437 (!410), this introduces a helper container to store
data related to global communication. With the upcoming builder
approach, there won't be a central location where all elements are
created, so this helper container helps grouping related data allowing
for shorter call signatures. This helper object will become obsolete
when moving to a client-based global communication (#3421,
draft implementation ready).

3 years agoFix release build warning
Mark Abraham [Thu, 6 Aug 2020 06:33:59 +0000 (08:33 +0200)]
Fix release build warning

A build with clang as the nvcc host compiler gives warnings
on the CUDA headers, which are now suppressed. There's no good
way to only give the warnings on CUDA's headers.

3 years agoRevert "Modernize STL usage" for fixedCapacityVector
Alan Gray [Fri, 7 Aug 2020 12:24:15 +0000 (05:24 -0700)]
Revert "Modernize STL usage" for fixedCapacityVector

This reverts 2f876de263efdf08daf160e7791434cd760ccd9b for
fixedCapacityVector.h only. The syntax that was added is not yet
supported by the CUDA compiler (including the latest 11.0 version),
and as such this revertion is required to allow use of
fixedCapacityVector from within CUDA files (required for an upcoming
change). This should be added back when CUDA support for the syntax
arrives.

3 years agoAdd accumulation checks to ForeignLambdaTerms
Berk Hess [Fri, 7 Aug 2020 12:51:10 +0000 (12:51 +0000)]
Add accumulation checks to ForeignLambdaTerms

Added checks that accumulation of potential terms have been finalized.
This is generally good for avoiding bugs, but is needed in particular
for passing foreign lambda energy difference to AWH.

3 years agoImprove modular simulator builders
Pascal Merz [Fri, 7 Aug 2020 10:35:28 +0000 (10:35 +0000)]
Improve modular simulator builders

3 years agoSeparate ISimulator interface and data
Pascal Merz [Fri, 7 Aug 2020 08:24:47 +0000 (08:24 +0000)]
Separate ISimulator interface and data

In fulfillment of #3566 this separates ISimulator into a pure
virtual interface (still named ISimulator) and a data object
LegacySimulatorData.

The LegacySimulator now inherits from both classes, no other
changes are needed.

ModularSimulator takes the new LegacySimulatorData as an explicit
member object. ModularSimulatorAlgorithmBuilder uses a pointer to
this new member object rather than holding a copy of the
LegacySimulatorData members.

Closes #3566

3 years agoKeep all the infra and the user happy
Mark Abraham [Thu, 6 Aug 2020 12:47:42 +0000 (14:47 +0200)]
Keep all the infra and the user happy

Refs !330

3 years agoUpdate minimum tested CUDA to 11.0
Mark Abraham [Thu, 6 Aug 2020 12:19:46 +0000 (12:19 +0000)]
Update minimum tested CUDA to 11.0

Generate code for valid compute capabilities.

Suppressed a warning about codegen for deprecated architectures.

Fixes #3609

3 years agoSimplified uniform GPU selection in CMake
Erik Lindahl [Tue, 4 Aug 2020 19:27:21 +0000 (19:27 +0000)]
Simplified uniform GPU selection in CMake

GPU selection is now done by setting GMX_GPU to either CUDA
or OpenCL, with no other variables required. As part of the
overall CMake simplification, the CMake automatic detection
of hardware and "auto" settings for GPU acceleration have
been removed. This will require the user to explicitly enable
GPU support (which is a drawback), but it leads to much
simplier and shorter CMake code, similar support for CUDA and
OpenCL, and it will make it easier to handle multiple different
APIs targeting e.g. NVIDIA GPU hardware in the near future.

3 years agoFix compilation issue: pass variable of expected type to resize
Alan Gray [Tue, 4 Aug 2020 12:30:35 +0000 (12:30 +0000)]
Fix compilation issue: pass variable of expected type to resize

Compilation was failing under certian situations since a7e51062b4
because of the line
flags->resize(sizeNeededForBufferFlags(numAtoms),0);
since the second arg is expected to be of type gmx_bitmask_t to
match the type in the flags vector. This patch fixes by explicitly
passing a zeroed variable of the correct type.

3 years agoPrevent failed commandline_operation from publishing output files.
M. Eric Irrgang [Thu, 30 Jul 2020 11:04:00 +0000 (14:04 +0300)]
Prevent failed commandline_operation from publishing output files.

Also, add more sophisticated tests for commandline_operation: Test input
and output file arguments. The first of the tests is adapted from the
acceptance tests for 2020 functional requirement 3.

Fixes #3616

3 years agoMinor additions to gmxapi install.rst
M. Eric Irrgang [Fri, 31 Jul 2020 14:35:21 +0000 (17:35 +0300)]
Minor additions to gmxapi install.rst

Document more contingencies in gmxapi install docs.
* pre-release packages at PyPI
* advice to work around a bug from old third-party package dependencies

3 years agoUse importlib_resources in Python 3.6 images.
M. Eric Irrgang [Tue, 16 Jun 2020 10:48:26 +0000 (13:48 +0300)]
Use importlib_resources in Python 3.6 images.

Python 3.7 adds importlib.resources to the standard library, which
provides an efficient built in alternative to pkg_resources.
Backported functionality is available in the importlib_resources
package. We should add it to our Docker images to allow testing new
features while we still officially support Python 3.6.

See also issue #2961

3 years agoNormalize docker image names.
M. Eric Irrgang [Fri, 31 Jul 2020 13:31:09 +0000 (16:31 +0300)]
Normalize docker image names.

Change the name of the DockerHub image repository name to include the
name of the supported branch. Leave the tag unspecified when naming the
built images and when referencing images for CI jobs to get the standard
imagePullPolicy for the `latest` tag.

See also:
https://kubernetes.io/docs/concepts/configuration/overview/#container-images

Fixes #3618

3 years agoFix some minor typesetting issues.
M. Eric Irrgang [Fri, 31 Jul 2020 11:22:18 +0000 (14:22 +0300)]
Fix some minor typesetting issues.

Formatting errors in gmxapi install.rst

3 years agoImprove install docs links.
M. Eric Irrgang [Fri, 31 Jul 2020 11:49:55 +0000 (14:49 +0300)]
Improve install docs links.

Convert some mark-up that did not generate links into explicit links to
Python package URLs. Add some additional internal links.

3 years agoMove code to prepare for multisim class
Mark Abraham [Fri, 31 Jul 2020 12:57:18 +0000 (12:57 +0000)]
Move code to prepare for multisim class

Some write_checkpoint code organizes cooperation of behavior from
multiple modules so it is too high-level to be in a low-level module
like fileio. mdoutf.cpp is the caller of write_checkpoint so is a
decent spot to put that code. Other parts of write_checkpoint are
quite low level and share implementation details with the
checkpoint-reading code, so should stay in checkpoint.cpp.

Moved misplaced multisim code from md.cpp and md_support.cpp to
the multisim.cpp file, resolving some TODOs.

Fixed some wrong declarations for vsite code.

3 years agoRelease configs were using a wrong build type
Mark Abraham [Fri, 31 Jul 2020 08:33:34 +0000 (08:33 +0000)]
Release configs were using a wrong build type

(cherry picked from commit a2820e3e34abb71564edfd9dff63f7d29a562971)

3 years agoRelease configs were using a wrong build type
Mark Abraham [Fri, 31 Jul 2020 08:33:34 +0000 (10:33 +0200)]
Release configs were using a wrong build type

3 years agoMove foreign potential energy accumulation
Berk Hess [Fri, 31 Jul 2020 08:47:03 +0000 (08:47 +0000)]
Move foreign potential energy accumulation

The potential energy contributions to the foreign lambda
Hamiltonian differences were summed in sum_dhdl() which meant
that the foreign energy differences were not complete when
do_force() returns. Now there are summed in
accumulatePotentialEnergies() which is called instead of sum_epot().

Also consistently changed the lambda vector to ArrayRef in the force
routines and made it const.

3 years agoMove sources for libgmxapi.
M. Eric Irrgang [Thu, 30 Jul 2020 14:17:53 +0000 (17:17 +0300)]
Move sources for libgmxapi.

Sources in src/api/cpp exclusively supported the public libgmxapi
interface whose headers now live in api/include/gmxapi. The sources are
not coupled to anything in src/gromacs or src, and have been moved to
api/cpp/gmxapi to better enforce this decoupling.

Currently, the unit tests for this code still rely on infrastructure in
src/ and cannot yet be moved.

Refs #3152

3 years agoRemove disabled test for superseded feature.
M. Eric Irrgang [Thu, 30 Jul 2020 10:02:32 +0000 (13:02 +0300)]
Remove disabled test for superseded feature.

3 years agoIgnore a generated file.
M. Eric Irrgang [Thu, 30 Jul 2020 11:13:07 +0000 (14:13 +0300)]
Ignore a generated file.

When a Python package is configured in "develop" mode, the source
directory is treated as the installed directory, so generated package
files end up in the source tree. This change tells `git` to ignore a
generated package file that will be present in a developer's source tree
after `python setupy.py develop`.

3 years agoUse GMXAPI CMake option guard for gmxapi target declaration.
M. Eric Irrgang [Wed, 29 Jul 2020 12:48:17 +0000 (12:48 +0000)]
Use GMXAPI CMake option guard for gmxapi target declaration.

A recent change moved the declaration of the `gmxapi` CMake library
target outside of a conditional. This change isolates the initial
configuration of the CMake target and restores the option guard.

Fixes #3604.

3 years agoFix undefined behavior flagged by UBSAN
Kevin Boyd [Wed, 29 Jul 2020 11:42:59 +0000 (11:42 +0000)]
Fix undefined behavior flagged by UBSAN

Running under the UBSAN sanitizer pointed out a bunch of undefined
behavior - most of them were harmless issues in rarely taken branches,
but should still be avoided.

3 years agoRevert c++-17 features that are not supported by CUDA build
Artem Zhmurov [Wed, 29 Jul 2020 10:48:30 +0000 (10:48 +0000)]
Revert c++-17 features that are not supported by CUDA build

C++-17 is fully supported only starting from CUDA 11, which is not
required currently. This rolls back some of the changes made in
2f876de263efdf08daf160e7791434cd760ccd9b and
106b2d8ded04dbc51031022e9b11d147dccb76a3 that broke the CUDA build.
The change should be reverted once c++17 is fully supported.

Fixes #3608
Refs #3609

3 years agoRevert c++-17 features that are not supported by CUDA build
Artem Zhmurov [Wed, 29 Jul 2020 03:46:11 +0000 (03:46 +0000)]
Revert c++-17 features that are not supported by CUDA build

C++-17 is fully supported only starting from CUDA 11, which is not
required currently. This rolls back some of the changes made in
2f876de263efdf08daf160e7791434cd760ccd9b and
106b2d8ded04dbc51031022e9b11d147dccb76a3 that broke the CUDA build.
The change should be reverted once c++17 is fully supported.

Fixes #3608
Refs #3609

3 years agoFix warnings in release builds
Mark Abraham [Wed, 22 Jul 2020 11:41:55 +0000 (13:41 +0200)]
Fix warnings in release builds

These suppressions need to be issued whether or not we are adding
developer warnings.

Change-Id: I34f4353a9172674b792488e86bf001dd2e8b917c

3 years agoFix clang-tidy warning
Artem Zhmurov [Mon, 27 Jul 2020 10:38:11 +0000 (13:38 +0300)]
Fix clang-tidy warning

clang-tidy complains about comparison of int and gmx::index,
since they are of different type.

3 years agoRevert "Change builds that use failing docker containers"
Paul Bauer [Mon, 27 Jul 2020 12:34:24 +0000 (14:34 +0200)]
Revert "Change builds that use failing docker containers"

This reverts commit ff579ae821c59a4f5cc502062578ae0eab5786e6.

3 years agoFix RDTSCP handling
Mark Abraham [Mon, 27 Jul 2020 12:16:56 +0000 (12:16 +0000)]
Fix RDTSCP handling

Commit 13def2872ae5311d tried to make all builds default to using
RDTSCP, which would have broken non-x86 builds. But it also
deactivated the implementation of RDTSCP support because HAVE_RDTSCP
was left undefined. So all it did was make timing on x86 less
efficient (plus e.g. DLB effects from that).

Used GMX_RDTSCP everywhere. Only the GROMACS project depends on
thread-MPI, so it's reasonable to let a GMX symbol leak in there (and
it's easily fixed if ever needed).

3 years agoAssertion string and typo fix
Simon Christ [Fri, 24 Jul 2020 09:52:32 +0000 (09:52 +0000)]
Assertion string and typo fix

3 years agoTwo sets of coefficients for Coulomb FEP PME on GPU
Magnus Lundborg [Mon, 20 Jul 2020 10:17:02 +0000 (10:17 +0000)]
Two sets of coefficients for Coulomb FEP PME on GPU

The first patch in a series to enable running Coulomb FEP PME on GPU.
Use two sets of coefficients to store atom charges.

Refs #2054, #3117

Change-Id: Iab6eb7ac766800f7c045dc5a00069e77509d391f

3 years agoFollow up to "Separate StatePropagatorData element" (!363)
Pascal Merz [Sat, 18 Jul 2020 06:27:10 +0000 (06:27 +0000)]
Follow up to "Separate StatePropagatorData element" (!363)

StatePropagatorData, EnergyData, and FreeEnergyPerturbationData
have all been separated into a pure data class and an Element
member object. The three were intended to be following the same
design principles, but were merged in three separate MR. The
design was improved in reviews of the EnergyData and
FreeEnergyPerturbationData MRs, leaving StatePropagatorData
with some of the design flaws ironed out in the other two.
This commit adapts StatepropagatorData and its member Element
to the improved design. Specifically:

* Build the Element in the constructor of StatepropagatorData.
  To this end, the change in signature of the constructor is
  partially rolled back to have all required data available.
* The element is accessed using a simple getter method, doing
  away with building at first invocation or throwing exceptions
  when accessed more than once.

3 years agoIntroduce modular simulator exceptions
Pascal Merz [Thu, 16 Jul 2020 16:38:23 +0000 (10:38 -0600)]
Introduce modular simulator exceptions

This introduces a new base exception for modular simulator, and a
few exceptions inheriting from this base exception. Having a
modular simulator base class allows to easily add exceptions without
touching (4!) files outside the module. The introduced derived
exceptions are all used in the fulfillment of #3437. Introducing them
in a separate commit allows to keep the final commit smaller.

3 years agoAllow to compile template with gmx-lagacyapi enabled
Alexey Shvetsov [Wed, 15 Jul 2020 19:16:13 +0000 (19:16 +0000)]
Allow to compile template with gmx-lagacyapi enabled

This change allows to compile template as standalone app with installed
gromacs

Fixes #3596

Signed-off-by: Alexey Shvetsov <alexxyum@gmail.com>
3 years agoBegin moving installed interface to `api/`
M. Eric Irrgang [Wed, 15 Jul 2020 13:29:47 +0000 (16:29 +0300)]
Begin moving installed interface to `api/`

Create `api/` directory outside of `src/` to decouple the public
interface from the internal and build tree infrastructure.

Move the `gmxapi` installed headers to `api/include/gmxapi`.
The public header maintenance (once managed with custom CMake functions)
is now reduced to filesystem layout and `install` commands in
`api/CMakeLists.txt`

Deferred to future changes:
* Split public and developer doxygen builds.
* Move remaining libgmxapi public interface details to `api/gmxapi`
* Re-expose essential public facilities from libgromacs to allow
  (re-)deprecation of ENABLE_LEGACY_API.

Refs #3288

3 years agoSeparate Element from FreeEnergyPerturbationData
Pascal Merz [Thu, 11 Jun 2020 06:48:11 +0000 (00:48 -0600)]
Separate Element from FreeEnergyPerturbationData

Mirroring the StatePropagatorData and EnergyData, the free energy
element is split up into a data part that is accessed by other
elements, and a member class which implements the ISimulatorElement
to allow for updating and checkpointing of lambda values.

Refs #3437

3 years agoDivide default communicator from DD communicators
Mark Abraham [Wed, 15 Jul 2020 17:09:31 +0000 (17:09 +0000)]
Divide default communicator from DD communicators

The communicators mpi_comm_mysim and mpi_comm_mygroup inside
t_commrec got initialized in init_commrec (to MPI_COMM_WORLD
if no multisim, to a subset otherwise). These communicators
were then used in subsequent setup work, before they got
reassigned during the construction of the DDBuilder object
and the construction of the actual domain decomposition object.
Effectively, this means that the same communicators (and, hence,
identical function calls) do very different things depending on
whether they get used before or after the setup of domain
decomposition. It also means that before DD set up, mpi_comm_mysim
and mpi_comm_mygroup are *identical*.

This change introduces an additional communicator within
t_commrec, mpiDefaulCommunicator, which helps to make these
implicit assumptions explicit. Consequently, this also redefines
PAR(cr), MASTER(cr), and SIMMASTER(cr).

This change will allow to move the sim and group communicators,
which are now only created at DD time, into the DD object,
logically separating the DD object from t_commrec.

Refs #2395

3 years agoFix the suspicious string literal error in GPU status description
Artem Zhmurov [Wed, 15 Jul 2020 16:05:08 +0000 (16:05 +0000)]
Fix the suspicious string literal error in GPU status description

Fixes clang-tidy error, introduced by broken string in
d2ba568ac6d5d3b6a1ef996618a1367307872d03

3 years agoSeparate energy data and element
Pascal Merz [Tue, 14 Jul 2020 13:27:20 +0000 (13:27 +0000)]
Separate energy data and element

The EnergyElement was both holding data which is accessed by
a majority of the elements, and was an element itself. The element
part is needed to update the energy records and save data for
trajectory writing.
The double nature of the EnergyElement created some difficulty in
initializing the elements, however - the EnergyElement
has a well defined place within the simulator loop, but has to be
created ahead of time so that other elements can get a pointer to it
to query for or save energy data during the simulation run.

This change separates the ISimulatorElement implementation which
allows EnergyElement to take part in the simulation loop
into a member object. The data part of the EnergyElement is renamed
to EnergyData, the element is EnergyData::Element. The EnergyData
can now be created ahead of element construction time, while an
object of the member class can be created later. This will make the
implementation of a builder approach significantly easier.
The life time of the element is managed by the EnergyData object to
avoid problematic life time dependencies between the two.

Refs #3437

3 years agoCMake: add OpenMP detection to exported target
Christoph Junghans [Sun, 12 Jul 2020 20:53:03 +0000 (14:53 -0600)]
CMake: add OpenMP detection to exported target

3 years agoFix libgromacs CMake target install syntax.
M. Eric Irrgang [Sat, 11 Jul 2020 20:31:45 +0000 (20:31 +0000)]
Fix libgromacs CMake target install syntax.

Fixes #3592

3 years agocmake: export cxx standard
Christoph Junghans [Sat, 11 Jul 2020 16:32:07 +0000 (16:32 +0000)]
cmake: export cxx standard