alexxy/gromacs.git
3 years agoReplace gmx_mtop_ilistloop_all
Paul Bauer [Fri, 2 Apr 2021 15:58:10 +0000 (15:58 +0000)]
Replace gmx_mtop_ilistloop_all

3 years agoMove domdec/partition into gmx namespace; minor cleanup
ejjordan [Thu, 1 Apr 2021 08:08:57 +0000 (10:08 +0200)]
Move domdec/partition into gmx namespace; minor cleanup

* Move functions in partition header into gmx namespace
* Localize variables
* Remove an in-out parameter that is never used

3 years agoEnsure coordinates are copied for dipole moment calculation
Andrey Alekseenko [Thu, 1 Apr 2021 13:40:30 +0000 (15:40 +0200)]
Ensure coordinates are copied for dipole moment calculation

With GPU update, we should wait for the coordinates to be copied to host
before using them for calculating the dipole moment.

This did not seem to cause any issues with CUDA but was causing a unit
test failure with SYCL (with !1329):

    SYCL_BE=PI_OPENCL GMX_USE_GPU_BUFFER_OPS=1 GMX_FORCE_UPDATE_DEFAULT_GPU=1 ./bin/mdrun-test --gtest_filter=EwaldSurfaceTerm/EwaldSurfaceTermTest.WithinTolerances/0

Refs #3930, #3932

3 years agoMake FileOptionTypes enum class
Paul Bauer [Thu, 1 Apr 2021 09:18:47 +0000 (11:18 +0200)]
Make FileOptionTypes enum class

Changed to enum class and made mapping to legacy types use
EnumerationArray.

Removed Unknown type as it wasn't used except for error checking. Used
Count type instead in its place.

3 years agoClarify connection of temperature / pressure coupling and propagators
Pascal Merz [Fri, 2 Apr 2021 00:53:32 +0000 (00:53 +0000)]
Clarify connection of temperature / pressure coupling and propagators

Temperature and pressure coupling and propagators are linked, as most
thermostats and barostats apply some type of scaling to positions and
/ or velocities. The temperature and pressure coupling objects must
therefore be linked to the propagators to properly function.

The current implementation did not allow for much flexibility, as it
only allowed propagators to decide whether to connect to a thermostat
or barostat or not. To allow for more complex algorithms, more
flexibility is required. To that end, this change introduces a
PropagatorTag object, which tags the propagators, and allows the
temperature and pressure coupling objects to pick which propagator to
act on. Additionally, this moves the responsibility of connecting to
the coupling algorithm rather than the propagator, which makes more
sense conceptually.

Refs #3423

3 years agoAdd unit test for 1-4 interactions.
Sebastian Kehl [Thu, 1 Apr 2021 14:38:08 +0000 (14:38 +0000)]
Add unit test for 1-4 interactions.

3 years agoRemove dead code in sasa module
Paul Bauer [Thu, 1 Apr 2021 11:09:19 +0000 (13:09 +0200)]
Remove dead code in sasa module

If needed, the code can be found again in git.

3 years agoMake EnumerationArray::size() not static
Mark Abraham [Wed, 31 Mar 2021 08:31:48 +0000 (10:31 +0200)]
Make EnumerationArray::size() not static

It's formally correct that the method can be static, but this makes
code more complex at the point of use for the doubtful benefit of
making clear to the human reader that the value returned by size() is
a compile-time constant. The compiler can always see it.

3 years agoArrayRefs and const refs in global_stat
Joe Jordan [Wed, 31 Mar 2021 16:10:35 +0000 (16:10 +0000)]
ArrayRefs and const refs in global_stat

Use const refs where possible in global_stat. Use ArrayRef for
signalBuffer and return an int instead of passing pointer to int.
Also movemost variable definitions to closer to their first use.

3 years agoUse EnumerationArray for pull isAngleType
Berk Hess [Wed, 31 Mar 2021 13:54:14 +0000 (13:54 +0000)]
Use EnumerationArray for pull isAngleType

3 years agoRemove PME coordinate send code duplication
Alan Gray [Thu, 25 Feb 2021 13:23:11 +0000 (05:23 -0800)]
Remove PME coordinate send code duplication

Unifies codepath for PME coordinate send for default and GPU direct
codepaths. The only effect this has on ordering of activities is for a
run config with GPU buffer ops, without GPU direct communication and
without GPU update, where the (CPU-side) PME-PP coordinate transfer
will now be slightly delayed to allow for an H2D launch of coordinate
data.

Partly addresses #3914

