alexxy/gromacs.git
4 years agoAdd haveCpuLocalForces flag to DomainLifetimeWorkload
Artem Zhmurov [Tue, 22 Oct 2019 18:30:22 +0000 (20:30 +0200)]
Add haveCpuLocalForces flag to DomainLifetimeWorkload

The flag haveCpuLocalForces is moved to DomainLifetimeWorkload.
The name and meaning is also slightly changed, haveCpuLocalForceWork
now now indicates whether any forces in the local domain are computed
on the CPU.
Consequently, the currently redundant PME f reduction conditional has
been removed from the haveCpuLocalForceWork initialization. The
relationship between local force work and existence of local forces on
the CPU however needs to be clarified in relationship to #3160 and how
the PP-PME direct communication is improved/simplified.

Change-Id: Idaed4da41bf5b72435c47bab8aeb7130b36b03c7

4 years agoExtend SimulationWorkload with CPU flags
Szilárd Páll [Wed, 23 Oct 2019 17:17:46 +0000 (19:17 +0200)]
Extend SimulationWorkload with CPU flags

Added flags for PME and Nonbondeds to indicate whether there is CPU
workload; this is useful as the lack of GPU work does not imply the
existence of CPU work.

Also made createSimulationWorkload() take the PME runmode class enum
instead of a bunch of bools.

Made some naming consistency improvements.

Refs #3181

Change-Id: I66233f1c790fc5092fb1babaed2ec3ebf16416de

4 years agoAllow using update flag
Artem Zhmurov [Fri, 18 Oct 2019 13:26:36 +0000 (15:26 +0200)]
Allow using update flag

When update flag was re-enabled, the assertion was not removed.

Change-Id: Idd1b3e0d9ff60209918281aea23588f90806b898

4 years agoUpdate bundled pybind.
M. Eric Irrgang [Thu, 24 Oct 2019 15:12:56 +0000 (18:12 +0300)]
Update bundled pybind.

Update the pybind11 headers from the 2.4.3 tag. Addresses Python C API
updates from the Python 3.8.0 release.

Refs #3175

Change-Id: Ib1380b272aa061f475cd18fa78da5cef131a2998

4 years agoFix CMake message typo.
M. Eric Irrgang [Sat, 26 Oct 2019 08:53:22 +0000 (11:53 +0300)]
Fix CMake message typo.

Verb need 's'.

Change-Id: Iec27a9fe8540c3a8db68f85769f9965937bb0924

4 years agoEnable forced rotation for modular simulator
Pascal Merz [Thu, 24 Oct 2019 20:04:23 +0000 (14:04 -0600)]
Enable forced rotation for modular simulator

Forced rotation was currently disabled (without being checked for)
with the modular simulator. There is no reason to do so, as the
enforced rotation does not require any new element or communication
between elements.

Change-Id: I057935cbaeaedfde751ca26ba11fb7c990b23efe

4 years agoImprove gmxapi mdrun test.
M. Eric Irrgang [Thu, 24 Oct 2019 13:57:22 +0000 (16:57 +0300)]
Improve gmxapi mdrun test.

* Tweak the pytest logging output to be more useful.
* Do not test for trajectory file output for MPI workers that had
  no ensemble simulation members.

Resolves a false error from test_run_from_read_tpr_op when running
pytest under mpiexec.

Change-Id: Iea601570a51da325cbb5be1615f2fc738af4554c

4 years agoAdd bool useDomainDecomposition in mdrunner
Berk Hess [Thu, 24 Oct 2019 17:36:45 +0000 (19:36 +0200)]
Add bool useDomainDecomposition in mdrunner

Change-Id: I0a320a33aef2a118a188358f7df6ab0f00aa2e13

4 years agoAdd gmx_mtop_interaction_count()
Berk Hess [Thu, 24 Oct 2019 17:21:31 +0000 (19:21 +0200)]
Add gmx_mtop_interaction_count()

Change-Id: Ia40990517cc5fa902100ba4d185b3d3211d312cd

4 years agoFix initializers in locality.h
Berk Hess [Thu, 24 Oct 2019 17:05:48 +0000 (19:05 +0200)]
Fix initializers in locality.h

Change-Id: I6b0e3066401e5e23a4923e4de87c2e4326d37297

4 years agoMove locality.h from nbnxm to mdtypes
Berk Hess [Wed, 9 Oct 2019 11:57:07 +0000 (13:57 +0200)]
Move locality.h from nbnxm to mdtypes

Removed duplicate definition of AtomLocality from
StatePropagatorDataGpu.

Change-Id: I79aa415dd6fc91791d0cc54dc07d7c56e9b7c874

4 years agoUse gmx::Range in Nbnxm gridding functions
Berk Hess [Wed, 23 Oct 2019 09:00:24 +0000 (11:00 +0200)]
Use gmx::Range in Nbnxm gridding functions

Change-Id: Ice818946dc78375065797056762acd340921ea70

4 years agoSuppress some output when sample_restraint is built with GROMACS.
M. Eric Irrgang [Wed, 16 Oct 2019 15:22:04 +0000 (18:22 +0300)]
Suppress some output when sample_restraint is built with GROMACS.

The install target for the sample_restraint plugin package is
disabled when built for testing as part of a GROMACS build, which made
a CMake status message confusing.

Change-Id: I235f879b50cf04092a8fc40a6c5e4722ffa108bf

4 years agoMake t_nextnb an implementation detail
ejjordan [Mon, 21 Oct 2019 09:11:47 +0000 (11:11 +0200)]
Make t_nextnb an implementation detail

This change moves the t_nextnb struct completely inside
of gen_excl and gen_pad. This makes changing the underlying
data structure easier.

Change-Id: I643025ff9e572849e7e1aaedab1484a1609fe7db

