alexxy/gromacs.git
3 years agoAdd FloatN aliases to OpenCL and use them in NBNXM
Artem Zhmurov [Mon, 22 Feb 2021 09:43:43 +0000 (09:43 +0000)]
Add FloatN aliases to OpenCL and use them in NBNXM

These aliases are nessesary to unify OpenCL, CUDA and SYCL
code.

Refs #3312, #2608, #3311

3 years agoAdd FloatN aliases to CUDA and use them in NBNXM
Artem Zhmurov [Sat, 20 Feb 2021 08:12:02 +0000 (11:12 +0300)]
Add FloatN aliases to CUDA and use them in NBNXM

These aliases are nessesary to unify OpenCL, CUDA and SYCL
code.

Refs #3312, #2608, #3311

3 years agoRename our SYCL aliases floatN to FloatN
Andrey Alekseenko [Thu, 18 Feb 2021 10:09:14 +0000 (13:09 +0300)]
Rename our SYCL aliases floatN to FloatN

Main reasons:

- Clearly separate our types (or aliases) from native types. This will
  likely make later changes (e.g., in scope of #3312) easier.
- Enable hipSYCL build by avoiding clashes of multiple floatN in the
  global namespace.

Refs #3312, #3923

3 years agoSet temperature scaling groups upon construction of integrator
Artem Zhmurov [Sat, 20 Feb 2021 22:48:03 +0000 (22:48 +0000)]
Set temperature scaling groups upon construction of integrator

The temperature scaling parameters do not change, so can be
set upon construction of the integrator object.

Closes #3794

3 years agoRemove unsed structs from nblist and use vector in t_nblist
Joe Jordan [Sat, 20 Feb 2021 08:52:44 +0000 (08:52 +0000)]
Remove unsed structs from nblist and use vector in t_nblist

Several unused structs are removed from nblist.h. Some unused members of
t_nblist are removed, and pointers are changed to vectors.

3 years agoRevome unused code from nsgrid
Joe Jordan [Fri, 19 Feb 2021 20:33:04 +0000 (20:33 +0000)]
Revome unused code from nsgrid

In addition to removing several functions that are not used,
some unused parameters from the t_grid struct are removed.

3 years agoClean up DD reverse topology options
Berk Hess [Fri, 19 Feb 2021 14:44:49 +0000 (14:44 +0000)]
Clean up DD reverse topology options

Added a ReverseTopOptions struct to handle often used options for
functions. Added a constructor for gmx_reverse_top_t.
Replaced two bools by two enum classes for clarity and safety.

3 years agoUse const refs in init_nb_verlet
Joe Jordan [Fri, 19 Feb 2021 12:00:10 +0000 (12:00 +0000)]
Use const refs in init_nb_verlet

In addition to using more const refs instead of pointers
in some nbnmx setup code, names are made slightly more
verbose.

3 years agoReplace sqrt with std::sqrt in mdatoms.cpp
Andrey Alekseenko [Fri, 19 Feb 2021 09:20:35 +0000 (10:20 +0100)]
Replace sqrt with std::sqrt in mdatoms.cpp

We are including <cmath>, so we should use versions from the std namespace.

3 years agoPass restraint data structures to bonded functions
ejjordan [Thu, 18 Feb 2021 11:59:01 +0000 (12:59 +0100)]
Pass restraint data structures to bonded functions

This adds explicitly the t_disresdata and t_oriresdata structures to all
bonded force calculation calls, instead of passing them as members of
the t_fcdata structure. This is an unfortunate but necessary step in
order to be able to separate bondedtable_t from the two restraint
data structures. The splitting of t_fcdata into separate table data and
restraint data structures is needed to simplify the initialization of
the forcerec.

3 years agoUnify and clarify a couple of macro definitions in NBNXM
Artem Zhmurov [Thu, 18 Feb 2021 16:31:47 +0000 (19:31 +0300)]
Unify and clarify a couple of macro definitions in NBNXM

1. The GMX_NBNXN_PRUNE_KERNEL_J4_CONCURRENCY definition was
essentially duplicated in CUDA and OpenCL. This unify them.

2. The 1/sqrt(PI) macro was defined several times in OpenCL.

3 years agoRename and add doxygen to reaction field params in interaction_const
Joe Jordan [Fri, 19 Feb 2021 07:01:02 +0000 (07:01 +0000)]
Rename and add doxygen to reaction field params in interaction_const

This will make further changes to interaction_const RF params easier
to review.

3 years agoUse unique_ptr for forcerec in runner
Joe Jordan [Thu, 18 Feb 2021 20:48:33 +0000 (20:48 +0000)]
Use unique_ptr for forcerec in runner

Brings forcerec usage in line with most other large data structures there.

3 years agoMake the use of GpuEventSynchronizer in SYCL conformant with CUDA/OpenCL
Andrey Alekseenko [Thu, 18 Feb 2021 13:01:43 +0000 (16:01 +0300)]
Make the use of GpuEventSynchronizer in SYCL conformant with CUDA/OpenCL

MR !1035 refactored the use of GpuEventSynchronizer in CUDA and OpenCL
to make merging the code paths easier. Here, we update SYCL to the same
standard.

Note, that it introduces additional synchronization between local and
non-local queues. It is present in CUDA and OpenCL, but was implicit in
SYCL. To simplify code, it is added here. If it turns out to be
detrimental to performance, it can be (conditionally) NOPed.

Refs #2608, #3895.

3 years agoFix includes and forward declarations of domdec in nbnxm headers
ejjordan [Thu, 18 Feb 2021 17:18:12 +0000 (18:18 +0100)]
Fix includes and forward declarations of domdec in nbnxm headers

3 years agoUse array in gmx_domdec_zones_t
ejjordan [Thu, 18 Feb 2021 16:36:56 +0000 (17:36 +0100)]
Use array in gmx_domdec_zones_t

3 years agoFix doxygen in SYCL code
Paul Bauer [Thu, 18 Feb 2021 16:06:08 +0000 (17:06 +0100)]
Fix doxygen in SYCL code

Was left over when merging changes from development branch.

3 years agoImplement velocity terms for virtual sites
Pascal Merz [Thu, 11 Feb 2021 00:27:01 +0000 (17:27 -0700)]
Implement velocity terms for virtual sites

This change
* introduces velocity terms for virtual site reporting replacing the
  displacement hack used prior,
* removes work-arounds used to keep virtual sites frozen during real
  atom propagation,
* allows users of the VirtualSiteHandler object to chose whether to
  calculate positions only (used for non-output steps), positions
  and velocities (used for output-steps except in md-vv), or
  velocities only (used for output-steps in md-vv), which mitigates
  the fact that calculating the velocities requires a few additional
  operations,
* adds tests of the virtual velocity,
* updates the documentation accordingly.

Fixes #3866

3 years agoSYCL NBNXM offload support
Andrey Alekseenko [Thu, 18 Feb 2021 11:51:28 +0000 (11:51 +0000)]
SYCL NBNXM offload support

Associated changes:

- Added function stubs to PME: necessary for compilation.
- Stricter SYCL hardware compatibility checks: limits on subgroup size
  and the availability of local memory.
- The kernel implementation and overall logic closely follow the OpenCL
  implementation. Divergences are documented locally.

Limitations:

- No fine-grained timings yet.
- Code-duplication with CUDA and OpenCL: see #2608.
- Minor differences in local/nonlocal synchronization: see #3895,
  related to #2608.
- Only the OpenCL backend was extensively tested. LevelZero works fine
  without MPI but stalls due to a known bug. The fix for DPCPP runtime
  is available, but not yet part of any OneAPI release:
  https://github.com/intel/llvm/pull/3045.
- The complex/position-restraints regression test fails: see #3846.
- No performance tuning: see #3847.

Performance on rnase-cubic system is similar to OpenCL implementation.

3 years agoClean up box vector constants in do_force
Szilárd Páll [Wed, 17 Feb 2021 18:17:13 +0000 (19:17 +0100)]
Clean up box vector constants in do_force

3 years agoFix clang-8-cuda-10.0 container
Andrey Alekseenko [Thu, 18 Feb 2021 08:41:41 +0000 (11:41 +0300)]
Fix clang-8-cuda-10.0 container

MR !1135 (60deae1fd05334f0ecf2f295cc7f49d59f734bb9) introduced a hack to
work around Clang support for 11.x CUDA versions. This inadvertantly
broke Clang 8 + CUDA 10.0 build.

Apparently, Clang requires
$CUDA_HOME/version.txt file to have version in major.minor.patch format,
and fails to find libraries if it is specified as major.minor only.

3 years agoUpdate CMake requirement to 3.16.3
Paul Bauer [Thu, 18 Feb 2021 07:10:07 +0000 (07:10 +0000)]
Update CMake requirement to 3.16.3

We will require a more modern CMake beginning with the 2022 version, and
have chosen 3.16.3 as the minimum version, as this is what the Ubuntu
20.04 LTS ships by default.

Refs #3708

3 years agoIntroduce test checking freeze groups
Pascal Merz [Wed, 17 Feb 2021 12:27:55 +0000 (12:27 +0000)]
Introduce test checking freeze groups

This currently fails for the partially frozen velocities
of md-vv simulation. Fix is in the follow-up commit.

Refs #3849

3 years agoAdd -DGMX_SYCL_HIPSYCL cmake option
Andrey Alekseenko [Wed, 17 Feb 2021 10:44:43 +0000 (10:44 +0000)]
Add -DGMX_SYCL_HIPSYCL cmake option

When supplied, use hipSYCL's CMake module to set up compile options.
Otherwise, use our own code to configure flags for Intel's LLVM-based
SYCL compiler.

3 years agoUse GpuEventSynchronizer in NBNXM
Artem Zhmurov [Wed, 17 Feb 2021 10:24:31 +0000 (10:24 +0000)]
Use GpuEventSynchronizer in NBNXM

This unifies the event-based synchronization in CUDA and OpenCL
by using a wrapper with platform-agnostic interfaces for events.

Refs #2608

3 years agoRemove dead function declarations from forcerec
ejjordan [Wed, 17 Feb 2021 09:13:10 +0000 (10:13 +0100)]
Remove dead function declarations from forcerec

Not only are the removed functions not used, they are not even defined.

3 years agoMore const in edsam functions
ejjordan [Wed, 17 Feb 2021 07:52:18 +0000 (08:52 +0100)]
More const in edsam functions

In addition to increasing const correctness in edsam functions,
some additional minor cleanup is also done.

3 years agoUse const ref to mtop in init_forcerec
ejjordan [Tue, 16 Feb 2021 17:01:11 +0000 (18:01 +0100)]
Use const ref to mtop in init_forcerec

Also lower level function, which are currently static, are
refactored to take a const ref to mtop. This will make exposing
those lower level functions safer.

3 years agoSupport checking event status in GpuEventSynchronizer
Szilárd Páll [Thu, 11 Feb 2021 10:57:05 +0000 (11:57 +0100)]
Support checking event status in GpuEventSynchronizer

This commit adds an isReady() method that allows checking whether
the event has been triggered (or in SYCL associated barrier task has
completed).
The primary aim is porting the nbnxm module to the unified GPU layer.

Implements part of #2527

3 years agoFix clang-tidy-11 errors in NBNXM module, part 5
Andrey Alekseenko [Tue, 16 Feb 2021 15:13:56 +0000 (15:13 +0000)]
Fix clang-tidy-11 errors in NBNXM module, part 5

Refs #3897

3 years agoAdd support for Clang-CUDA 11.x and a post-merge CI build
Andrey Alekseenko [Tue, 16 Feb 2021 14:16:02 +0000 (14:16 +0000)]
Add support for Clang-CUDA 11.x and a post-merge CI build

Tested mostly with Clang-11 and CUDA-11.2

While Clang does not officially support CUDA after 10.1, it appears to
work fine with newer versions.

Caveat: Clang fails to properly detect CUDA versions past 10.2

This can be worked around by creating `/usr/local/cuda/version.txt`
file with the single line `CUDA Version X.Y.Z`.

Despite the workaround above, Clang:
- does not recognize sm_86.
- recognizes sm_80, but believes that the installed CUDA version
  is too old to support it.

3 years agoUse const ref to inputrec in do_force
Joe Jordan [Tue, 16 Feb 2021 13:43:14 +0000 (13:43 +0000)]
Use const ref to inputrec in do_force

Inputrec can be const at the level of do_force and below. This
will make subsequent refactorings in, e.g. setup code called
within do_force, easier.

3 years agoAdd container with LLVM 11, CUDA 11.2.1, hipSYCL
Andrey Alekseenko [Tue, 16 Feb 2021 13:01:05 +0000 (13:01 +0000)]
Add container with LLVM 11, CUDA 11.2.1, hipSYCL

- Introduce the option to add hipSYCL to a CI container.
- - Version is specified by commit SHA, because the latest stable
    release (0.9.0) is too old.
- - hipSYCL requires llvm-dev packages for compilation. This bloats the
    size of the image, but is much easier to manage than installing CUDA
    and ROCm into a temporary container.
- Add workarounds for known Clang limitations when dealing with the latest
  versions of CUDA (11.0-11.2.1) and ROCm (3.9-4.0).
- - Is also allows using cuda-clang build with CUDA 11.
- Add a new image to the admin/containers/buildall.sh:
- - Ubuntu 20.04, Clang 11, CUDA 11.2.1, hipSYCL develop.

3 years agoIntroduce virtual sites test
Pascal Merz [Tue, 16 Feb 2021 08:47:10 +0000 (08:47 +0000)]
Introduce virtual sites test

The virtual site tests contain two parts:

1. A reference implementation. The virtual sites code in mdrun is
   difficult to unit-test, since the function calls require data
   structures which are not available in our current testing
   framework. To circumvent that problem, a reference implementation
   is introduced in the tests. The reference implementation can be
   unit-tested, and can be compared to end-to-end mdrun output,
   which leads to a situation comparable to having unit and end-to-end
   tests for the virtual sites implementation. Additionally, the
   reference implementation is simplified and kept close to the
   analytical formulas, which makes verification by eye easier. The
   current unit tests compare the position calculation to the velocity
   calculation, ensuring that the latter is indeed the derivative of
   the first. Additional unit tests could be addded.

2. End-to-end tests. This ensures that all virtual site types can be
   run, and that the trajectory of the virtual site matches the
   trajectory of the real sites, using the reference implementation.
   These tests check that the mdrun implementation agrees with the
   reference implementation, and that real and virtual site reporting
   does not get out of sync.

Note that the reference implementation also includes virtual velocities,
which are, however, not used to test simulation output yet. This will
be introduced once the new velocity definitions are implemented in
mdrun.

Refs #3866

3 years agoRework SYCL CMake machinery to be compatible with hipSYCL
Andrey Alekseenko [Mon, 15 Feb 2021 19:31:21 +0000 (22:31 +0300)]
Rework SYCL CMake machinery to be compatible with hipSYCL

Unlike DPCPP, hipSYCL (and ComputeCPP) offer its own CMake package.
This package has a nice `add_sycl_to_target` function to indicate which
source files must be compiled with SYCL and which target must be linked
with appropriate libraries.

Such function is rather trivial for DPCPP, so, in the interest of
homogeneity, we add it here.

3 years agoMake the restraint history const during force calculation
Pascal Merz [Sun, 14 Feb 2021 20:19:32 +0000 (13:19 -0700)]
Make the restraint history const during force calculation

The history is updated later, and is read-only within the force
routines. Adds a few const qualifiers to clarify this.

Refs #3430

3 years agoFix clang-tidy-11 for topology module
Paul Bauer [Mon, 15 Feb 2021 09:45:02 +0000 (09:45 +0000)]
Fix clang-tidy-11 for topology module

Part of updates for clang-tidy changes to require variable
initialization.

3 years agoExpose mk_nbfp and make_ljpme_c6grid.
Sebastian Kehl [Mon, 15 Feb 2021 08:42:56 +0000 (09:42 +0100)]
Expose mk_nbfp and make_ljpme_c6grid.

Expose mk_nbfp and make_ljpme_c6grid from 'mdlib/forcerec.cpp'
in 'mdlib/forcerec.h'.

Thereby rename:
mk_nbfp           -> makeNonBondedParameterLists
make_ljpme_c6grid -> makeLJPmeC6GridCorrectionParameters

3 years agoFix release docs build
Paul Bauer [Fri, 12 Feb 2021 09:45:15 +0000 (10:45 +0100)]
Fix release docs build

The change to python handling for the documentation build was not
propagated to the release builds.

3 years agoFix leaked memory created in make_ljpme_c6grid.
Sebastian Kehl [Fri, 12 Feb 2021 19:24:47 +0000 (19:24 +0000)]
Fix leaked memory created in make_ljpme_c6grid.

3 years agoAdd gmx::isPowerOfTwo function
Andrey Alekseenko [Fri, 12 Feb 2021 15:42:10 +0000 (15:42 +0000)]
Add gmx::isPowerOfTwo function

A follow-up from a discussion in !1080.

3 years agoMerge branch release-2021 into master
Mark Abraham [Fri, 12 Feb 2021 14:24:31 +0000 (15:24 +0100)]
Merge branch release-2021 into master

No content, because that was accidentally squashed into commit
a660b04e8d8756ed9c4d.

3 years agoRemove unused function
Paul Bauer [Fri, 12 Feb 2021 09:48:26 +0000 (10:48 +0100)]
Remove unused function

This was leftover from the tree-reduce algorithm removal.

3 years agoImprove CUDA codegen flags
Mark Abraham [Fri, 12 Feb 2021 13:02:37 +0000 (13:02 +0000)]
Improve CUDA codegen flags

- onnly generate PTX for an early and the latest arch (3.5 and 8.0)
- add binary 8.0 and 8.6 targets

3 years agoMove virtual site calculation
Pascal Merz [Fri, 12 Feb 2021 08:02:58 +0000 (08:02 +0000)]
Move virtual site calculation

The previous implementation would lead to slight inaccuracies when
virtual positions were calculated before shifting positions in
pressure coupling algorithms. This change moves the calculation to the
top of the loop, right before DD and force calculation.

This also removes an unnecessary call to the virtual site construction
in rerun. That call was placed after force calculation and trajectory
writing, so had no influence since coordinates for the next step are
read from file. Since virtual sites are constructed when reading
coordinates from file, the results should have been correct anyway, the
call just had no influence.

This also moves the call to the virtual site construction in MiMiC.
Similar to the rerun case, the current call happened after virtual
sites are used. This call has been moved to right after the coordinates
are received. This is likely to have lead to wrong results when using
MiMiC with virtual sites.

Refs #3866

3 years agoUse unique_ptr for tables
Joe Jordan [Thu, 11 Feb 2021 18:21:13 +0000 (18:21 +0000)]
Use unique_ptr for tables

Instead of returning a raw pointer, make_tables now returns a unique_ptr.

3 years agoFix clang-tidy-11 errors in NBNXM module, part 3
Andrey Alekseenko [Thu, 11 Feb 2021 13:49:29 +0000 (13:49 +0000)]
Fix clang-tidy-11 errors in NBNXM module, part 3

Refs #3897

3 years agoDisable cos acceleration for non leap-frog code paths
Pascal Merz [Thu, 11 Feb 2021 06:23:24 +0000 (23:23 -0700)]
Disable cos acceleration for non leap-frog code paths

The cos acceleration is only applied in leap-frog. grompp and mdrun
would, however, happily accept non-zero cos-accel input, and report
viscosity-related quantities without ever applying the acceleration
for all other integrators.

This change adds a check at grompp time (to avoid new tprs with
non-implemented parameter combinations being created), and at
runner time (to catch older tprs). Should probably be backported
to the supported releases.

Refs #3903

3 years agoSafer handling of empty cells in Grid::sortColumnsCpuGeometry
Andrey Alekseenko [Tue, 9 Feb 2021 20:13:01 +0000 (23:13 +0300)]
Safer handling of empty cells in Grid::sortColumnsCpuGeometry

When the number of atoms is low, NBNXM grid can contain empty cells.
Previously, this caused the value of numAtomsCell in
Grid::sortColumnsCpuGeometry to become negative, and we were calling
Grid::fillCell with atomEnd < atomStart.

It did not cause any bugs as far as I observed, but is slightly
dangerous and couterintuitive behavior.

For example, such situation happens in
./bin/mdrunfep-test --gtest_filter=FreeEnergyCalculationsAreEquivalentToReference/FreeEnergyReferenceTest.WithinTolerances/coulandvdwsequential_coul_s

3 years agoFix MPI build
Artem Zhmurov [Thu, 11 Feb 2021 11:19:52 +0000 (11:19 +0000)]
Fix MPI build

In the change that made clang-tidy-11 happy for domdec
(0af8a86a3c9556b2dc8fbd4c9f2a430c5cd58982) the MPI_Comm
were set to nullptr, although they are not pointers.

3 years agoUse GmxManageMPI variables for gmxapi.
M. Eric Irrgang [Mon, 8 Feb 2021 15:55:14 +0000 (18:55 +0300)]
Use GmxManageMPI variables for gmxapi.

For minimal disruption to the release-2021 infrastructure,
let the `gmxapi` CMake target (libgmxapi) use
`${MPI_COMPILE_FLAGS}` and `${MPI_C_LIBRARIES}`
instead of the `MPI::MPI_*` target(s).

Note: This will conflict with the resolution to #3672.
Conflicts arising in a merge from `release-2021` to `master`
should defer to `master`.

Fixes #3896

3 years agoAllow specific diagonostic ignore for GCC only
Pascal Merz [Wed, 10 Feb 2021 21:48:49 +0000 (14:48 -0700)]
Allow specific diagonostic ignore for GCC only

GCC diagonstic pragmas will by default also be read by clang, but clang
and GCC don't always use the same warnings. Example: clang doesn't
understand "-Wunused-but-set-parameter" which GCC uses.

Needed for implementation of #3866.

3 years agoPrepare changes to docker images for python packages
Paul Bauer [Thu, 11 Feb 2021 09:21:32 +0000 (09:21 +0000)]
Prepare changes to docker images for python packages

Python package handling for things currently added manually to the
system python are moved to the virtual environments instead. This
affects the sphinx and gcovr packages.

3 years agoFix gmx_rmpbc_init with InteractionDefinitions
Berk Hess [Wed, 10 Feb 2021 10:38:47 +0000 (11:38 +0100)]
Fix gmx_rmpbc_init with InteractionDefinitions

Molecules were not made whole when gmx_rmpbc_init with
InteractionDefinitions. This caused all trajectoryanalysis tools
not to make molecules whole.

Fixes #3900

3 years agoFix llvm build in docker container
Paul Bauer [Wed, 10 Feb 2021 07:49:31 +0000 (07:49 +0000)]
Fix llvm build in docker container

We still need to be able to rebuild containers if needed.

3 years agoFix clang-tidy-11 errors in NBNXM module, part 4
Andrey Alekseenko [Tue, 9 Feb 2021 16:03:14 +0000 (19:03 +0300)]
Fix clang-tidy-11 errors in NBNXM module, part 4

Refs #3897

3 years agoFix clang-tidy-11 errors in NBNXM module, part 1
Andrey Alekseenko [Wed, 10 Feb 2021 07:42:07 +0000 (07:42 +0000)]
Fix clang-tidy-11 errors in NBNXM module, part 1

In some cases, extracted problematic pieces into static functions to
simplify the logic.

3 years agoRe-fix md-vv Trotter kinetic energy and temperature
Pascal Merz [Mon, 30 Nov 2020 23:37:38 +0000 (16:37 -0700)]
Re-fix md-vv Trotter kinetic energy and temperature

!270 reintroduced bug #3832.

3 years agoSYCL compilation and code compatibility changes
Andrey Alekseenko [Tue, 9 Feb 2021 09:32:47 +0000 (09:32 +0000)]
SYCL compilation and code compatibility changes

- Split SYCL device kernels into separate compilation modules

By default (no split), all the kernels are put into a single compilation unit.
With the upcoming 168 flavors of NBNXM kernel, the JIT compilation
adds 6-10 minutes to each launch of _any_ program using _any_ SYCL kernel, because
all existing kernels (even unused ones) are compiled.

With this change, only actually invoked kernels are JIT-compiled (although not
cached), making the overhead much more manageable.

This cost can be moved to the compile-time by using flags like
`-fsycl-targets=spir64_x86_64-unknown-unknown-sycldevice`.
But it will require having the OpenCL runtime installed on the compilation host.

- Expose Intel SYCL extensions in a manner compatible with SYCL2020.

Intel DPCPP compiler has some of the 2020 features in its sycl::ONEAPI
namespace, and some of them have different names. Meanwhile, hipSYCL has
same functions in cl::sycl proper. Here, we create our own sycl_2020
namespace, and put all these functions there.

- Silence warning from icpx

It seems to be a false positive, not emitted by the manually compiled
llvm from Intel's repo.

- Don't check USM in CMake stage

We don't currently use USM, and, for some reason, this code fails to
compile with hipSYCL. Since we only want to check compilation at the
CMake stage, there is little sense in putting complicated code there.

3 years agoFix SYCL clearDeviceBufferAsync<float3>
Andrey Alekseenko [Mon, 8 Feb 2021 16:29:55 +0000 (19:29 +0300)]
Fix SYCL clearDeviceBufferAsync<float3>

Per SYCL 1.2.1 and 2020 (provisional), cl::sycl::handler::fill only
works for scalars and SYCL vectors, not custom types, like gmx::RVec. It
actually worked fine on OpenCL CPU and host, but not on OpenCL GPU. So,
a simple wrapper that reinterprets the buffer as array of float's is
added.

3 years agoName streams after locality
Artem Zhmurov [Tue, 9 Feb 2021 12:21:03 +0000 (15:21 +0300)]
Name streams after locality

This renames the deviceStream into localStream to be more verbose
in naming.

3 years agoFix clang-tidy-11 errors in NBNXM module, part 2
Andrey Alekseenko [Tue, 9 Feb 2021 13:13:37 +0000 (13:13 +0000)]
Fix clang-tidy-11 errors in NBNXM module, part 2

In some cases, extracted problematic pieces into static functions to
simplify the logic. Maybe a bit too much here, but, I believe, it improves readability.

Also fixed some grammar.

Refs #3897

3 years agoMake temperature and pressure coupling enums enum classes
Pascal Merz [Tue, 9 Feb 2021 10:06:15 +0000 (10:06 +0000)]
Make temperature and pressure coupling enums enum classes

This makes the plain enums denoting the temperature and pressure
coupling enums enum classes. Most of this change is simple renaming,
changing etcXXX into TemperatureCoupling::XXX, and epcXXX into
PressureCoupling::XXX.

As these are the first of many enums in md_enums.h being refactored
into enum classes, this also introduces some reusable functionality,
including a templated function mapping enums to a string representing
the functionality, and helper functions used when reading inputrec
from file or comparing inputrec instances.

This keeps explicit static_casts from / to int in two places: When
serializing the inputrec, and when transferring the values over
multiple simulations.

3 years agoRemove tree-reduce algorithm
Mark Abraham [Tue, 9 Feb 2021 06:08:05 +0000 (07:08 +0100)]
Remove tree-reduce algorithm

This was formerly used only on the now-removed MIC platform. It could
well be useful these days with high core counts on conventional CPU
platforms, but it is likely that something else will prove limiting to
MD step thread scaling before that point. If we ever want it back,
then git will remember it, and we'd probably re-implement it on
different infrastructure anyway.

No need for release notes, as it was not something intended for users
to use.

Renamed the "standard" reduction function now that there is no need to
distinguish it from the tree reduction.

Part of #3982
Fixes #3891

3 years agodispatchTemplatedFunction: dispatch by bool
Andrey Alekseenko [Tue, 9 Feb 2021 06:15:36 +0000 (06:15 +0000)]
dispatchTemplatedFunction: dispatch by bool

Add support of boolean template parameters of the subject function in
dispatchTemplatedFunction.

3 years agoFix clang-format
Artem Zhmurov [Tue, 9 Feb 2021 05:33:13 +0000 (08:33 +0300)]
Fix clang-format

2d567afadf39d215950455d46056745474b850c0 was finalized by applying
suggestion in the GitLab GUI, which did not adhere to clang-format
policy.

3 years agoFix range check bug in gmx covar
Paul Bauer [Tue, 9 Feb 2021 05:14:34 +0000 (05:14 +0000)]
Fix range check bug in gmx covar

Range checking was done the wrong way around.

Fixes #3902

3 years agoTag images on the branch as release-2021
Paul Bauer [Mon, 8 Feb 2021 17:40:49 +0000 (17:40 +0000)]
Tag images on the branch as release-2021

This makes sure we can change images for master without affecting the
stable branch.

Refs #3716

3 years agoDisable FPE for SYCL builds
Andrey Alekseenko [Fri, 18 Dec 2020 13:39:51 +0000 (13:39 +0000)]
Disable FPE for SYCL builds

Intel Graphics Compiler triggers FPEs inside its JIT. We can more
selectively call gmx_fedisableexcept only iff we are running on
Intel's GPU, but, to me, a more predictable approach seems friendlier.

Also, refactored the two complex PP conditions into a separate function.
It's only called once at program launch, so function call overhead
should not be an issue.

3 years agoFix clang-tidy-11 for trajectoryanalysis
Paul Bauer [Mon, 8 Feb 2021 12:23:12 +0000 (12:23 +0000)]
Fix clang-tidy-11 for trajectoryanalysis

Make sure the module conforms to clang-tidy-11.

Refs #3897

3 years agoRemoved "math.h" included from clang-tidy
Paul Bauer [Mon, 8 Feb 2021 07:49:04 +0000 (08:49 +0100)]
Removed "math.h" included from clang-tidy

Version 11 seems to include those in the code without need.

3 years agoParametrize constraints test over the test systems
Artem Zhmurov [Mon, 8 Feb 2021 06:25:49 +0000 (06:25 +0000)]
Parametrize constraints test over the test systems

Use a pre-define set of constant test systems to prevent repetition of logic
in different tests when latter are instintiated.

3 years agoFix clang-tidy 11 warning in nbnxm ocl kernels
Szilárd Páll [Fri, 5 Feb 2021 22:00:07 +0000 (23:00 +0100)]
Fix clang-tidy 11 warning in nbnxm ocl kernels

3 years agoReplace custom implementations of GCD with std::gcd
Andrey Alekseenko [Fri, 5 Feb 2021 16:29:45 +0000 (19:29 +0300)]
Replace custom implementations of GCD with std::gcd

There is a minor implementation difference:
When any of the arguments is 0, old `lgc` functions return 1,
while std::gcd returns max of both arguments.

However, in the two cases changed here, the function is never
called with zeroes.

3 years agoAdd style code for function static variables
Mark Abraham [Sat, 6 Feb 2021 09:15:27 +0000 (09:15 +0000)]
Add style code for function static variables

These should be prefixed with `s_` just like class variables, because
the reason is the same: the reader knows immediately the scope and
lifetime.

3 years agoEnsure GoogleTest builds properly
Mark Abraham [Fri, 5 Feb 2021 14:13:57 +0000 (15:13 +0100)]
Ensure GoogleTest builds properly

Some test targets would not build without this.

Closes #3890

3 years agoClean up domdec again after clang-tidy-11 fixes
Paul Bauer [Fri, 5 Feb 2021 15:37:11 +0000 (16:37 +0100)]
Clean up domdec again after clang-tidy-11 fixes

Previous fixes have been incomplete and introduced a bug.

3 years agoClang-tidy-11 fixes for utility
Paul Bauer [Fri, 5 Feb 2021 15:58:27 +0000 (15:58 +0000)]
Clang-tidy-11 fixes for utility

Fixes have been missing from previous fixes.

Refs #3897

3 years agoUpdated logos
Cathrine Bergh [Fri, 5 Feb 2021 15:43:14 +0000 (15:43 +0000)]
Updated logos

3 years agoFix clang-tidy-11 for domdec and utility
Paul Bauer [Fri, 5 Feb 2021 13:01:43 +0000 (13:01 +0000)]
Fix clang-tidy-11 for domdec and utility

Part of updates needed to conform to clang-tidy-11. Split into several
commits as it is impossible to have all changes together.

Refs #3897

3 years agoUse raw strings instead of format in docker build script
Joe Jordan [Fri, 5 Feb 2021 12:21:29 +0000 (12:21 +0000)]
Use raw strings instead of format in docker build script

Removes all instances of .format() from strings in docker build
script in favor of the more modern raw strings.

3 years agoRemove VMX SIMD
Mark Abraham [Fri, 5 Feb 2021 10:06:20 +0000 (10:06 +0000)]
Remove VMX SIMD

This catered for POWER6 architectures, which are not used in HPC.

Part of #3891

3 years agoDefine M_PI when it is not defined
Mark Abraham [Wed, 3 Feb 2021 16:20:56 +0000 (17:20 +0100)]
Define M_PI when it is not defined

This is a standard work-around (e.g. used in GROMACS) for C++ library
implementations that don't provide POSIX capabilities by default
(e.g. Cygwin).

Closes #3890

3 years agoRemove support for ARMv7 and NEON
Mark Abraham [Tue, 2 Feb 2021 09:52:59 +0000 (10:52 +0100)]
Remove support for ARMv7 and NEON

Note that ARMv8 and NEON ASIMD are unaffected.

The implementation of the SIMD library for NEON ASIMD formerly
included content from that for NEON, and sometimes then overrode it
based on preprocessor defines. This has been consolidated manually so
that there is neither duplication nor additional preprocessing needed.

Part of #3891

3 years agoRemove no longer needed macro define
Paul Bauer [Wed, 3 Feb 2021 15:18:56 +0000 (16:18 +0100)]
Remove no longer needed macro define

The __STDC_LIMIT_MACROS and __STDC_FORMAT_MACROS definitions
should no longer be necessary.

3 years agoFix refactoring issue
Mark Abraham [Wed, 3 Feb 2021 07:56:08 +0000 (08:56 +0100)]
Fix refactoring issue

The former code had short-circuit logic that is now restored. That
could only be a problem if multiple patches for the same atom had the
same name, which sounds unlikely. So probably the problem was benign.

Added doxygen and suggested future clean-up.

Refs #2833

3 years agoMake LJ combination rule enum into an enum class
Artem Zhmurov [Thu, 4 Feb 2021 09:56:25 +0000 (09:56 +0000)]
Make LJ combination rule enum into an enum class

To introduce type-safety, the combination rule for LJ is madde into
enum class. This also fixes:
1. Out-of-order string assignment to enum values
2. Unsafe utilization of the enum for LJ PME combination rule
   (the values of this enum coincided so no bug by luck)

3 years agoEnsure no UB in writing forces
Mark Abraham [Thu, 4 Feb 2021 08:26:29 +0000 (09:26 +0100)]
Ensure no UB in writing forces

UBSan observed that on non-master ranks we added an offset to a null
pointer in of->f_global. That pointer was never used, so there was no
bug, but we can improve the code by expressing that more clearly.

Ref #3897

3 years agoFix handling of tip4p in pdb2gmx
Mark Abraham [Wed, 3 Feb 2021 07:56:08 +0000 (08:56 +0100)]
Fix handling of tip4p in pdb2gmx

The former code wrote an output configuration file with an extra
spurious 'M' particle, as well as the 'MW'.

Added test coverage, which needs the full output configuration to be
checked. Made that configurable so that we have the option to check
the full configuration only when we want to.

Refs #2833
Fixes #3894

3 years agoInitialize rollingPruningNumParts in init_plist
Andrey Alekseenko [Wed, 3 Feb 2021 17:15:31 +0000 (17:15 +0000)]
Initialize rollingPruningNumParts in init_plist

Previously, rollingPruningNumParts and rollingPruningPart were not
initialized, which, in the case of an empty domain, caused access
to uninitialized memory. No particular harm was being done, but it
could trigger an assertion in gpu_launch_kernel_pruneonly during
some of the regression tests.

The whole code in the preamble of gpu_launch_kernel_pruneonly is
probably due for refactoring, but since we initialize all other
plist's fields in init_plist, we better initialize these two as well.

3 years agoUpdate llvm docker build
Paul Bauer [Wed, 3 Feb 2021 16:40:13 +0000 (16:40 +0000)]
Update llvm docker build

The LLVM project changed their repository organisation, so we have to
adjust our docker build script to take that into account.

Container for llvm 11 tested locally.

Refs #3897

3 years agoFix test of not_null
Mark Abraham [Wed, 3 Feb 2021 12:28:19 +0000 (13:28 +0100)]
Fix test of not_null

Inadvertently removed too much code

Refs #3893

3 years agoFix issues found by static analyzer
Paul Bauer [Wed, 3 Feb 2021 12:07:33 +0000 (13:07 +0100)]
Fix issues found by static analyzer

Update to version 11 found a few issues that need fixes.

Refs #3897

3 years agoRemove support for Intel classic compiler
Mark Abraham [Wed, 3 Feb 2021 10:44:20 +0000 (10:44 +0000)]
Remove support for Intel classic compiler

This compiler has sometimes generated the fastest code, but also most
often generated the wrong code of any supported compiler. Since Intel
now has another clang-based compiler that they are targetting for GPU
support in oneAPI, we've chosen to support it. Our resources are
limited so something else has to go.

Minor improvements to the install guide while I was there.

Added a fatal error to CMake as otherwise we will get bug reports that
icc doesn't work.

Added release notes

Fixes #3893

3 years agoRemove deprecated env. vars GMX_OCL_NB_ANA_EWALD etc
Andrey Alekseenko [Tue, 2 Feb 2021 13:33:20 +0000 (14:33 +0100)]
Remove deprecated env. vars GMX_OCL_NB_ANA_EWALD etc

The following environment variables were deprecated in 2021, and are
being removed:

GMX_CUDA_NB_ANA_EWALD
GMX_OCL_NB_ANA_EWALD
GMX_CUDA_NB_TAB_EWALD
GMX_OCL_NB_TAB_EWALD
GMX_CUDA_NB_EWALD_TWINCUT
GMX_OCL_NB_EWALD_TWINCUT

Closes #3803

3 years agoImprove DLB recommendation
Szilárd Páll [Tue, 2 Feb 2021 13:09:58 +0000 (13:09 +0000)]
Improve DLB recommendation

Do not recommend turning on DLB when it was turned off due to a
condition known to make it unsuitable to use in the run.

Fixes #3879

3 years agoUse make_unique instead of reset when private implementations are constructed
Artem Zhmurov [Tue, 2 Feb 2021 05:06:55 +0000 (08:06 +0300)]
Use make_unique instead of reset when private implementations are constructed

Using std::unique_ptr instead of our own implementation in PImpl classes made
compiler more aware of the code and clang-tidy started to complain about
using reset function(...) for PImpl construction.

3 years agoRemove support for Fujitsu Sparc64 HPC-ACE
Mark Abraham [Tue, 2 Feb 2021 09:44:40 +0000 (09:44 +0000)]
Remove support for Fujitsu Sparc64 HPC-ACE

The K computer is turned off, so this architecture is effectively
dead. Note that the NBNXM scheme never supported its SIMD, so even the
SIMD support in other modules was only of modest value.

Part of #3891

3 years agoFix compiler-version checks for C++17 requirements
Mark Abraham [Tue, 2 Feb 2021 09:10:44 +0000 (10:10 +0100)]
Fix compiler-version checks for C++17 requirements

175d3bb67f4 didn't update these parts

Refs #3297

3 years agoRemove x86 MIC support
Mark Abraham [Mon, 1 Feb 2021 12:16:44 +0000 (12:16 +0000)]
Remove x86 MIC support

This platform is basically dead, so code and SIMD layer that supports
it should be removed.

There is no need to preserve a stub in the SIMD support enumeration,
because we never need to be consistent with old code. That's different
for other enums that affect e.g. reading old tpr files.

Note that this does not affect KNL support or
SIMD.

Part of #3891