3 years agoMove cluster methods to its own file
Paul Bauer [Wed, 31 Mar 2021 11:18:01 +0000 (11:18 +0000)]
Move cluster methods to its own file

Breaks out some of the methods in gmx cluster into a separate file
before future refactoring.

Refs #4000

3 years agoFix doxygen for updateMDLeapfrogGeneral
ejjordan [Wed, 31 Mar 2021 08:35:55 +0000 (10:35 +0200)]
Fix doxygen for updateMDLeapfrogGeneral

Fixes an issue created in !1350.

3 years agoUse more ArrayRefs in signatures of update impl class
Joe Jordan [Wed, 31 Mar 2021 08:30:23 +0000 (08:30 +0000)]
Use more ArrayRefs in signatures of update impl class

Part of ongoing work to make refactoring mdatoms easier. This only
changes the impl class of update. A followup change can propagate
using ArrayRef to the update class itself, which will make it easier
to call update in both tests and in nblib.

3 years agoUse using for ArrayRef and RVec in pull code
Berk Hess [Tue, 30 Mar 2021 20:28:52 +0000 (22:28 +0200)]
Use using for ArrayRef and RVec in pull code

3 years agoUnify gpu_free(...) function in OpenCL, CUDA and SYCL versions of NBNXM
Artem Zhmurov [Tue, 30 Mar 2021 15:08:15 +0000 (18:08 +0300)]
Unify gpu_free(...) function in OpenCL, CUDA and SYCL versions of NBNXM

Refs #2608

3 years agoFix conditional on when DtoH forces copy occur
Artem Zhmurov [Wed, 31 Mar 2021 00:30:33 +0000 (00:30 +0000)]
Fix conditional on when DtoH forces copy occur

d2d4a50b4c636c203028c5bff311924ec15e7825 introduced performance
regression with forces copied from device to host on each step.
This fixes the issue by reinstantiating proper condition on the
copy call.

Fixes #4001
Refs #2608

3 years agoMove dynamic pull groups and pull nthreads
Berk Hess [Tue, 30 Mar 2021 20:21:13 +0000 (20:21 +0000)]
Move dynamic pull groups and pull nthreads

Moved dynamic pull groups into their respective coordinates.
Set the number of threads per pull group instead of globally.
Now all thread parallel regions run on 1 thread with less than 100
local atoms.

3 years agoUse default constructor for the device buffers that can be uninitialized
Artem Zhmurov [Tue, 30 Mar 2021 14:44:12 +0000 (17:44 +0300)]
Use default constructor for the device buffers that can be uninitialized

Some buffers in NBNXM are initialized conditionally, which posseses
a problem for the OpenCL kernel jit compilation, where these buffers
are used as arguments.

Refs #2608

3 years agoFix some include guards in gmx ana
Paul Bauer [Tue, 30 Mar 2021 12:43:24 +0000 (14:43 +0200)]
Fix some include guards in gmx ana

Clang tidy would complain about the defines starting with _.

3 years agoAllow the use of only one backend at a time with SYCL-DPCPP
Andrey Alekseenko [Tue, 30 Mar 2021 12:39:45 +0000 (12:39 +0000)]
Allow the use of only one backend at a time with SYCL-DPCPP

This is not a hard requirement; multiple backends can be used together
just fine.

But in DPCPP, the same physical device can appear as different virtual
devices provided by different backends (e.g., the same GPU can be accessible
via both OpenCL and L0).
Thus, using devices from two backends is more likely to be a user error than
the desired behavior. In this function, we choose the backend with the most compatible
devices. In case of a tie, we choose OpenCL (if present), or some arbitrary backend
among those with the most devices.

In hipSYCL, the problem of using the same device twice is unlikely to manifest.
It has (as of 2021-03-03) another issues: D2D copy between different backends
is not allowed. We don't use D2D in SYCL yet. Additionally, hipSYCL does not implement
the `sycl::platform::get_backend()` function.

Thus, we only do the backend filtering with DPCPP to keep the code
simple.

If needed, the `GMX_GPU_DISABLE_COMPATIBILITY_CHECK` might be used to
disable this limitation, or a backend-specific device filtering (e.g.,
`SYCL_BE` and `SYCL_DEVICE_FILTER`) can be used to only
provide the desired backend.

3 years agoTurn t_forcerec.shift_vec into an std::vector of gmx::RVec
kanduri [Tue, 30 Mar 2021 11:53:51 +0000 (11:53 +0000)]
Turn t_forcerec.shift_vec into an std::vector of gmx::RVec

Change function signatures so that call sites have minimal changes