4 years agoSlight improvements to decideWhetherToUseGpuForUpdate(...)
Artem Zhmurov [Tue, 22 Oct 2019 11:54:55 +0000 (13:54 +0200)]
Slight improvements to decideWhetherToUseGpuForUpdate(...)

1. The boolean is passed for vsites instead of entire mdatoms structure.
2. Arguments are taken as const.
3. Whether or not the position/orientation restraints are enabled is now
   taken from topology.

Change-Id: I9d299b5e46c39af07a17af1a639907d1dd11a9bc

4 years agoExpand documentation for nbnxn_put_on_grid()
Berk Hess [Wed, 23 Oct 2019 08:27:54 +0000 (10:27 +0200)]
Expand documentation for nbnxn_put_on_grid()

Change-Id: Id6349848d9d03215632cf23e59a556f4e40327fb

4 years agoCorrect for skewed box before domain decomposition (modular simulator)
Pascal Merz [Tue, 22 Oct 2019 22:05:07 +0000 (16:05 -0600)]
Correct for skewed box before domain decomposition (modular simulator)

The correction for skewed boxes before domain decomposition is done
in the legacy code, but was missing in the modular simulator.

Change-Id: I202629c1b546247c64b09e491cfb09db402ca1b1

4 years agoEnable GPU Peer Access in GPU Utilities
Alan Gray [Wed, 4 Sep 2019 12:41:21 +0000 (05:41 -0700)]
Enable GPU Peer Access in GPU Utilities

When using the new GPU communication features, enabling peer access
between pairs of GPUs (where supported) will allow peer-to-peer
communications. In this patch the CUDA code to enable peer access is
introduced into central GPU utilities and called from do_md.

Implements #3087

Change-Id: If668366b76d49f7b624eedb501f8af19135c4386

4 years agoFix log writing (modular simulator)
Pascal Merz [Wed, 23 Oct 2019 00:32:47 +0000 (18:32 -0600)]
Fix log writing (modular simulator)

The current implementation would not write energies to log if
- log was not in sync with energy writing, or
- log writing is more frequent than neighborsearching.

This commit fixes these bugs, restoring the legacy behavior. Moving
forward, it could be discussed whether writing to log file and writing
to energy trajectory could be coupled (i.e., should log writing frequency
be a multiple of energy writing?).

Fixes #3151

Change-Id: Icb12ecd7c9aedb29138a9a17fb6d130c4f23a06a

4 years agoAdapt enum to style convention (modular simulator)
Pascal Merz [Tue, 22 Oct 2019 23:09:21 +0000 (17:09 -0600)]
Adapt enum to style convention (modular simulator)

This capitalizes the values of two enums within the modular simulator
framework (EnergySignallerEvent and TrajectoryEvent) in accordance
with the style conventions.

Change-Id: Iecd8e4ece43eee37ee7b3315ec65d86bb04f1feb

4 years agoSmall improvement to EnergyElement (modular simulator)
Pascal Merz [Tue, 22 Oct 2019 22:59:36 +0000 (16:59 -0600)]
Small improvement to EnergyElement (modular simulator)

This avoids registering energy and trajectory callbacks on
non-master ranks, as the result is never used. This also renames
isMaster_ to isMasterRank_ for consistency with other uses.

Change-Id: I364bbe73bf7d8ff3c6789d15e54603d3bd7f221b

4 years agoRemove unnecessary CUDA stream synchronization calls
Artem Zhmurov [Sun, 20 Oct 2019 13:30:30 +0000 (15:30 +0200)]
Remove unnecessary CUDA stream synchronization calls

These calls were needed before the synchronization was re-introduced.
With the event-based synchronization in place, they are no longer
necessary.

Change-Id: I9507432b40962cd49e4fc7374f15530c7fbf2ae7

4 years agoFix stop condition handling (modular simulator)
Pascal Merz [Tue, 22 Oct 2019 17:40:26 +0000 (11:40 -0600)]
Fix stop condition handling (modular simulator)

Fixes a bug that would signal the stop condition repeatedly when
the second SIGINT was received, effectively keeping the simulation
from stopping by repeatedly delaying the last step to the following
step.

Change-Id: Ie0de7b893ff53ccb09e285cb1b84e01594f581d5

4 years agoFix signal propagation (modular simulator)
Pascal Merz [Tue, 22 Oct 2019 17:35:51 +0000 (11:35 -0600)]
Fix signal propagation (modular simulator)

In the modular simulator, signals between ranks were not reduced by
compute globals. This disabled the processing of SIGINT and might
have influenced checkpointing.

Change-Id: Idebe3c80f796c41cfdb12922c26c4920ca8d9d20

4 years agoRemove unused functions from gmxpreprocess
ejjordan [Tue, 22 Oct 2019 14:12:40 +0000 (16:12 +0200)]
Remove unused functions from gmxpreprocess

Change-Id: I1f635dcc2f534d5be0de30eaace32b561da3c13c

4 years agoRename havePositionRestraints(...) to haveRestraints(...)
Artem Zhmurov [Tue, 22 Oct 2019 13:47:59 +0000 (15:47 +0200)]
Rename havePositionRestraints(...) to haveRestraints(...)

This function checks if there are  position, distance or orientation
restraints in the system, so the havePositionRestraints(...) name
is misleading.

Change-Id: I9ffaa1ff68172c2227780492577ab1d8626a23f6

4 years agoRequire -ei for essential dynamics
Berk Hess [Tue, 22 Oct 2019 09:33:20 +0000 (11:33 +0200)]
Require -ei for essential dynamics

Essential dynamics sampling was switching on by either the -ei
option or by ED information being present in the checkpoint file.
As this complicates initialization and we should not choose
algorithms based on a checkpoint, it is now only switched on
by the -ei option (but an mdp option is we actually want).

Change-Id: I6e0873a38ee42779d09f66ed7e55c6d1b8bf25da

4 years agoFix nst in density-fitting module
Christian Blau [Tue, 22 Oct 2019 13:44:15 +0000 (15:44 +0200)]
Fix nst in density-fitting module

An error in the nst variable led to forces from density-guided
simulations to be applied every step, because its internal step
counter would stay at 0.

Change-Id: Ib8b33b407bfe9c56bab497f7e2d505843675afca
refs: #2282

4 years agoFix DomDec step (modular simulator)
Pascal Merz [Mon, 21 Oct 2019 20:13:46 +0000 (14:13 -0600)]
Fix DomDec step (modular simulator)

Domain decomposition was mistakenly using the initial step for
the entire run with modular simulator.

Change-Id: I1a6a56c91e3e381bf3aa0e1de1d41b16f19a6634

4 years agoFix PmeLoadBalanceHelper initialization (modular simulator)
Pascal Merz [Mon, 21 Oct 2019 21:25:58 +0000 (15:25 -0600)]
Fix PmeLoadBalanceHelper initialization (modular simulator)

PmeLoadBalanceHelper could be initialized before the state had a
valid box. Fixed the initialization order and added comments and
assert to avoid this error to creep back in.

Change-Id: I7b59011d6e1d532543a1d1463eceacfcdc148557

4 years agoRemove unused function generate_excls and make clean_excls static
ejjordan [Mon, 21 Oct 2019 16:08:07 +0000 (18:08 +0200)]
Remove unused function generate_excls and make clean_excls static

Change-Id: I9bd742da2032f0f7d9ce19bd71df6a87c881e6e1

4 years agoRemove unsupported configs from the gpuupdate matrix
Szilárd Páll [Mon, 21 Oct 2019 16:26:01 +0000 (18:26 +0200)]
Remove unsupported configs from the gpuupdate matrix

GPU update is not supported with domain decomposition and due to the
fallback paths being triggered these cases would anyway test GPU buffer
ops only which can already be tested with the gpubufferops matrix.

These configs can be re-enabled when the respective use-cases get
enabled in the future.

Change-Id: Ic65e118b05fa21683069fbffa19ad7285c27cdf4

4 years agoOverride GMX_GPU_DD_COMMS if nonbondeds are off
Szilárd Páll [Tue, 15 Oct 2019 17:19:34 +0000 (19:19 +0200)]
Override GMX_GPU_DD_COMMS if nonbondeds are off

It is not useful to have environment variables force dev features
on when a hard dependency, here the nonbonded offload, is not enabled
in a run. This override should make it easier to pass tests.

Change-Id: I58898fc4ea55454d74bc0e7fb1121eab2c66d84c

4 years agoUpdate the copyright message
Artem Zhmurov [Mon, 21 Oct 2019 09:42:14 +0000 (11:42 +0200)]
Update the copyright message

1. Add Artem Zhmurov to the list of contributors.
2. Update the copyright year.

Change-Id: Ic7d19acd58d123e8a5f1a91c3191fbdaa26db787

4 years agoAdd environment variable that changes the meaning of '-update auto'
Artem Zhmurov [Fri, 18 Oct 2019 15:17:06 +0000 (17:17 +0200)]
Add environment variable that changes the meaning of '-update auto'

This change creates 'GMX_FORCE_UPDATE_DEFAULT_GPU', that changes the
default behavior of '-update' option to 'gpu'. Also changed the
gpuupdate Jenkins trigger to set this environment variable.

Refs. #3163.

Change-Id: I4463de3266d97c5f91bac65d3d997cf564e6e880

4 years agoGPU Coordinate PME/PP Communications
Alan Gray [Fri, 6 Sep 2019 07:00:12 +0000 (00:00 -0700)]
GPU Coordinate PME/PP Communications

Extends PmePpCommGpu class to provide PP-side support for coordinate
transfers from either GPU or CPU to PME task, and adds new
PmeCoordinateReceiverGpu class to recieve coordinate data directly to
the GPU on the PME task.

Implements part of #2817
Refs TODOs #3157 #3158 #3159

Change-Id: Iefa2bdfd9813282ad8b07feeb7691f16880e61a2

4 years agoAdd trajectory output to mdrun operation.
M. Eric Irrgang [Wed, 2 Oct 2019 13:53:52 +0000 (16:53 +0300)]
Add trajectory output to mdrun operation.

Fixes #3144

Change-Id: Ic9e1eb988bc9c934eb8e9cd6009008e6e60d8342

4 years agoGPU Receive for PME/PP GPU Force Communications
Alan Gray [Sat, 31 Aug 2019 18:20:52 +0000 (11:20 -0700)]
GPU Receive for PME/PP GPU Force Communications

This change extends the PME/PP GPU force communication functionality
to allow the force buffer to be recieved direct to GPU memory on the
PP task.

Implements part of #2817
Refs #3158 #3159

Change-Id: I5b1cff1846c7c3bd966b6bf9c0af72769600ef18

4 years agoAdd strict assertions on x synchronizer in PME
Szilárd Páll [Tue, 15 Oct 2019 10:57:39 +0000 (12:57 +0200)]
Add strict assertions on x synchronizer in PME

To be able to add strict assertions on when a valid event synchronizer
needs to be passed to PME, a new booean is stored in the PME GPU data
structures indicating whether execution is happening on a separate PME
rank.

Also clarified some function argument doxygen.

Change-Id: Ic141c70dded2b57f39b7f2e2bfa1a17d80604204

4 years agoManual entry and .mdp option for adaptive force scaling
Christian Blau [Thu, 17 Oct 2019 11:36:13 +0000 (13:36 +0200)]
Manual entry and .mdp option for adaptive force scaling

Adds a manual entry and extends the mdp option section to describe the
adpative force scaling parameters.

refs #2282

Change-Id: Ifb2e4af256282340f1111262f91e5d73d93c3208

4 years agoFix genion clang-8 warning
Szilárd Páll [Fri, 18 Oct 2019 18:41:21 +0000 (20:41 +0200)]
Fix genion clang-8 warning