3 years agoAdd coordIndex to t_pull_coord
Berk Hess [Tue, 30 Mar 2021 10:15:43 +0000 (10:15 +0000)]
Add coordIndex to t_pull_coord

The pull coordinate index is an integral part of a pull coordinate
and can not be changed. Thus it can be part of t_pull_coord which
allows avoiding index passing in several functions.

3 years agoMove responsibility for checking bondeds in reverse topology
Mark Abraham [Tue, 30 Mar 2021 09:44:29 +0000 (09:44 +0000)]
Move responsibility for checking bondeds in reverse topology

The reverse topology is a data structure distributed across all
domains that should refer exactly once to all bonded interactions
present in the global topology. We check that this is true at run
time, but need a complex implementation to avoid doing extra
collective communication that supports running what is effectively an
assertion that the reverse topology construction is correct.

Past attempts to improve this (e.g. 8b6c99a1) left the code in an
intermediate state where the responsibility for this check was mostly
implemented in do_md rather than compute_globals. That gave the
impression of compute_globals() returning an integer
parameter. However as above it's really an implementation detail of a
check of the reverse topology, and so the logic and memory for that
check should be in the domain decomposition module and object.

This change move the details of that check to the rest of the code
that handles the reverse topology. It renames several variables and
adds documentation for them.

This simplifies parts of the implementation of the modular simulator,
and prepares for implementing the proposal for #3887 by making all
outputs from global reduction local to the module that consumes them.

Refs #3421
Refs #3887

3 years agoAdd tests for calcvir
Joe Jordan [Mon, 29 Mar 2021 13:03:56 +0000 (13:03 +0000)]
Add tests for calcvir

3 years agoFix webpage build
Andrey Alekseenko [Mon, 29 Mar 2021 10:43:47 +0000 (13:43 +0300)]
Fix webpage build

MR !1235 (dff1d7e309eb751b6b7585853501c544919db59f) had a missing empty
line, which upset Sphinx.

3 years agoAvoid unnecessary CPU force buffer clearing
Alan Gray [Mon, 29 Mar 2021 11:12:25 +0000 (11:12 +0000)]
Avoid unnecessary CPU force buffer clearing

Only clear CPU force buffers on steps that actually use the buffers.

Partly addresses #3970

3 years agoMove nsgrid header/source from mdlib to domdec
Joe Jordan [Mon, 29 Mar 2021 08:35:17 +0000 (08:35 +0000)]
Move nsgrid header/source from mdlib to domdec

The function get_nsgrid_boundaries is only called in domdec module
so it should live there. Removed an unused constant and moved another
to the source which is the only consumer. Also removed a todo which
no longer makes sense.

3 years agoRemove unused LSAN suppressions
Kevin Boyd [Mon, 29 Mar 2021 07:47:18 +0000 (07:47 +0000)]
Remove unused LSAN suppressions

Some unknown refactoring has left these unneeded

3 years agoUpdate developer guide on error handling
Mark Abraham [Sat, 27 Mar 2021 20:36:35 +0000 (20:36 +0000)]
Update developer guide on error handling

Deferred to C++ core guidelines on most content, plus
some GROMACS-specific clarification.

3 years agoAvoid enqueueing the same event multiple times in nbnxn_atomdata_x_to_nbat_x_gpu
Andrey Alekseenko [Sat, 27 Mar 2021 19:24:34 +0000 (19:24 +0000)]
Avoid enqueueing the same event multiple times in nbnxn_atomdata_x_to_nbat_x_gpu

With several non-local grids, we were calling
nbnxnInsertNonlocalGpuDependency(nb, NonLocal) in nbnxn_gpu_x_to_nbat_x
after enqueueing the transformation kernel for each one.

Now, we only call it once after submitting all kernels for
given locality (marking the event for Local, enqueueing the wait for it
for NonLocal).

Refs #3988.

3 years agoChange logic for checksumming availability
Paul Bauer [Wed, 24 Mar 2021 10:17:11 +0000 (11:17 +0100)]
Change logic for checksumming availability

Changed order of checks to see if we can calculate the checksum or not.

3 years agoUse ArrayRefs instead of mdatoms in gmx_nb_free_energy_kernel signature
Joe Jordan [Fri, 26 Mar 2021 12:08:14 +0000 (12:08 +0000)]
Use ArrayRefs instead of mdatoms in gmx_nb_free_energy_kernel signature

In addition to helping facilitate the coming mdatoms refactoring,
this is needed to facilitate calling gmx_nb_free_energy_kernel from
nblib without constructing mdatoms.