Commit 00c05bb switching to clang-tidy 8 was not based on the latest
master and went in without flagging a recently introduced warning.

This fixes the warning also fixing master presubmit.

Change-Id: If193a376f6f0c79bb004ef5775d404d71c5b6f10

4 years agogenion: prohibit ion placement close to non-solvent
Christian Blau [Wed, 16 Oct 2019 14:45:39 +0000 (16:45 +0200)]
genion: prohibit ion placement close to non-solvent

Changes behaviour of genion so that "-rmin" does not only account for
distances between ions but everything that is not in the selected
solvent group.

Avoids unwanted replacement of crystal water ions in proteins and
very close placement of ions to proteins.

Change-Id: Ieb82352fac044ceae2f0d55504dcdf40305b9a61

4 years agoUse clang-tidy-8
Paul Bauer [Thu, 17 Oct 2019 15:05:54 +0000 (17:05 +0200)]
Use clang-tidy-8

Change-Id: I208eddb4903d45547c39e9dcb9b45a30753e6958

4 years agoRemove excessive H2D and D2H coordinates copies when update is offloaded
Artem Zhmurov [Wed, 16 Oct 2019 14:33:31 +0000 (16:33 +0200)]
Remove excessive H2D and D2H coordinates copies when update is offloaded

The H2D copies are only needed:
1. When update is not ofloaded.
2. At the search steps, after device buffers were reinitialized.

The D2H copies are only needed:
1. On the search steps, since the device buffers are reinitialized.
2. If there are CPU consumers, e.g. CPU bondeds.
3. When the energy is computed.
4. When coordinates are needed for output.

There are two special cases, when coordinates are needed on host,
that dealt with separately:
1. When the PME it tuned.
2. When center of mass motion is removed.

The locality of copied atoms when update is offloaded is changed
from All to Local in preparation for multi-GPU case. The blocking sync
on H2D copy event is moved from UpdateConstraints to
StatePropagatorDataGpu.

Change-Id: I971a6273b39fa7da07600312c085ce343b5d25ee

4 years agoUpdate grompp cutoff-scheme warnings
Berk Hess [Fri, 18 Oct 2019 05:39:38 +0000 (07:39 +0200)]
Update grompp cutoff-scheme warnings

As the group cutoff scheme has been removed, it is confusing for
the user to complain about the cutoff-scheme option not being set.
Also updated warning messages that said that things don't work witj
the Verlet cut-off scheme.

Change-Id: Ie73a6cde90ac963c82ed15e51a19169e7eb948f0

4 years agoBasic refactoring genion and adding test
Christian Blau [Thu, 17 Oct 2019 12:41:42 +0000 (14:41 +0200)]
Basic refactoring genion and adding test

Adding a test and refactoring genion so that is passes memory checks.
Needed as a base for changed functionality.

Change-Id: Ie6408bb031cb40f6d74faa17a316a81fb8661289

4 years agoRemove excessive H2D and D2H copies of velocities when update is offloaded
Artem Zhmurov [Wed, 16 Oct 2019 11:33:18 +0000 (13:33 +0200)]
Remove excessive H2D and D2H copies of velocities when update is offloaded

If update is offloaded:

The H2D copy of velocities is done:
1. At the search step after the device buffers were reinitialized.

The D2H copy is done:
1. In the beginning of the step on search steps (to back up before the
   device buffers are reinitialized).
2. In the beginning of the velocity output step.
3. After update when globals are computed.
4. After update when temperature is needed for the next step.

The Local locality is used for the copies when update is offloaded in
anticipation of the multi GPU case.

The REMD simulations are now not supported when update is offloaded.

Change-Id: Ifbb9636cafba8980a4a781d942420c5c2c1bcdfd

4 years agoAdaptive force scaling for densityfitting
Christian Blau [Tue, 24 Sep 2019 14:32:28 +0000 (16:32 +0200)]
Adaptive force scaling for densityfitting

Scales the force adaptively for density-guided-simulations

refs #2282

Change-Id: I96310f498cf2fae9f7385a9396f1253b760d135e

4 years agoFix clang-tidy warnings in gpuhaloexchange_impl.cuh
Szilárd Páll [Thu, 17 Oct 2019 14:20:29 +0000 (16:20 +0200)]
Fix clang-tidy warnings in gpuhaloexchange_impl.cuh

Change-Id: Ifdbe7809c1f37808ed29d89253d1fb786c0c5ae7

4 years agoEliminate spurious GPU->CPU copy
Szilárd Páll [Tue, 15 Oct 2019 22:44:59 +0000 (00:44 +0200)]
Eliminate spurious GPU->CPU copy

When GPU direct communication-based halo exchange is used, non-local
forces should not be copied back to the CPU prior to halo exchange.
This commit removes the incorrectly unconditional leftover copy.

Fixes/Improves #2890
Refs #3156
Change-Id: I25e521204f30da1e257232e9117c3fe4f0a83b08

4 years agoDisable GMX_GPU_PME_PP_COMMS if PME is not offloaded
Szilárd Páll [Tue, 15 Oct 2019 00:47:21 +0000 (02:47 +0200)]
Disable GMX_GPU_PME_PP_COMMS if PME is not offloaded

Change-Id: I54ba9015fd95a1c74bdcb23257a6d2b40dd4872d

4 years agoExponential moving average
Christian Blau [Tue, 24 Sep 2019 14:33:13 +0000 (16:33 +0200)]
Exponential moving average

Evaluate the exponential moving average of a quantity.

Change-Id: I80747f7a76366ba64b2c4e1bd149834644d7709b

4 years agoFix initialization of field in PME data structure
Szilárd Páll [Tue, 15 Oct 2019 23:30:12 +0000 (01:30 +0200)]
Fix initialization of field in PME data structure

The bPPRank field that indicated whether the rank had PP duryt as well
was not always initialized leading to a spurious trigger in a recently
added assertion.

Change-Id: Id9700c4318e01781da0a0c63323025f2525e58b6

4 years agoMinor tidying to mdrun.py
M. Eric Irrgang [Thu, 12 Sep 2019 07:49:47 +0000 (10:49 +0300)]
Minor tidying to mdrun.py

Rearrange and annotate some code in gmxapi.simulation.mdrun prior to
functional additions.

Change-Id: If9efefce8f75681fbaa1c615d96e355a5650eedc

4 years agoMinor clean-up to gmxapi package.
M. Eric Irrgang [Thu, 26 Sep 2019 12:17:49 +0000 (15:17 +0300)]
Minor clean-up to gmxapi package.

* Resolve some linting warnings and potential import ambiguities.
* Apply recommended pybind iteration mechanism for Python objects.
* Remove some extraneous syntax and imports.
* Make explicit a call that relied on positional argument processing.
* Alias an imported name (Future) to avoid namespace collision.
* Normalize initialization of DataSourceCollection.
  * Make sure that initialization at construction uses the same setter
    code path as subscripted assignment on the object instances.
  * Add ResultDescription to gmxapi.operation.Future.

Change-Id: Ia687929302edd85a0af616b1d947db21e2f3876e

4 years agoLink GPU force producer and consumer tasks
Artem Zhmurov [Mon, 14 Oct 2019 20:58:08 +0000 (22:58 +0200)]
Link GPU force producer and consumer tasks

The GPU event synchronizer that indicates that forces are ready
for a consumption is now passed to the GPU update-constraints.
The update-constraints enqueue a wait on the event in the update
stream before performing numerical integration and constraining.
Note that the event is conditionally returned by the
StatePropagatorDataGpu and indicates that either the reduction of
forces on the GPU or the H2D copy is done, depending on offload
scenario on a current timestep.

Refs. #2816, #2888, #3126.

Change-Id: Ic12b0c55b75ec5f0c31ce500a2760fb4d5cf3b91

4 years agoUpdate gmxapi.version module.
M. Eric Irrgang [Sat, 12 Oct 2019 13:12:48 +0000 (16:12 +0300)]
Update gmxapi.version module.

* Improve documentation about `has_feature` optional exception behavior.
* Normalize to FeatureNotAvailableError.
* Describe transitions of named features into the version specification.

Refs #3130

Change-Id: Iea6ba1b9cc3cf1b1ef6de71cd8ae5d9c593146c3

4 years agoMake the wait on nonbonded GPU results conditional
Szilárd Páll [Fri, 27 Sep 2019 17:21:01 +0000 (19:21 +0200)]
Make the wait on nonbonded GPU results conditional

When the force reduction is done on the GPU and there are no energy or
shift force results required, there is no need to block and wait on the
CPU until the GPU nonbonded kernels complete.
This change makes the wait conditional on whether there are nonbonded
force, energy or shift force outputs so the blocking wait is now skipped
with GPU buffer ops on force-only steps.

Also removed the now unnecessary boolean argument passed to
gpu_launch_cpyback().

Refs #3128

Change-Id: Ic1285f5a00ac910cd1d6c4358f41f2c7c41dea4c

4 years agoTrigger synchronizer when local forces are ready
Szilárd Páll [Mon, 14 Oct 2019 17:19:03 +0000 (19:19 +0200)]
Trigger synchronizer when local forces are ready

The sycnhronizer is created and managed in StatePropagatorDataGpu and is
passed to the nonbonded mdoule at the f buffer ops init.

Refs #2888 #3126

Change-Id: Ie9bf0b6cd8511fe282e377e48f3940e591db214c

4 years agoPME/PP GPU Pimpl Class and GPU->CPU Communication for force buffer
Alan Gray [Sun, 25 Aug 2019 19:42:47 +0000 (12:42 -0700)]
PME/PP GPU Pimpl Class and GPU->CPU Communication for force buffer

Activate with GMX_GPU_PME_PP_COMMS env variable

Implements new pimpl class for PME-PP GPU communications. Performs
scatter of force buffer data from PME task GPU buffer to PP task CPU
buffers directly using CUDA memory copies. Requires thread MPI to be
in use.

Implements part of #2891

Change-Id: I0181ff67065c75f20cddc361f695df9bf888cd88

4 years agoFix the single-GPU update-constraints
Artem Zhmurov [Mon, 14 Oct 2019 21:36:20 +0000 (23:36 +0200)]
Fix the single-GPU update-constraints

This is a temporary fix to make it work. Better solutions are in other patches.

1. The getter for the update stream returned the stream itself instead of a
   pointer to it.
2. The copy stream for forces with AtomLocality:All set to updateStream.

Change-Id: I02b15beddebc160f2fe4fc21da64975977855699

4 years agoFix logic error in StaticSourceManager intialization.
M. Eric Irrgang [Mon, 14 Oct 2019 09:27:30 +0000 (12:27 +0300)]
Fix logic error in StaticSourceManager intialization.

`dict` inputs are Iterable, but are not the sort of sequence type that
we were trying to catch as ambiguous (in terms of data shape).

Change-Id: I71b79c7389197a0750d21874bf6f7cb3fef7721b

4 years agoLink GPU coordinate producer and consumer tasks
Szilárd Páll [Thu, 10 Oct 2019 16:10:38 +0000 (18:10 +0200)]
Link GPU coordinate producer and consumer tasks

The event synchronizer indicating that coordinates are ready in the GPU
is now passed to the two tasks that depend on this input: PME and
X buffer ops. Both enqueue a wait on the passed event prior to kernel
launch to ensure that the coordinates are ready before the kernels
start executing.

On the separate PME ranks and in tests, as we use a single stream,
no synchronization is necessary.

With the on-device sync in place, this change also removes the
streamSynchronize call from copyCoordinatesToGpu.