3 years agoAllow setting nbnxm cluster size for SYCL
Szilárd Páll [Fri, 26 Mar 2021 08:14:16 +0000 (08:14 +0000)]
Allow setting nbnxm cluster size for SYCL

Rename GMX_OPENCL_NB_CLUSTER_SIZE to GMX_GPU_NB_CLUSTER_SIZE and use its
value in SYCL builds too. The former is still taken into account at
cmake-time, but users are advised to use the latter.

Refs #3847 #3933 #3935

3 years agoLocalize variables in do_lbfgs()
Berk Hess [Thu, 25 Mar 2021 19:24:23 +0000 (19:24 +0000)]
Localize variables in do_lbfgs()

Also replaced pointers by std::vector.

3 years agoUse more vectors for EnergyOutput private members
Joe Jordan [Thu, 25 Mar 2021 19:04:20 +0000 (19:04 +0000)]
Use more vectors for EnergyOutput private members

3 years agoUnify gpu_upload_shiftvec(...) function in NBNXM
Artem Zhmurov [Thu, 25 Mar 2021 18:28:42 +0000 (18:28 +0000)]
Unify gpu_upload_shiftvec(...) function in NBNXM

Refs. #2608

3 years agoConstructor for t_tabledata
Joe Jordan [Thu, 25 Mar 2021 16:53:45 +0000 (16:53 +0000)]
Constructor for t_tabledata

Added default and specialized constructors for t_tabledata. With
one additional minor change this means that smalloc header is no
longer needed in forcetable.cpp.

3 years agoArrayRef and const ref in gmx_nb_free_energy_kernel
ejjordan [Wed, 24 Mar 2021 22:33:40 +0000 (23:33 +0100)]
ArrayRef and const ref in gmx_nb_free_energy_kernel

Use const ref where possible in nonbonded free energy kernels. Also
use ArrayRef for passing coordinates.

3 years agoUse ArrayRef in special forces
Joe Jordan [Thu, 25 Mar 2021 10:48:38 +0000 (10:48 +0000)]
Use ArrayRef in special forces

Pass ArrayRef<RVec> instead of rvec* in edsam, pull_rotation, and
imd. Also removed unneeded header basedefinitions.

A followup change can refactor communicate_group_positions to take
ArrayRefs.

3 years agoFix some doxygen errors
ejjordan [Wed, 24 Mar 2021 23:02:22 +0000 (00:02 +0100)]
Fix some doxygen errors

3 years agoFixed unused variable warning
Mark Abraham [Thu, 25 Mar 2021 06:32:24 +0000 (07:32 +0100)]
Fixed unused variable warning

3 years agoUse ArrayRef in signatures of constraints and some pulling
Joe Jordan [Thu, 25 Mar 2021 06:11:17 +0000 (06:11 +0000)]
Use ArrayRef in signatures of constraints and some pulling

In order to use ArrayRef in constr, settle, shake, and lincs, some
pull code also needed to be refactored. Part of preparation for
refactoring of t_mdatoms.

3 years agoInline wallcycle counting functions
Paul Bauer [Wed, 24 Mar 2021 12:49:52 +0000 (12:49 +0000)]
Inline wallcycle counting functions

Inlines start and stop functions for wallcycle counting.

3 years agoUnify nbnxn_gpu_init_x_to_nbat_x
Andrey Alekseenko [Wed, 24 Mar 2021 11:54:55 +0000 (11:54 +0000)]
Unify nbnxn_gpu_init_x_to_nbat_x