Refs. #2816, #3126.

Change-Id: I3457f01f44ca6d6ad08e0118d8b1def2ab0b381b

4 years agoAdd note about libpython requirement to gmxapi install docs.
M. Eric Irrgang [Thu, 26 Sep 2019 12:35:26 +0000 (15:35 +0300)]
Add note about libpython requirement to gmxapi install docs.

Change-Id: I0f6a3187412a6257b1b981c91e29954fbec46120

4 years agoAdd generic check for gmxapi support library to Python package build.
M. Eric Irrgang [Thu, 26 Sep 2019 12:34:20 +0000 (15:34 +0300)]
Add generic check for gmxapi support library to Python package build.

Change-Id: I5a84407665d4f66b97f02338126a620a0c88ffb4

4 years agoConst correctness for genhydro
Berk Hess [Mon, 14 Oct 2019 16:30:43 +0000 (18:30 +0200)]
Const correctness for genhydro

Change-Id: I59f018a817046202209c37905e5cfb6dd359073b

4 years agoFix bug in preprocessing
Paul Bauer [Mon, 14 Oct 2019 10:00:06 +0000 (12:00 +0200)]
Fix bug in preprocessing

Use of wrong vector caused out of bounds access.

Fixes #3129

Change-Id: I913c850a638f80d9d8d24708dc30170f448bc36c

4 years agoAdd separate constructor to StatePropagatorDataGpu for PME-only rank / PME tests
Artem Zhmurov [Thu, 10 Oct 2019 16:48:30 +0000 (18:48 +0200)]
Add separate constructor to StatePropagatorDataGpu for PME-only rank / PME tests

A separate constructor is added to the StatePropagatorDataGpu to use in the
separate PME rank and in PME tests. These use the provided stream to copy
coordinates for atom with Local or All localities. Copy of coordinates for
non-local particles as well as copy operations for the forces and velocities
are not allowed by assertions.

Refs. #3126.

Change-Id: I66aeeaea54931398b1a4a30b920b092f7d40ae16

4 years agoFix logic error in gmxapi.version.api_is_at_least().
M. Eric Irrgang [Sun, 13 Oct 2019 12:11:08 +0000 (15:11 +0300)]
Fix logic error in gmxapi.version.api_is_at_least().

Change-Id: I15707471a350ba908d0725e54a097bfa288fcdb7

4 years agoEnsure environment variable use does not give warnings
Mark Abraham [Sun, 13 Oct 2019 12:58:58 +0000 (14:58 +0200)]
Ensure environment variable use does not give warnings

The ARM GCC 5 builds give false positive warnings that we should be
using the values returned from getenv.

Change-Id: I64734098d6a030124d75051905f0c96dc497c00b

4 years agoEnable StatePropagatorGpuData for force transfers
Szilárd Páll [Thu, 10 Oct 2019 20:20:40 +0000 (22:20 +0200)]
Enable StatePropagatorGpuData for force transfers

Force transfers have been switched to use StatePropagatorGpuData already
before. This change updates the synchronization mechanisms as:
- replaces the previous stream sync after GPU buffer/ops reduction with
  a waitForcesReadyOnHost call;
- removes the barriers in copyForces[From|To]Gpu() as dependencies
  are now satisfied: most dependencies are intra-stream and therefore
  implicit, the exception being the halo exchange that uses its own
  mechanism to sync H2D in the local stream with the nonlocal stream
  (which is yet to be replaces Refs #3093).

Refs. #3126.

Change-Id: I8bfd39f79c87f20492c4ae287d6f19261724f806

4 years agoUpdate sample_restraint documentation entry points.
M. Eric Irrgang [Wed, 17 Jul 2019 11:43:26 +0000 (14:43 +0300)]
Update sample_restraint documentation entry points.

TODO:
* After beta 2, we can add some new permalinks for web-based
* there are a few other "to do"s noted in the updated README files.

Change-Id: Ib875cef05ab9351237a6da99c4bd1ae8d32994d5

4 years agoMove buffer ops / PME F reduction flags into StepWorkload
Szilárd Páll [Wed, 9 Oct 2019 00:53:24 +0000 (02:53 +0200)]
Move buffer ops / PME F reduction flags into StepWorkload

Also moved overrides conditions for when buffer ops can not be offloaded
into the DevelopmentFeatureFlags data structure initialization, the
initialization of which had to be shifted so this code can be passed the
task assigment decision on nonbonded offload.

Change-Id: Ib6850bcf306a70bbd9557cf2d5c2b1e39159e566

4 years agoTest float and int gmxapi parameter updates.
M. Eric Irrgang [Thu, 10 Oct 2019 10:28:47 +0000 (13:28 +0300)]
Test float and int gmxapi parameter updates.

Also updates the spc_water_box test fixture resource to specify an
exactly representable time step.

Change-Id: I5691be2041cd769585b98638ba4b29473752ba1d

4 years agoUsability updates for gmxapi/docs Docker image.
M. Eric Irrgang [Wed, 11 Sep 2019 07:49:26 +0000 (10:49 +0300)]
Usability updates for gmxapi/docs Docker image.

* Allow specifying a tagged version of gmxapi/ci-mpich to build on.
  Updates like Change-Id: I9f67d46aa93fb789825cb78cc2a95b24f7dfccaa
  cause incompatibilities between docs.dockerfile and its base image.
* Update recommended docker command line. The `-t` flag is not
  necessary, and may allow spurious terminal control signals to confuse
  the Apache web server, causing it to exit with a message like
  `caught SIGWINCH, shutting down gracefully`

Change-Id: I27e7af82bf9ab252e3b30a803d4df36187579d4b

4 years agoCentralize management of forces ready on GPU event
Artem Zhmurov [Thu, 10 Oct 2019 16:03:11 +0000 (18:03 +0200)]
Centralize management of forces ready on GPU event

This change adds the GpuEventSynchronizer for the forces reduced on GPU event
to the StatePropagatorDataGpu. This event should be marked if the buffer ops
are offloaded when the force reduction is done. The consumers of of the forces
on the GPU will get this event or the event on the H2D copy is done,
depending on the current step workload and offload scenario.

Change-Id: Ib559dbed5ad777eac3a906e4ee0ebaa07caf0ac1

4 years agoChange copy mode to Async in PME only rank
Artem Zhmurov [Thu, 10 Oct 2019 17:28:50 +0000 (19:28 +0200)]
Change copy mode to Async in PME only rank

The H2D copy in PME-only rank was set to synchronous mode by
mistake. This patch corrects that.

Change-Id: I621b03e574b23d2933b4940a20d234e37b57408d

4 years agoImprove parameter typing for gmxapi simulation parameter setter.
M. Eric Irrgang [Wed, 25 Sep 2019 10:04:39 +0000 (13:04 +0300)]
Improve parameter typing for gmxapi simulation parameter setter.

* Use conventional simple built-in types for simulation parameter
  setter.
* Resolve a sphinx warning due to unrecognized documented parameter
  type.
* Make sure we test both integer and floating point parameter setting.

Change-Id: I3c51bbeaf8a5145690e8000b159099476ff53be6

4 years agoAdd class FixedCapacityVector
Berk Hess [Wed, 9 Oct 2019 18:07:50 +0000 (20:07 +0200)]
Add class FixedCapacityVector

This satisfied the need for an std::vector like container
without the overhead of dynamic allocation.

Change-Id: Ic12f958a42e736ccd1d0a69d2a9de6056a4b7ff5

4 years agoCentralize management of coordinates ready on GPU event
Artem Zhmurov [Wed, 9 Oct 2019 14:02:36 +0000 (16:02 +0200)]
Centralize management of coordinates ready on GPU event

This change shifts the ownership of the EventSynchronizer
indicating that coordinates are available on the device from
UpdateConstraints to StatePropagatorDataGpu.
The latter now provides a getter that, based on workload flags, decides
which synchronizer to return. If update is offloaded the returned event
records the completion of the update-constraints on the GPU.
When update is not offloaded and on search steps the returned event
records the completion of the host to device coordinate transfer.

Change-Id: Idec9f46e78a2708fa31e895bf7590cdad1872987

4 years agoWrong locality was used when ignoring the PME force contribution
Artem Zhmurov [Fri, 11 Oct 2019 11:48:35 +0000 (13:48 +0200)]
Wrong locality was used when ignoring the PME force contribution

The PME forces have no no-local contribution, hence they should be
ignored when non-local forces are reduced. This fixes the bug with
local PME forces ignored instead of non-local. The bug was
introduced in 9409fa5f.

Change-Id: Ie27c71d1f51ca4022f196a9fa114af42685fcbcf

4 years agoAdd helper to reuse generated TPR files in testing
Paul Bauer [Tue, 17 Sep 2019 15:33:13 +0000 (17:33 +0200)]
Add helper to reuse generated TPR files in testing

Used static class members in GoogleTest and provided option in
testfilemanager to allow file path specification before test case is
started.

This should speed up some of the test cases that have been slow due to
repeated calls to grompp.

Change-Id: I50e29d04550d78f2324e3665e903d45515464298

4 years agoMigrate code to using SimulationWorkload flags
Szilárd Páll [Wed, 9 Oct 2019 00:32:11 +0000 (02:32 +0200)]
Migrate code to using SimulationWorkload flags

This changes boolean flags to use the ones defined after task assignment
in SimulationWorkload.

Also does some minor cleanup around code touched in do_force().

No functionality should change.

Change-Id: Ia9bd28f84fee4cb98b578b366153646b2959c1f4

4 years agoRemove incorrect GPU task dependency
Szilárd Páll [Thu, 10 Oct 2019 14:17:58 +0000 (16:17 +0200)]
Remove incorrect GPU task dependency

The depndency between nonlocal reduction and PME forces is not necessary
and therefore it is removed.

Change-Id: Ic7eba307b519f0fb8bde24a2cf676a22d64065ba

4 years agoFix conditions for building StatePropagatorDataGpu
Szilárd Páll [Thu, 10 Oct 2019 19:56:16 +0000 (21:56 +0200)]
Fix conditions for building StatePropagatorDataGpu

StatePropagatorDataGpu was only build when GPU update was active rather
than when GPU buffer ops is active.

Change-Id: I6d2efa73c4896a293155c0853a32b8cedf3d23a6

4 years agoConstruct a struct with development feature flags
Szilárd Páll [Wed, 9 Oct 2019 18:18:44 +0000 (20:18 +0200)]
Construct a struct with development feature flags

Added a struct that collects development feature flags pupulated using
the same environment variables that were used previsouly.

With this the change also eliminates repeated getenv queries.

Change-Id: I2cb4f4dfc28bb6370bb4f7cb549f2222e7580e47

4 years agoPass list of EventSynchronizers to GPU reduction
Szilárd Páll [Tue, 8 Oct 2019 01:47:46 +0000 (03:47 +0200)]
Pass list of EventSynchronizers to GPU reduction

Instead of passing events one-by-one or doing implicit synchronization
hidden in a force tasks' internals, a list of synchronizer objects that
signal the availability of forces from the source tasks is assembled and
passed to the GPU buffer ops/reduction.

The new dependency added here is the H2D transfer for CPU-side force
contribution, PME-related event is kept, halo exchange dependency needs
to be added.

Change-Id: I5ca5ef919b49508790e813e0469aaeef4f6484c0

4 years agoBasic population of simulation workload
Paul Bauer [Mon, 7 Oct 2019 09:36:04 +0000 (11:36 +0200)]
Basic population of simulation workload

Adds basic population of simulation workload datastructure from
information available after task assignment is done to GPU(s).

Also changes population of step and domain work datastructures to
return new datastructure instead of passing pointer to routine that
fills them.

Change-Id: Ie48a4f74eaa69092f24355e19f66a90d6700baa0

4 years agoAdd management for velocities and forces copy events to StatePropagatorDataGpu
Artem Zhmurov [Fri, 4 Oct 2019 15:48:34 +0000 (17:48 +0200)]
Add management for velocities and forces copy events to StatePropagatorDataGpu

All H2D and D2H copies of velocities and forces now record an event, methods
to synchronize on those events are added to the class.

Change-Id: I910c5834d83f317f12c1fe0cd71ced168f412386

4 years agoAdd management for coordinates copy events into StatePropagatorDataGpu
Szilárd Páll [Mon, 30 Sep 2019 13:04:10 +0000 (15:04 +0200)]
Add management for coordinates copy events into StatePropagatorDataGpu

The coordinate copies are now assign a GPU stream and fire an event
when done. The consumers can now wait on coordinates to be ready on
Host or get the GPU event to enqueue a wait on Device.

Change-Id: Ia33e366f32d777ec980940ff7e284ab0b3498637

4 years agoAdd GPU event to mark that coordinate update is done
Szilárd Páll [Mon, 30 Sep 2019 12:47:11 +0000 (14:47 +0200)]
Add GPU event to mark that coordinate update is done

Also added related getter of a pointer to the GpuEventSynchronizer
object that allows syncing the dependent tasks.

Added temporary CPU blocking wait that ensures previous behaviour is
maintained while the GPU update integration is pending.

Change-Id: Iaae03d4f1f4083863a359e66a35f44d178b9382d

4 years agoMake nbnxm a proper module
Berk Hess [Mon, 7 Oct 2019 09:59:56 +0000 (11:59 +0200)]
Make nbnxm a proper module

Added definition of module_nbnxm to doxygen documentation.
Required removing the path from many #includes inside
the module.

Change-Id: I1d46aefaa83b0be674c14a4ef5ee16573eee0e1a

4 years agoSimplify ewald_LRcorrection() call signature
Berk Hess [Tue, 8 Oct 2019 08:29:35 +0000 (10:29 +0200)]
Simplify ewald_LRcorrection() call signature

Also removed an outdated comment.

Change-Id: I09af7185f3475c70eab154974f0dba0653a6142a

4 years agoUpdate handling of CMake policy 68..
M. Eric Irrgang [Sun, 6 Oct 2019 14:41:45 +0000 (17:41 +0300)]
Update handling of CMake policy 68..

The policy is now available in supported CMake versions, so apply it
universally.

Change-Id: Ia6ae999f25d7d9b3932fe74862825a8fb8527352

4 years agoFix for the recent nightly failure
Artem Zhmurov [Tue, 8 Oct 2019 05:24:51 +0000 (07:24 +0200)]
Fix for the recent nightly failure

The cont qualifier in the function declaration produced a warning
that caused the nightly to fail. This fixes the issue, introduced
by 77857c5.

Change-Id: Icef063107a5f66d841f1d110dc9f9fb807364ed2

4 years agoFused two if branches with the same conditional
Prashanth Kanduri [Mon, 7 Oct 2019 15:19:13 +0000 (17:19 +0200)]
Fused two if branches with the same conditional

Change-Id: I8a1fc90875982f2723d9b2f2ea2d847a33f5866b

4 years agoPass the GPU streams to StatePropagatorDataGpu constructor
Artem Zhmurov [Fri, 27 Sep 2019 20:29:30 +0000 (22:29 +0200)]
Pass the GPU streams to StatePropagatorDataGpu constructor

Now the StatePropagatorDataGpu has a local copy of all GPU streams and
manages the update stream. This will allow to select the specific stream
for a specific copy event in the follow-ups. The update stream is now
created in the constructor of the StatePropagatorDataGPU object, which
is a temporary solution until there is a separate device stream manager
(#3115).

Notes:

 - The current implementation where StatePropagatorDataGpu is also used
   on PME-only ranks, where many of the streams do not exist, without
   any restriction on the methods which would require these streams is a
   weakness of the design that will be dealt with in follow-up
 - The OpenCL builds unconditionally use PME stream/context, since for
   these this object is only used when the initial coordinates are copied.
 - The update stream is created in the constructor, whereas the rest of
   the streams is passed as arguments. This asymmentry will be removed
   with introduction of the centralized management of context/streams.

Refs. #2816.

Change-Id: Ia9b1cabd1d3d4942dba8465c716bf644037581e7

4 years agoExtend GPU traits class
Mark Abraham [Fri, 30 Aug 2019 16:27:05 +0000 (18:27 +0200)]
Extend GPU traits class

Now GPU traits provide a non-GPU header, so that generic code
can use CommandStream, CommandEvent and DeviceContext types.
The header also diverges to a platform-specific version when
needed upon compilation. This change allows for passing the
variables of the above types in the general (non-GPU) parts
of the code and can be included where the code is shared
between different platforms.

Renamed a Context variable to DeviceContext for greater clarity.

Change-Id: If21b9dacac66ff7203948eb03de96f9473b7359a

4 years agoClean up the comments sections in Update-Constrain
Artem Zhmurov [Mon, 7 Oct 2019 08:47:34 +0000 (10:47 +0200)]
Clean up the comments sections in Update-Constrain

Remove todos that are done, update the comments related to
the recent changes in the logic.

Change-Id: Ib26848b22efae77d6db0a2ab85734ceaf02db235

4 years agoUpdate rpath comments in src/api/cpp
M. Eric Irrgang [Sun, 6 Oct 2019 14:39:15 +0000 (17:39 +0300)]
Update rpath comments in src/api/cpp

Change-Id: I7839ee47ec8af7fe9445894f357b10b2ac803338