Previously, we had this function only for CUDA, but we will need it for
SYCL (#3932). OpenCL implementation is unlikely to be needed, but should
not hurt either.

Refs. #2608

3 years agoAdd missing GMX_ASSERT(haveCopiedXFromGpu)
Andrey Alekseenko [Wed, 24 Mar 2021 10:52:51 +0000 (13:52 +0300)]
Add missing GMX_ASSERT(haveCopiedXFromGpu)

We make this assertion every time we call
stateGpu->waitCoordinatesReadyOnHost(AtomLocality::Local) in the
do_force function.

This does not fix any bugs, just makes the code a bit more consistent in
how it checks self-consistency.

Refs #3988.

3 years agoRemove nb_kernel_data_t
ejjordan [Wed, 24 Mar 2021 08:14:07 +0000 (09:14 +0100)]
Remove nb_kernel_data_t

All data was copied from gmx_enerdata_t. Now use ArrayRefs to pass
the parameters to the kernels.

3 years agoRemove unneeded members from nb_kernel_data_t
ejjordan [Tue, 23 Mar 2021 15:56:26 +0000 (16:56 +0100)]
Remove unneeded members from nb_kernel_data_t

Several unused members are removed from nb_kernel_data_t. Additionally,
some members that can be passed directly from the gmx_enerdata_t
struct are removed, and instead added to the call signature of
gmx_nb_free_energy_kernel. This expansion of the call signature
is the only way to get rid of the real* members of nb_kernel_data_t.
Also, function with no implementation is removed.

3 years agoUse TextWriter in msd tests
Paul Bauer [Tue, 23 Mar 2021 15:07:16 +0000 (16:07 +0100)]
Use TextWriter in msd tests

Removes raw file pointer for mdp input file writing.

Fixes #3986

3 years agoAdd comparison operator to BasicVector
Berk Hess [Tue, 23 Mar 2021 14:47:26 +0000 (14:47 +0000)]
Add comparison operator to BasicVector

The default comparison seemed to compare the memory addresses
and not the elements.

3 years agoFix deviceIdsAssigned() to return a unique list of IDs
Szilárd Páll [Tue, 23 Mar 2021 13:44:45 +0000 (13:44 +0000)]
Fix deviceIdsAssigned() to return a unique list of IDs

The method originally returned the rank's task-to-device mapping
rather than the unique list of devices that have been assigned tasks.
When #ranks > #devices this list contains duplicate device IDs.

Due to the changes made in e2a2fe80 the vector returned by
deviceIdsAssigned() was passed to setupGpuDevicePeerAccess()
which results in redundant attempts to repeatedly enable peer access for
the same device pairs.

Refs #3980

3 years agoForward declare ArrayRef more and inlcude basedefinitions where needed
ejjordan [Tue, 23 Mar 2021 10:29:00 +0000 (11:29 +0100)]
Forward declare ArrayRef more and inlcude basedefinitions where needed

Remove many includes of ArrayRef that can be forward declared. Also
remove includes of basedefinitions in many headers. In some cases
removing basedefinitinos meant also changing gmx_bool to bool.
Note that no change to source files is needed, apart from possibly
adding the basedefintions include, because gmx_bool uses true and
false under the hood.

3 years agoModernize t_nrnb
Joe Jordan [Tue, 23 Mar 2021 10:15:33 +0000 (10:15 +0000)]
Modernize t_nrnb

* Use array instead of pointer.
* Remove unused functions.
* Add doxygen to inc_nrnb.
* Use inline function instead of macro in all places where possible.
* Remove unused headers.

3 years agoUse ArrayRef in calc_mu
Joe Jordan [Tue, 23 Mar 2021 09:40:41 +0000 (09:40 +0000)]
Use ArrayRef in calc_mu

3 years agoMore const ref in shellfc
ejjordan [Mon, 22 Mar 2021 09:30:50 +0000 (10:30 +0100)]
More const ref in shellfc

Pass a const ref to t_mdatoms in shellfc functions. Part of work
to make refactoring t_mdatoms easier.

3 years agoDetect CUDA-aware support in underlying MPI implementation
Gaurav Garg [Wed, 17 Mar 2021 08:27:35 +0000 (08:27 +0000)]
Detect CUDA-aware support in underlying MPI implementation

Checks CUDA-aware MPI support at cmake configuration time and at runtime. Print CUDA-aware MPI support status with gmx -version.

3 years agoUse ArrayRef in do_ewald
ejjordan [Mon, 22 Mar 2021 11:49:54 +0000 (12:49 +0100)]
Use ArrayRef in do_ewald

Also removed a function with no implementation.

3 years agoUse StringToEnumValueConverter and enumValueToString more
Mark Abraham [Mon, 22 Mar 2021 09:49:30 +0000 (09:49 +0000)]
Use StringToEnumValueConverter and enumValueToString more

Follow up from MR 1213

3 years agoFix compiler and linter warnings
Andrey Alekseenko [Mon, 22 Mar 2021 09:09:33 +0000 (09:09 +0000)]
Fix compiler and linter warnings

- Unused variables in pme_pp.cpp
- Insufficient NOLINTing in update.cpp

3 years agoRemove incorrect assertion for GPU timing in SYCL
Andrey Alekseenko [Fri, 19 Mar 2021 21:55:19 +0000 (00:55 +0300)]
Remove incorrect assertion for GPU timing in SYCL

- The expression was backwards: it was failing when timing was disabled
  instead of failing when it is enabled.
- The expression was run on a freshly-initialized data structure, and
  the value of bDoTime was always overridden later, so it was not
  actually checking anything.

Since we anyway never set bDoTime to true in SYCL build, we might as
well remove this assertion here altogether.

Introduced in !1296 (c4a672b93b655ff674b671fd10ebe728b2d19ec8).

3 years agoClean up leaks in t_inputrec
Kevin Boyd [Sat, 20 Mar 2021 21:43:58 +0000 (14:43 -0700)]
Clean up leaks in t_inputrec

Refs #3984

3 years agoRemove a misplaced update cycle closing
Szilárd Páll [Fri, 19 Mar 2021 19:04:42 +0000 (20:04 +0100)]
Remove a misplaced update cycle closing

This was removed in b80b7a327b1 but got added back later presumably
during a merge.

Refs #3764

3 years agoRename sendFToPpCudaDirect
Szilárd Páll [Wed, 10 Mar 2021 10:50:47 +0000 (11:50 +0100)]
Rename sendFToPpCudaDirect

sendFSynchronizerToPpCudaDirect expresses what the method actually does.

3 years agoMove the atomToInteractionLocality(...) into locality.h
Artem Zhmurov [Thu, 18 Mar 2021 06:49:18 +0000 (09:49 +0300)]
Move the atomToInteractionLocality(...) into locality.h

The atomToInteractionLocality(...) does not depend on NBNXM
and can naturally reside alongside the definitions of localitiy
enumerations. This allows to combine haveGpuShortRangeWork(...)
functions in NBNXM, avoding confuciton of having two very similar
functions with different signatures.

3 years agoStore buffer without offset in GpuForceReduction::Impl::baseForce_
Andrey Alekseenko [Wed, 10 Mar 2021 11:53:49 +0000 (14:53 +0300)]
Store buffer without offset in GpuForceReduction::Impl::baseForce_

- Store the pointer to the beginning of the array and apply offset to
it when invoking the kernel. Offsets to other arrays are applied at
the invocation time, so it makes sense to do the same with baseForce_.
- This also avoid storing pointers to the middle of the device buffer,
which is not a good fit for OpenCL and SYCL.

This change is preparation for adding a SYCL implementation of GPU
update (Issue #3932).

3 years agoUnify init_gpu function in NBNXM
Artem Zhmurov [Fri, 19 Mar 2021 16:48:38 +0000 (16:48 +0000)]
Unify init_gpu function in NBNXM

Refs. #2608

3 years agoUse DeviceBuffer<RVec> in GPU force reduction and PME code
Andrey Alekseenko [Tue, 16 Mar 2021 10:03:24 +0000 (11:03 +0100)]
Use DeviceBuffer<RVec> in GPU force reduction and PME code

... instead of raw device pointers.

Preparation for #3932. PME change is incidental, the main focus is
GpuForceReduction.

3 years agoEnable compiling LeapFrog with hipSYCL
Andrey Alekseenko [Tue, 16 Mar 2021 11:21:51 +0000 (12:21 +0100)]
Enable compiling LeapFrog with hipSYCL

No testing yet. Trivial change after !1268.

Closes #3941.

3 years agoBulk change to const ref for mtop
Paul Bauer [Fri, 19 Mar 2021 11:45:06 +0000 (12:45 +0100)]
Bulk change to const ref for mtop

Change function signatures in mtop_lookup.h and mtop_util.h to be const
ref only for mtop. Also change signatures in other files as I went
along.

This change is only refactoring.

3 years agoMake wallcycle comments proper doxygen
Paul Bauer [Fri, 19 Mar 2021 07:59:47 +0000 (08:59 +0100)]
Make wallcycle comments proper doxygen

Should reduce noise in other refactoring commits.

3 years agoRemove const cast in update code
Berk Hess [Fri, 19 Mar 2021 12:42:49 +0000 (12:42 +0000)]
Remove const cast in update code

3 years agoUse more arrayref in listed forces sigatures
Joe Jordan [Fri, 19 Mar 2021 11:45:23 +0000 (11:45 +0000)]
Use more arrayref in listed forces sigatures

Pass members of t_mdatoms directly in many places in listed_forces.
Part of work on making refactor of t_mdatoms easier.

3 years agoRemove mdatoms from forceprovider call signature
Paul Bauer [Fri, 19 Mar 2021 11:11:49 +0000 (11:11 +0000)]
Remove mdatoms from forceprovider call signature

This makes it possible to test the forceprovider without having to build
a partial mdatoms datastructure first. Needed for future refactoring of
mdatoms.

3 years agoUse ArrayRef in ewald_LRcorrection
Joe Jordan [Fri, 19 Mar 2021 10:50:48 +0000 (10:50 +0000)]
Use ArrayRef in ewald_LRcorrection

This will make refactoring t_mdatoms easier. Also changed
signatures of calculateLongRangeNonbondeds to use more
ArrayRef.

3 years agoMake non bonded energy terms enum class
Joe Jordan [Fri, 19 Mar 2021 09:54:58 +0000 (09:54 +0000)]
Make non bonded energy terms enum class

Also renamed some of the enum values.

3 years agoFix a warning from CUDA 10.1
Andrey Alekseenko [Fri, 19 Mar 2021 08:13:39 +0000 (11:13 +0300)]
Fix a warning from CUDA 10.1

Discovered during nightly build:

warning: static_assert with no message is a C++17 extension [-Wc++17-extensions]

3 years agoUse ArrayRef in gmx_pme_send_parameters
ejjordan [Thu, 18 Mar 2021 15:42:02 +0000 (16:42 +0100)]
Use ArrayRef in gmx_pme_send_parameters

This will make refactoring t_mdatoms easier.

3 years agoUse const refs in atoms2md signature
ejjordan [Thu, 18 Mar 2021 16:05:02 +0000 (17:05 +0100)]
Use const refs in atoms2md signature

Const refs are now used for mtop and inputrec in atoms2md. Doxygen
is also added and inputrec renamed from ir.

3 years agoAdd wallcycle counting tests
Paul Bauer [Thu, 18 Mar 2021 17:12:34 +0000 (17:12 +0000)]
Add wallcycle counting tests

Basic tests for running main and sub counters, and to check overhead.

3 years agoUse DeviceBuffer in GPU update and NBNXM code
Andrey Alekseenko [Thu, 11 Mar 2021 10:48:06 +0000 (13:48 +0300)]
Use DeviceBuffer in GPU update and NBNXM code

... instead of raw device pointers and DeviceBuffer<float3>.

We try to use DeviceBuffer<Float3>, but in some places we have to use
DeviceVector<gmx::RVec>, until we can define FloatN types without
including any backend-specific headers. Currently, Float3 is defined as
gmx::RVec, so this should not cause any issues.

Also added some helper functions to convert RVec ̌<-> Float3 <-> float3.

Preparation for #3932 and #3941.

3 years agoUse ArrayRef<const real> in gmx_pme_do
ejjordan [Wed, 17 Mar 2021 09:31:48 +0000 (10:31 +0100)]
Use ArrayRef<const real> in gmx_pme_do

Also changed some static functions to use ArrayRef. Some local
variables need to be vectors because they use operator[]. This
is part of preliminary work to make refactoring t_mdatoms
easier.

3 years agoFix errors overlooked in gmx msd changes
Paul Bauer [Wed, 17 Mar 2021 05:59:56 +0000 (05:59 +0000)]
Fix errors overlooked in gmx msd changes

Made some NOLINT sections more broad.
Fixed documentation.

3 years agoUse RVec and std::array in gmx_domdec_comm_t
Joe Jordan [Tue, 16 Mar 2021 18:03:19 +0000 (18:03 +0000)]
Use RVec and std::array in gmx_domdec_comm_t

Where possible, rvecs have been changed to RVecs and pointers
changed to std::arrays.

3 years agoMigrate gmx msd to the trajectoryanalysis framework
Kevin Boyd [Tue, 16 Mar 2021 17:28:24 +0000 (17:28 +0000)]
Migrate gmx msd to the trajectoryanalysis framework

Features to still be added
-tensor, for the MSD tensor
-pdb, for per molecule B-factors
-rmcomm, for system COM removal
-mw, for tuning mass-weighting options
-maxtau, for limiting resource usage and unneccessary computation (refs #3870)
-improvements to documentation and maybe some flag behavior changes (refs #3869)

Refs #2368

3 years agoUnify gpu_init_atomdata(...) function
Artem Zhmurov [Tue, 16 Mar 2021 12:53:21 +0000 (15:53 +0300)]
Unify gpu_init_atomdata(...) function

Refs #2608

3 years agoUnify gpu_launch_cpyback(...) function in NBNXM
Artem Zhmurov [Tue, 16 Mar 2021 13:26:37 +0000 (16:26 +0300)]
Unify gpu_launch_cpyback(...) function in NBNXM

Refs #2608

3 years agoRemove conditional assignemnt of cell sizes from domdec partition
Joe Jordan [Tue, 16 Mar 2021 11:21:10 +0000 (11:21 +0000)]
Remove conditional assignemnt of cell sizes from domdec partition

The variable cellsizesWithDlb is always initiallized since it is a
std::vector, so there is no reason to set it to nullptr in
domdec/partition.

3 years agoUnify gpu_init_atomdata(...) function
Artem Zhmurov [Sat, 13 Mar 2021 13:13:14 +0000 (16:13 +0300)]
Unify gpu_init_atomdata(...) function

Refs #2608

3 years agoMove pmalloc(..)/pfree(...) to separate source files in CUDA/OpenCL/SYCL
Artem Zhmurov [Mon, 15 Mar 2021 16:57:02 +0000 (19:57 +0300)]
Move pmalloc(..)/pfree(...) to separate source files in CUDA/OpenCL/SYCL

Having pmalloc(..) and pfree(..) functions in unrelated files in CUDA,
OpenCL and SYCL makes it hard to use these functions in platform-agnostic
code. This creates common header and moves these functions to separate
source files.

3 years agoAdd subcycle counting to MPI build
Paul Bauer [Mon, 15 Mar 2021 13:56:18 +0000 (14:56 +0100)]
Add subcycle counting to MPI build

This code path has not been tested in CI and should be added.

3 years agoMove M_PI definition to math/units.h
Paul Bauer [Mon, 15 Mar 2021 14:59:03 +0000 (14:59 +0000)]
Move M_PI definition to math/units.h

This makes more sense to have the definition there with the other
constants.

Resolves build issues with MSVC not finding M_PI definition.

Needed some minor header fixes.

3 years agoAdd another cool quote.
Paul Bauer [Mon, 15 Mar 2021 10:06:16 +0000 (11:06 +0100)]
Add another cool quote.

Recently seen on Twitter ...

3 years agoDo not overallocate shiftVec and fshifts buffers in OpenCL
Artem Zhmurov [Mon, 15 Mar 2021 09:12:04 +0000 (12:12 +0300)]
Do not overallocate shiftVec and fshifts buffers in OpenCL

When changing buffers from flat float format to Float3,
the sizes of the shiftVec and fshift buffers were not updated
in OpenCL NBNXM data management, which lead to the buffers being
overallocated. This fixes the issue.

Introduced in c66827166fc9099ecd1a4a2f7080558df70bf529

3 years agoAdd a cool quote from Elvis Presley's song
Artem Zhmurov [Mon, 15 Mar 2021 10:16:45 +0000 (10:16 +0000)]
Add a cool quote from Elvis Presley's song

3 years agoFix clang-format in topio.cpp
Artem Zhmurov [Mon, 15 Mar 2021 09:09:49 +0000 (12:09 +0300)]
Fix clang-format in topio.cpp

Introduced in 0dab36f99294056b33f4ee58383587a82447b9e6

3 years agoFix leak in cpp_opts
Kevin Boyd [Sun, 14 Mar 2021 19:53:15 +0000 (12:53 -0700)]
Fix leak in cpp_opts

Refs #3984

3 years agoUse existing PME f ready event in PmeForceSenderGpu
Szilárd Páll [Fri, 5 Mar 2021 19:29:38 +0000 (20:29 +0100)]
Use existing PME f ready event in PmeForceSenderGpu

Instead of recording internally into the PME stream and sending that
event to the PP rank to sycn on from the separate PME rank, use the
already existing event recorded in PME.
This also eliminates the unnecessary use of multiple events, one for
each PP rank.

Refs #2891 #2915

3 years agoRename launchReceiveCoordinatesFromPpCudaDirect
Szilárd Páll [Sat, 13 Mar 2021 11:05:43 +0000 (11:05 +0000)]
Rename launchReceiveCoordinatesFromPpCudaDirect

The receiveCoordinatesSynchronizerFromPpCudaDirect() method name better
reflects what the code it actually does.

Refs #2891

3 years agoRemove cyclic dependency check from check-source
Paul Bauer [Sat, 13 Mar 2021 08:31:24 +0000 (08:31 +0000)]
Remove cyclic dependency check from check-source

This hasn't been properly checked for a while now and we are planning to
move this to a CMake check anyway.

3 years agoAdd DeviceAccessor<T,read> ctor from const DeviceBuffer<T>
Andrey Alekseenko [Fri, 12 Mar 2021 15:46:48 +0000 (15:46 +0000)]
Add DeviceAccessor<T,read> ctor from const DeviceBuffer<T>

A bit hacky, but better preserves the intent behind declaring
DeviceBuffer const.

Part of preparatory work for #3932.