alexxy/gromacs.git
6 years agoUpdate treatment of GPU compatibility data structure
Mark Abraham [Wed, 25 Oct 2017 09:45:32 +0000 (11:45 +0200)]
Update treatment of GPU compatibility data structure

Now we only construct the vector of compatible GPUs once per mdrun,
and are less coupled to hw_info and gpu_info structs.

Change-Id: I181f0486d0ea1670de7a85046c94c1fef83dce17

6 years agoFixed mdp output from electric field code.
David van der Spoel [Mon, 30 Oct 2017 08:03:13 +0000 (09:03 +0100)]
Fixed mdp output from electric field code.

Added two new tests for MDP output.

Fixes #2258

Change-Id: I495454bd2349be836c1a3ef5985288a996abf20e

6 years agoFix reference mode build unused function warnings
Aleksei Iupinov [Mon, 30 Oct 2017 10:56:17 +0000 (11:56 +0100)]
Fix reference mode build unused function warnings

Change-Id: Ibd1ad83c5dbeffe86e47156d456d78ab1ab8aeeb

6 years agoRemove unused sign parameter from dih_angle()
Berk Hess [Sun, 29 Oct 2017 21:20:54 +0000 (22:20 +0100)]
Remove unused sign parameter from dih_angle()

Change-Id: I88a73ca49b6acfc59b4baf0d847aa81542a870ca

6 years agoArrayRef: Replace fromVector with subArray
Roland Schulz [Fri, 13 Oct 2017 18:49:46 +0000 (11:49 -0700)]
ArrayRef: Replace fromVector with subArray

Creating ArrayRef from iterators is potentially dangerous,
because it is incorrect for non-contiguous containers.

arrayRefFromVector(v.begin()+start, v.begin()+start+length)
is replaced with
ArrayRef<T>(v).subArray(start, length)

Also:
- Combine all conversion constructors
  Removes code duplication and makes conversion more powerful
  (e.g. base pointer or containers with allocators).
- remove fromPointers and arrayRefFromPointers
  Wasn't used by any code
- remove fromArray and replace wih arrayRefFromArray

Change-Id: I05ad6b285ece58739d9f5bce48f9ecf4ade3454e

6 years agoAdded option -water tips3p to pdb2gmx.
David van der Spoel [Fri, 13 Oct 2017 16:36:27 +0000 (18:36 +0200)]
Added option -water tips3p to pdb2gmx.

Fixes #2272

Change-Id: Ibfc63009767fd667df51ff10041791268351e1ca

6 years agoBring PME GPU/CUDA internal structure names to CamelCase
Aleksei Iupinov [Fri, 27 Oct 2017 11:01:19 +0000 (13:01 +0200)]
Bring PME GPU/CUDA internal structure names to CamelCase

This only does mechanical renaming (e.g. pme_gpu_settings_t to
PmeGpuSettings). Any meaningful renames will be done separately.

Change-Id: I7ea2af94fd0212ff6edcf433ff21842c5bbb67b0

6 years agoFix and update hw_info
Mark Abraham [Tue, 24 Oct 2017 19:59:45 +0000 (21:59 +0200)]
Fix and update hw_info

Stopped using typedef struct (so later we can put a vector into the
struct).

Managed the memory using a unique_ptr, and made the interface reflect
that it is a file static, rather than something that is owned by
e.g. the runner.

Amended docs to clarify the sense of "global."

Change-Id: I1ce9bc42e03668498051b59aaeeb9e50a9f6f762

6 years agoUse new/delete for gmx_pme_t
Aleksei Iupinov [Fri, 27 Oct 2017 13:09:04 +0000 (15:09 +0200)]
Use new/delete for gmx_pme_t

Change-Id: I176b1d26d484514c65cae412c474b65410191d38

6 years agoSimplify PME data handling in runner
Aleksei Iupinov [Thu, 26 Oct 2017 15:04:34 +0000 (17:04 +0200)]
Simplify PME data handling in runner

Differing ownership of the PME data for PME-only and other ranks
is now hidden behind a reference. gmx_pme_init() now returns
a pointer to the allocated structure.

Change-Id: Ia9c5117a0db43a6564298dd621cf9254f0423acf

6 years agoMake PME tuning logic more readable
Aleksei Iupinov [Thu, 26 Oct 2017 14:48:06 +0000 (16:48 +0200)]
Make PME tuning logic more readable

Change-Id: Ie53693a84264ed33c17894aa551cf476a3ced26b

6 years agoRemove unused PME grid dump debug functions
Aleksei Iupinov [Thu, 26 Oct 2017 11:25:23 +0000 (13:25 +0200)]
Remove unused PME grid dump debug functions

Change-Id: Iac748080fdf29e6f35ecf37de2b968e70c72605e

6 years agoFix hw detection more
Mark Abraham [Thu, 26 Oct 2017 08:36:13 +0000 (10:36 +0200)]
Fix hw detection more

gmx_hardware_detect was called in response to GoogleTest environment
SetUp function, so the cleanup for its global should occur in response
to the corresponding TearDown function. Both those should be virtual.
Thus the hardwareInfo should not be in a smart pointer called by a
destructor that might be called at a different point from TearDown.

The new getter function and the callback that handles making the first
call to it conform better to GoogleTest's recommendation to arrange to
call AddGlobalTestEnvironment from main() rather than rely on static
initialization.

Made hardwareInit a non-member function because that improves
encapsulation.

Change-Id: I2f8e14ecc1707bf31d023a4eb4fea0a20543910b

6 years agoReplace a few asserts with GMX_ASSERT's
Aleksei Iupinov [Thu, 26 Oct 2017 08:36:48 +0000 (10:36 +0200)]
Replace a few asserts with GMX_ASSERT's

Change-Id: I18e614de57fc06f3faabc687140821223bd7c4f4

6 years agoRemove defunct PME initialization error code return
Aleksei Iupinov [Thu, 26 Oct 2017 11:49:22 +0000 (13:49 +0200)]
Remove defunct PME initialization error code return

The error was never actually returned, and invalid inputs
are already treated with exceptions anyway.

Change-Id: I6063612c3a2e760fb56b7bdf5b1624ab2fc031bd

6 years agoMake release matrix work again
Mark Abraham [Mon, 9 Oct 2017 11:50:25 +0000 (13:50 +0200)]
Make release matrix work again

Seems we didn't test this matrix when we updated infrastructure some
time.

Change-Id: Ib19672db6144bb40f08d2fcace4d43dbd52e6823

6 years agoReorganize PME GPU launch
Szilárd Páll [Mon, 16 Oct 2017 18:15:25 +0000 (20:15 +0200)]
Reorganize PME GPU launch

Wrapped the first (prep/spread) and second stage (fft/gather) of PME GPU
in functions. Moved the second stage of the regular PME GPU mode to after
the nonbonded x transform to ensure that the transform can overlap with
spread even when the launch overhead of the FFT kernels is high.

Also removed TPI-related PME-GPU launch conditions as this should be
checked much earlier. Noted in the force flags docs that the current
code assumes GMX_FORCE_STATECHANGED is used only with TPI.

Change-Id: I7f765d66c6c4e7e54812b81b2dd23751af0b06b5

6 years agoNew quote
Mark Abraham [Wed, 18 Oct 2017 21:02:44 +0000 (23:02 +0200)]
New quote

Change-Id: Id1625b1c836c64a5bd1e24fbf5b3ef2b104f102d

6 years agoTeach the copyright checker about template.cpp
Mark Abraham [Tue, 24 Oct 2017 16:03:24 +0000 (18:03 +0200)]
Teach the copyright checker about template.cpp

Now it won't warn about having to ignore it when calling
uncrustify via the scripts.

Change-Id: I2d5675a1a16dc01f6f9a45440f6807319c766944

6 years agoRemove duplicate/outdated function declaration
Aleksei Iupinov [Tue, 24 Oct 2017 14:24:11 +0000 (16:24 +0200)]
Remove duplicate/outdated function declaration

Change-Id: Ie54afcc501e0658c8a29a80831ff87765e5e7786

6 years agoMove commrec duty checking into simple getters
Aleksei Iupinov [Tue, 17 Oct 2017 11:15:24 +0000 (13:15 +0200)]
Move commrec duty checking into simple getters

This isolates all reads of cr->duty, and asserts on cr->duty being valid,
allowing to refactor its assignment in later changes.

Change-Id: I9b48be06b8d2db18105619ea1acfe38aa541b622

6 years agoCorrect the page allocator description
Aleksei Iupinov [Mon, 23 Oct 2017 09:14:19 +0000 (11:14 +0200)]
Correct the page allocator description

Change-Id: Iea0190978b483ed01fc8279f34ef2a304a11b612

6 years agoEliminate some OCL/CUDA code code duplication
Szilárd Páll [Fri, 20 Oct 2017 14:37:49 +0000 (16:37 +0200)]
Eliminate some OCL/CUDA code code duplication

Atom to interaction locality conversion and atom range calculation has
been duplicated across the OpenCL and CUDA modules. As an intermediate
step this functionality is now gathered in the common header.

Change-Id: I55b1b34992621ecebed6dad0978a47553511fc87

6 years agoSplit off the NMR related analyses from gmx energy.
David van der Spoel [Tue, 23 May 2017 11:20:30 +0000 (13:20 +0200)]
Split off the NMR related analyses from gmx energy.

A new tool gmx nmr is created by straight copying code from
gmx energy to a new tool. The reason is to reduce complexity.

A few cleanups are introduced to pass the valgrind memory
test.

Added references the gmx nmr in the manual.

Change-Id: I8e4d1dec8806a0518c571d7a01c4f70de5bbbd35

6 years agoChange PME GPU gather reduction argument from boolean to enum class
Aleksei Iupinov [Fri, 20 Oct 2017 12:53:01 +0000 (14:53 +0200)]
Change PME GPU gather reduction argument from boolean to enum class

Change-Id: Idacbdfb79313ebf16cf1a7dc19435436d6366d27

6 years agoMerge "Merge branch release-2016"
Berk Hess [Sat, 21 Oct 2017 19:33:39 +0000 (21:33 +0200)]
Merge "Merge branch release-2016"

6 years agoAdd calls to the PME GPU stages
Aleksei Iupinov [Tue, 30 May 2017 14:00:35 +0000 (16:00 +0200)]
Add calls to the PME GPU stages

This adds the inactive calls to PME GPU stages both for PP+PME
and PME-only ranks.

Ref #2054

Change-Id: I5af2ab95cedff422c39592255f01205d42fc7eb7

6 years agoMerge branch release-2016
Mark Abraham [Fri, 20 Oct 2017 10:05:05 +0000 (12:05 +0200)]
Merge branch release-2016

Dropped the post-submit change because where we test
with older clang we now always specify a suitable
status for openmp.

Change-Id: I993da20856861c0b8a0888f7fa0deed8853349a8

6 years agoFix warning for confout with periodic molecules
Berk Hess [Wed, 18 Oct 2017 18:18:31 +0000 (20:18 +0200)]
Fix warning for confout with periodic molecules

With periodic molecules, mdrun would, incorrectly, attempt to make
molecules whole for writing the final state to confout.

Fixes #2275

Change-Id: Ib19ca5c2ae6fcca6126773bcdd8a05c8e141c3ce

6 years agoDisable OpenMP with clang 3.4 post-submit config
Szilárd Páll [Thu, 19 Oct 2017 16:53:04 +0000 (18:53 +0200)]
Disable OpenMP with clang 3.4 post-submit config

This avoid a CMake warning which we now parse and catch in jenkins.

Fixes #2277

Change-Id: Id129f9907af32bdecfe07c4ca37d4cb7376d79e2

6 years agoRemove unised OpenCL debugging helpers
Szilárd Páll [Tue, 17 Oct 2017 18:29:58 +0000 (20:29 +0200)]
Remove unised OpenCL debugging helpers

This also helps avoid -Wmissing-declarations in OpenCL utils module.

Change-Id: I16584fca485790e98fd3865ac65c06ac78d58194

6 years agoMade CUDA PME texture reference conditional
Berk Hess [Mon, 16 Oct 2017 07:24:05 +0000 (09:24 +0200)]
Made CUDA PME texture reference conditional

Without texture support we should not reference textures.
Also added const struct to textures.

Change-Id: I1ca4e534da7b9130d12fd6831c119d2139eb16eb

6 years agoFixed missing entries in nrnb arrays.
David van der Spoel [Tue, 17 Oct 2017 20:26:21 +0000 (22:26 +0200)]
Fixed missing entries in nrnb arrays.

Some nrnb index entries were missing in the interaction_function
array, others were zero leading to that the wrong megaflops
accounting was printed.

Fixes #2274

Change-Id: Ic0b05d30eb5fdfeb7f3e822b42ec7ca4cda58bc5

6 years agoMerge branch release-2016
Mark Abraham [Mon, 16 Oct 2017 06:10:34 +0000 (08:10 +0200)]
Merge branch release-2016

Change-Id: Ia56e987f52e4dee425b12b02940ad9ca18d0c13a

6 years agoImprove vsite parallel checking
Berk Hess [Sun, 24 Sep 2017 20:27:02 +0000 (22:27 +0200)]
Improve vsite parallel checking

The vsite struct now stores internally whether it has been configured
with domain decomposition. This allows for internal checks on valid
commrec, which have now been added.
The vsite constructor now initializes to atom range to invalid values,
so we can check that the thread splitting has been called before
constructing. This would have caught bug #2257.
Removed the vsite struct from the global construct function argument
list, which simplifies the vsite code in several places and
fixes #2257.

Also some general clean-up: removed some snews, added some camelCasing
and doxygen documentation.

More renaming would be beneficial, but should be a separate commit.

Change-Id: I467ec8b8ebfa0da090d4ac0a1d096ad9fab87eb5

6 years agoRelax PME spline computation tolerance in double precision tests
Aleksei Iupinov [Fri, 13 Oct 2017 09:50:19 +0000 (11:50 +0200)]
Relax PME spline computation tolerance in double precision tests

Change-Id: I8c3502dd84e21d20be057d47d4afa589d779eb90

6 years agoUpdate tests for C++11 compiler and standard library
Mark Abraham [Thu, 9 Feb 2017 10:49:38 +0000 (11:49 +0100)]
Update tests for C++11 compiler and standard library

We've started using some more features, so broaden the
range of things for which we check at cmake time.

Also made an explicit error message for older icc that can't handle
newer gcc standard libraries, since this might come up a few times.

Fixes #2116

Change-Id: I3656edb3f7e6f81bbf6ed3ed764bcac56802f87f

6 years agoReplace all ConstArrayRef with ArrayRef<const T>
Roland Schulz [Wed, 4 Oct 2017 06:48:49 +0000 (23:48 -0700)]
Replace all ConstArrayRef with ArrayRef<const T>

1) Remove the alias itself in arrayref.h.
2) All replacements done automatically using sed:
s#ConstArrayRef<const char \*>#ArrayRef<const char *const>#
s#ConstArrayRef<\(.*\)>#ArrayRef<const \1>#

This worked because "const char*" was the only pointer type used as
template argument.

Change-Id: I5eba895a5dc235b95d77670b4f258e423f64f3b8

6 years agoSpecialize ArrayRef for SimdReal
Roland Schulz [Fri, 22 Sep 2017 20:43:50 +0000 (13:43 -0700)]
Specialize ArrayRef for SimdReal

ArrayRef<SimdReal> maps to a range of aligned memory and returns a
Simd type from operator[] (more precisely a reference to a Simd type).
This allows to iterate over memory and not have to explicitly call
load/store while also avoiding undefined behavior (strict aliasing rule)
caused by casting between reals and SimdReals.

Change-Id: I3d00df088669dacc810052cbcaebe15e62e1d530

6 years agoDo not include headers related to ObservablesHistory
Magnus Lundborg [Tue, 10 Oct 2017 12:13:45 +0000 (14:13 +0200)]
Do not include headers related to ObservablesHistory

Define  destructor for ObservablesHistory to avoid having to include
many extra headers.

Change-Id: I2681b519ace728dc494f967d17db5478af09f5df

6 years agoFix cpuinfo on clang + non-x86
Mark Abraham [Tue, 10 Oct 2017 09:22:02 +0000 (09:22 +0000)]
Fix cpuinfo on clang + non-x86

Compilers that pretend to be GCC often define such symbols, and the
support for inline assembly does not compile e.g. on ARM. This broke
CPU detection at cmake time, and subsequent compilation. Probably
introduced by commit 863768a4dad. The latest ARM compiler is based on
clang, so we should fix this.

Also de-duplicated some use of compiler target defines

Change-Id: Ia21363b9c0fe112762750d93b9feea267a34319f

6 years agoRemove the size_t from the PME gather CUDA kenels
Szilárd Páll [Thu, 12 Oct 2017 15:52:15 +0000 (17:52 +0200)]
Remove the size_t from the PME gather CUDA kenels

Change-Id: If53b9eabc1ac081b33933cc773b5ea932c9e8392

6 years agoRemove useless extern CUDA texture reference declarations from PME
Aleksei Iupinov [Thu, 12 Oct 2017 11:00:59 +0000 (13:00 +0200)]
Remove useless extern CUDA texture reference declarations from PME

These are only accessed from the same compilation unit (pme-spread.cu)
on the device side, and the host side is only using nearby getters.

Change-Id: Ie846193c71142ff5e519e990ef1155b534546a9b

6 years agoRevert "Drop NB_ from GMX_CUDA_NB_SINGLE_COMPILATION_UNIT cmake define"
Aleksei Iupinov [Thu, 12 Oct 2017 10:31:45 +0000 (12:31 +0200)]
Revert "Drop NB_ from GMX_CUDA_NB_SINGLE_COMPILATION_UNIT cmake define"

This reverts commit 3880255b0, which was made in confusion
stemming from combination of multiple CUDA compilation units,
disabling CUDA textures, and NB CUDA module structure.
The define in question is actually NB-exclusive,
and PME with CUDA does not need to check it to declare
extern texture references. As PME textures are not accessed
from different PME kernels, those extern declarations are removed
in the child change Ie846193c71142ff5e519e990ef1155b534546a9b.

Change-Id: I75a0e62bc92c7161ba0fbf00d8db2f35cef80bc7

6 years agoSimplify virial handling
Berk Hess [Sat, 30 Sep 2017 21:10:06 +0000 (23:10 +0200)]
Simplify virial handling

The force and virial are tightly connected. This is now expressed
through the new ForceWithVirial object, which is used for algorithms
that compute a separate virial contribution. This clarifies and
simplifies the core mdrun code in several places.

Change-Id: If0f65f1a6f67fb3efc5e4637a183faf4abd5f969

6 years agoRequire template parameter for load function
Roland Schulz [Fri, 6 Oct 2017 23:36:50 +0000 (16:36 -0700)]
Require template parameter for load function

The implicit conversion from load(float*) to both float
and SimdFloat caused multiple issues. The primary ones:
- Extra complexity in the implementation of traits, ArrayRef, SimdReference
- required compiler tests for ambiguity
- SimdReal x = f(load(m)) //confusing broadcast if f is scalar function
- x = s*load(m) //error-prone scalar multiply if s is scalar

New syntax in templated function is load<T>(m) and in non-templated function
load<SimdReal>(m). While this is slightly longer by itself, it is clearer
and doesn't require to store values in tempories (no ambigious overload errors).

Also avoids the need for the load proxies.

Change-Id: I8109e9365e956aaea428ec338b6a810444e03d77

6 years agoUse tag for simdLoad
Roland Schulz [Sat, 7 Oct 2017 00:34:02 +0000 (17:34 -0700)]
Use tag for simdLoad

Use same simdLoad name for all types. In preparation
for removing the need for SimdLoadProxyInternal.

C++ doesn't support template specialization for
function thus making simdLoad have a template argument
and specialize on it doesn't work. By passing a tag as
a 2nd argument std overloading can be used.

Change-Id: Iaf42ebb74a3347787bcac3bdfd0ef11db1e333bf

6 years agoIntroduced header for communication to/from PME ranks
Mark Abraham [Thu, 13 Apr 2017 23:31:46 +0000 (01:31 +0200)]
Introduced header for communication to/from PME ranks

No functionality changes. This cleans up some structure, and will be
useful for some modernization, use of std::vector, and then new
allocation strategies to suit PME on GPUs.

Eliminated some things in pme-internal.h by moving some declarations
to a header that can be included by the only two source files that are
interested in PP-PME communication. Now gmx_pmeonly() doesn't have to
pass around a large pile of arguments.

Removed a use of typedef struct, and some function parameter types
that no longer need to specify struct in C++.

Removed some unused PP_PME_* constants.

Change-Id: I51629fb6d91b3a486ef24d1f60065e65261d0376

6 years agoFix clang warnings for PME CUDA kernels
Aleksei Iupinov [Wed, 11 Oct 2017 16:16:07 +0000 (18:16 +0200)]
Fix clang warnings for PME CUDA kernels

Change-Id: I28f67c70b1ff4611f2456a5935a727c49e10e691

6 years agoRelax PME solving test complex grid tolerance
Aleksei Iupinov [Wed, 11 Oct 2017 16:28:24 +0000 (18:28 +0200)]
Relax PME solving test complex grid tolerance

PME CUDA solving change (Ic610e7f) tightened the output grid
tolerance from 50 down to 16 ULPs, making one of the LJPME tests
fail in post-submit. This change relaxes the tolerance to 40 ULPs.

Change-Id: Icd0c1aff868e2d1ecb76522a1a2174b3156fc356

6 years agoCleaned up ewaldcoeff for PME-only ranks
Mark Abraham [Fri, 14 Apr 2017 02:23:44 +0000 (04:23 +0200)]
Cleaned up ewaldcoeff for PME-only ranks

Earlier, runner initializes all kinds of PME ranks with the initial
values of Ewald coefficients. The values passed to gmx_pmeonly were
never read - the variables are used only to store new values, which
happens when the PP rank directs the PME grid to switch grids during
load balancing.

Change-Id: Ibe581a7111239f28f874b43dc13dcc6abd025b60

6 years agoCUDA 9/Volta support for PME
Aleksei Iupinov [Fri, 25 Aug 2017 17:16:13 +0000 (19:16 +0200)]
CUDA 9/Volta support for PME

Change-Id: Icd5cdf16f9118347179dfcbdd162f0cb39cbdd69

6 years agoPME solving - CUDA kernel + unit tests
Aleksei Iupinov [Tue, 7 Feb 2017 14:01:54 +0000 (15:01 +0100)]
PME solving - CUDA kernel + unit tests

The CUDA implementation of PME solving is added in pme-solve.cu.
The unit tests for PME CPU solving are extended to work with the CUDA kernel,
using the same reference data.
The CUDA solver supports 2 grid dimension orders: YZX and XYZ
(unlike the CPU one which only supports YZX). This is also tested.
Lennard-Jones solving is not implemented.
The tests iterate over all Gromacs-compatible CUDA GPUs.

Refs #2054

Change-Id: Ic610e7f077f39a64089dd9b80df9905094b10459

6 years agoChange to modules for build of web documentation
Paul Bauer [Mon, 9 Oct 2017 07:48:51 +0000 (09:48 +0200)]
Change to modules for build of web documentation

The modules loaded to build the web documentation with Sphinx have been
incorrect for the minimum version specified by the configuration file.
In particular, the imgmath extension had not been available for
version 1.3 that was indicated as being the minimum version. As
there are no references that I found to any math macros in the files
used to build the docs, I removed the extension to make sure it will
build again. It might be better to have a conditional there, building the
docs without imgmath when using lower versions of sphinx, and having it
active for higher versions.

Changed to require 1.4.1 for now, and added variables that set it
automatically from the information passed to cmake.

Change-Id: Ia329575288e5d622b8e679d76b63759bae54a3b0

6 years agoPME force gathering - CUDA kernel + unit tests
Aleksei Iupinov [Fri, 27 Jan 2017 14:49:55 +0000 (15:49 +0100)]
PME force gathering - CUDA kernel + unit tests

The CUDA implementation of PME force gathering for PME order 4 is added
in pme-gather.cu. The unit tests for PME CPU force gathering
(d20a5d36) are extended to work with the CUDA kernel, using
the same reference data. The tests iterate over all Gromacs-compatible
CUDA GPUs.

Ref #2054

Change-Id: I162e3a14cb9aa8ddeac17c5ad1ca709df72b8986

6 years agoDrop NB_ from GMX_CUDA_NB_SINGLE_COMPILATION_UNIT cmake define
Aleksei Iupinov [Fri, 6 Oct 2017 14:47:42 +0000 (16:47 +0200)]
Drop NB_ from GMX_CUDA_NB_SINGLE_COMPILATION_UNIT cmake define

Update the messages as well; the build setting should not be NB-exclusive.

Change-Id: I6b730ed7471253d50ce3294de86a1e3ce2733210

6 years agoPME spline+spread CUDA kernel and unit tests
Aleksei Iupinov [Mon, 5 Dec 2016 16:36:09 +0000 (17:36 +0100)]
PME spline+spread CUDA kernel and unit tests

The CUDA implementation of PME spline computation and charge spreading
for PME order 4 is added in pme-spread.cu.

The unit tests for PME CPU spline/spread stages
(e8cf7c0) are also extended to work with
the PME CUDA kernel, using the same reference data.
The tests iterate over all CUDA GPUs which are compatible with Gromacs.

Refs #2054, #2092.

Change-Id: If5ec49f030b9b94395db28fa454ea25c3efb05d1

6 years agoUse clang-5 in Jenkins
Mark Abraham [Tue, 12 Sep 2017 09:34:54 +0000 (11:34 +0200)]
Use clang-5 in Jenkins

Change-Id: Ibff723750ff66629da5066c4de43ed3de1198f19

6 years agoDisable ARM Neon native rsqrt iteration
Berk Hess [Mon, 9 Oct 2017 12:07:10 +0000 (14:07 +0200)]
Disable ARM Neon native rsqrt iteration

Fixes #2261

Change-Id: Iebcdb3f85506b8159c06d9a9a5cb5f5c81ba11c9

6 years agoRemove some unnecessary includes from PME
Aleksei Iupinov [Mon, 9 Oct 2017 10:47:26 +0000 (12:47 +0200)]
Remove some unnecessary includes from PME

Change-Id: I16da782c6c889fdde6ed81044803edfb367624b3

6 years agoPME GPU/CUDA data framework.
Aleksei Iupinov [Mon, 26 Sep 2016 10:53:29 +0000 (12:53 +0200)]
PME GPU/CUDA data framework.

This patch adds most of the PME GPU data handling routines
(pme.h and pme-gpu.cpp / pme.cu(h) / pme-gpu-internal.h/cpp),
data structures used on host and on device
(pme-gpu-types.h / pme.cuh).
The PME GPU kernels and their host code will live in separate files.
There is also cuFFT code (pme-3dfft.cu(h)) and
optional CUDA timing events (pme-timings.cu(h)) included.
Currently this is a dead code, PME GPU is not actually getting initialized
as the corresponding enum is always set for CPU path, which is asserted.

Change-Id: I9b03f54a2412885e25ea27f17bf2dca1b01f9f78

6 years agoTell cppcheck that .cpp and .cu files are c++
Mark Abraham [Sat, 7 Oct 2017 12:57:56 +0000 (14:57 +0200)]
Tell cppcheck that .cpp and .cu files are c++

This will avoid known strange behavior with .cu files.

Fixes #2265

Change-Id: I06850509afa11a531fe9b7063368614c81f4a7d1

6 years agoRefactor load+SimdLoad*ProxyInternal to reduce duplication
Roland Schulz [Fri, 22 Sep 2017 17:05:02 +0000 (10:05 -0700)]
Refactor load+SimdLoad*ProxyInternal to reduce duplication

A child patch requires both the const and non-const version.
This would increase the duplication per (un/)aligned load/proxy
from 3 to 6. To avoid this, refactor here to remove the duplication.

Also remove GMX_DISALLOW_COPY_AND_ASSIGN because child patch requires it
to be copyable and macro doesn't work with templated class.

Change-Id: Ib0f6867d2ef75132a1dfa28ea761633adf7d1e8d

6 years agoAdd acceleration correction VCM mode
Berk Hess [Tue, 3 Oct 2017 11:44:37 +0000 (13:44 +0200)]
Add acceleration correction VCM mode

Minor refactoring in vcm.cpp using templating to reduce code
duplication and improve performance.

Change-Id: I560027fe6f315eede0d7aa573bc22bf12eba4c5d

6 years agoFix max_size() in allocator.h
Berk Hess [Fri, 6 Oct 2017 10:21:13 +0000 (12:21 +0200)]
Fix max_size() in allocator.h

Change-Id: I2d3c0bf2782b59d25f987ed0522d98fd1dc61e15

6 years agoAdd SIMD intrinsics version of simple update
Berk Hess [Wed, 5 Jul 2017 09:44:42 +0000 (11:44 +0200)]
Add SIMD intrinsics version of simple update

To get better performance in cases where the compiler can't vectorize
the simple leap frog integrator loop and to reduce cache pressure of
the invMassPerDim, introduced a SIMD intrinsics version of the simple
leap-frog update without pressure coupling and one T-scale factor.
To achieve this md->invmass now uses the aligned allocation policy
and is padded by GMX_REAL_MAX_SIMD_WIDTH elements.
Asserts have been added to check for the padding.

Change-Id: I98f766e32adc292403782dc67f941a816609e304

6 years agoImprove PaddedRVecVector resizing
Berk Hess [Wed, 4 Oct 2017 07:36:40 +0000 (09:36 +0200)]
Improve PaddedRVecVector resizing

PaddedRVecVector is now resized with paddedRVecVectorSize() instead
of the using natoms+1 in several places in the code.
In preparation for a SIMD intrinsics version of the integrator,
PaddedRVecVector now uses the aligned allocator and has padding
for GMX_REAL_MAX_SIMD_WIDTH width at the end.
do_force() checks for padding of coordinates and forces.

Also extended ArrayRef to allow for different allocators.

Fixes a potential nullptr issue in doPaddedRvecVector().

Change-Id: Ifb8dacf4f41b755b9981e936e462fa5823cff1d8

6 years agoAdd timing accumulation capability into GpuRegionTimer
Aleksei Iupinov [Thu, 28 Sep 2017 13:08:50 +0000 (15:08 +0200)]
Add timing accumulation capability into GpuRegionTimer

Added a TODO to deprecate NB timing structures in favor of new
functionality.

Change-Id: Idb78e5a36a7f372f01378a580a05b928bd728c57

6 years agoMake SIMD ambiguous test work with float/double only
Berk Hess [Thu, 5 Oct 2017 16:31:58 +0000 (18:31 +0200)]
Make SIMD ambiguous test work with float/double only

Fixes #2262

Change-Id: I612aea147a7808a72aa05dca44f588a60c27eea0

6 years agoRefactor scaled box handling for PME/Ewald
Szilárd Páll [Mon, 2 Oct 2017 23:55:09 +0000 (01:55 +0200)]
Refactor scaled box handling for PME/Ewald

The box scaling code for Ewald and related logic is now encapsulated in
new box scaler class. This also allows box scaling moving box scaling
it further down the call chain so that logic is reduced in do_force.

Change-Id: Ic5071b825b9d36daca5f49d6f7c6c50261af1e1b

6 years agoFix pair list array assertion
Szilárd Páll [Thu, 5 Oct 2017 01:20:10 +0000 (03:20 +0200)]
Fix pair list array assertion

Was caught by the clang CUDA build.

Refs #2259

Change-Id: I8633e48ea5c33225829f92f60c2c785f16e17aca

6 years agoAvoid -Wmissing-prototypes warnings in clang CUDA builds
Szilárd Páll [Thu, 5 Oct 2017 00:53:15 +0000 (02:53 +0200)]
Avoid -Wmissing-prototypes warnings in clang CUDA builds

Fixes #2259 partially

Change-Id: Ib47530c89cf4b3af5c2b65cfcfa39b9dfe0148b4

6 years agoMake ConstArrayRef alias to ArrayRef<const T>
Roland Schulz [Wed, 4 Oct 2017 00:32:25 +0000 (17:32 -0700)]
Make ConstArrayRef alias to ArrayRef<const T>

Removes code duplication and makes it easier to extend.

Change-Id: I4ac01e3be89bb9f2ad92937ce19e436ac7f1178b

6 years agoContinue removing -nb gpu_cpu
Mark Abraham [Mon, 2 Oct 2017 16:19:05 +0000 (18:19 +0200)]
Continue removing -nb gpu_cpu

Now that hybrid mode is gone, both local and non-local Verlet-scheme
groups use the same kernel_type and thus both nbat pointers were
always the same. Thus, there's no reason to maintain two of them.
This simplifies and slightly optimizes nbnxn_atomdata_set().

Also fixed some other docs, comments, and logic that were either
already wrong, or are useless with hybrid mode gone.

Change-Id: Id02a11a00553b1df151a1e15b934611e0e15b9f7

6 years agoFix that exp(load(x)) is ambiguous
Roland Schulz [Wed, 27 Sep 2017 22:15:46 +0000 (15:15 -0700)]
Fix that exp(load(x)) is ambiguous

Because of the template argument added by e34ead15, exp(float) was
preferred over exp(SimdFloat). This causes code which is ambiguous
to compile and creates unintuitive behavior.

Also:
- Add compile tests that these functions don't compile when they
  are used ambiguously.
- Add sqrt to scalar_math which was missing

Change-Id: Ic7582764f1fa9b644d4608536100004e5f737462

6 years agoAllow non-const access for const ArrayRef
Roland Schulz [Tue, 3 Oct 2017 19:40:09 +0000 (12:40 -0700)]
Allow non-const access for const ArrayRef

const ArrayRef<T> should not mean that the data contained in the range
is const. If it were used that way, it behave very purely as a const
object because if it is copied it looses its const. Instead
ConstArrayRef<T> (or potentially ArrayRef<const T>) should be used
consistently. This makes having const versions of operator[]/at and
begin/end/front/back confusing and inconsistent. The meaning of
const ArraryRef should be that reassigning a new range to the ref
is not allowed. To be consistent, even for a const ArrayRef non-const
access to the data should be allowed.

Change-Id: I7e921c1a5562889bfd26eb0688b475406c87857c

6 years agoRemove GPU timing functions superseded by GpuRegionTimer
Aleksei Iupinov [Thu, 28 Sep 2017 13:22:55 +0000 (15:22 +0200)]
Remove GPU timing functions superseded by GpuRegionTimer

Change-Id: I451fdd9263e87a567c8b4942a041de6950c75921

6 years agoRemove a force buffer argument from IForceProvider
Berk Hess [Fri, 29 Sep 2017 10:36:28 +0000 (12:36 +0200)]
Remove a force buffer argument from IForceProvider

For the foreseeable future force providers will produce forces that
should not go into the coord x force type virial calculation.
Therefore the old force argument is now removed and the old f_novirsum
argument is renamed to force. Also removed the confusingly named
withoutVirialContribution_ container (because providers should actually
provide the virial contributions).

Change-Id: I580ac2cef31da6c191a0852c1f3be0c9e09ea1b0

6 years agoEnable group-scheme SIMD with GMX_SIMD=AVX2_128
Mark Abraham [Sat, 15 Jul 2017 07:09:08 +0000 (09:09 +0200)]
Enable group-scheme SIMD with GMX_SIMD=AVX2_128

The group-scheme kernels can can use AVX instructions from either the
AVX_128_FMA and AVX_256 extensions. But hardware that supports the new
AVX2_128 extensions also supports AVX_256, so we those extensions
for the group-scheme kernels.

Change-Id: I7728e1d97998509368dfc456dc9c33489b6dfee5

6 years agoAdd GpuRegionTimer class
Aleksei Iupinov [Fri, 16 Jun 2017 16:04:51 +0000 (18:04 +0200)]
Add GpuRegionTimer class

GpuRegionTimer class is implemented in CUDA/OpenCL to help timing
regions of GPU code. For CUDA, it contains pair of CUDA start/stop events;
for OpenCL, it contains fixed-size array of OpenCL events, which are
passed manually into OpenCL calls within region.
Using this class, cu/cl_timers_t structures and the GPU timing code
are made a bit more uniform.

Change-Id: I8fcd7568653c5bcf3496a2bee227ae03f14a756a

6 years agoMove Ewald splitting-related code to ewald-utils
Szilárd Páll [Tue, 3 Oct 2017 14:04:46 +0000 (16:04 +0200)]
Move Ewald splitting-related code to ewald-utils

This code used to be under gromacs/math, but it is an Ewald-only
functionality, so it belongs to the Ewald module.

Change-Id: Ib2d7def243a88b09f328a8ea1bafe27dd7a783d5

6 years agoBring CUDA texture getters documentation up-to-date
Aleksei Iupinov [Tue, 3 Oct 2017 14:43:07 +0000 (16:43 +0200)]
Bring CUDA texture getters documentation up-to-date

Change-Id: Id2b588129287a0e2372fd3564f8a24513ae89e0e

6 years agoTemplate/move CUDA texture cleanup code from NB CUDA module to cudautils.cu
Aleksei Iupinov [Fri, 22 Sep 2017 13:35:28 +0000 (15:35 +0200)]
Template/move CUDA texture cleanup code from NB CUDA module to cudautils.cu

Noted TODO: easy transformation into a GPU table class.

Change-Id: I20d684221fa8304d01ab7fd4a19f2c4469110142

6 years agoEnable compiling CUDA device code with clang
Szilárd Páll [Wed, 25 Jan 2017 01:53:17 +0000 (02:53 +0100)]
Enable compiling CUDA device code with clang

clang can be used as a device compiler by setting GMX_CLANG_CUDA=ON. A
CUDA toolkit (>=7.0) is also needed. Workarounds required:
- texture operations are not supported, use the LDG/direct load-based
  fallback in such cases;
- CMake does not support natively clang for CUDA, but it's easy to
  convince it by setting CXX as compiler and few extra flags for *.cu.

Note that clang support is experimental and it is aimed at improving
portability and to allow using clang sanitizers without hassle in
CUDA builds.

TODO/investigate:
- CMake seems to not track some files properly with clang, changes
  to nbnxn_cuda_kernel{,_fermi}.cuh do not trigger a recompile (likely
  due to the indirect include through a macro in nbnxn_cuda_kernels.cuh).
- Full rebuild is triggered even if only CUDA compile flags are changed.

Change-Id: I3543469d9f0fda37c186ba8bb474980018bd5c54

6 years agoMove calling of special force functions
Berk Hess [Thu, 28 Sep 2017 21:01:14 +0000 (23:01 +0200)]
Move calling of special force functions

All special force provider algorithm functions are now collected
in computeSpecialForces(). This function is now called before
the wait for non-bondeds on the GPU. This allows for more overlap.
The only cost is potentially one extra force buffer reduction at
steps where the virial is needed, but with PME we already do that.
To achieve this, f->f_novirsum is now always set, as the
documentation already (incorrectly) stated.

This change also simplifies both do_force routines and clarifies
where special algorithms can be called, which could now actually
be anywhere in do_force().

Change-Id: I0711a379ed3c31838ede9e55c4cd5d0a95e967fd

6 years agoAdd WinAPI page size query for allocator purposes
Aleksei Iupinov [Wed, 20 Sep 2017 13:45:13 +0000 (15:45 +0200)]
Add WinAPI page size query for allocator purposes

Change-Id: I4c1e534a4b950bc38d45c40ad5598cabb2045ede

6 years agoWrite atom masses and partial charges to TNG
Magnus Lundborg [Tue, 13 Jun 2017 15:04:10 +0000 (17:04 +0200)]
Write atom masses and partial charges to TNG

B states of molecules are not yet written. Data blocks for that
must be added to TNG first.
'gmx dump' will print atom masses and partial charges along
with the molecule, if the data is available. No other utilities
use the data yet.

Refs #2188.

Change-Id: I7dd80d7b6281b2c3710fb541fa3cee6fbdcb2256

6 years agoIntroduce and use AlignedAllocationPolicy
Mark Abraham [Mon, 3 Jul 2017 17:40:10 +0000 (19:40 +0200)]
Introduce and use AlignedAllocationPolicy

This permits the allocators to be specialised with a policy class that
can vary (and report on) the alignment.

Change-Id: I875548ac325edcf07074ad35f9d90cdf561ea750

6 years agoRemove hybrid gpu+cpu nonbonded mode
Berk Hess [Wed, 9 Aug 2017 12:06:01 +0000 (14:06 +0200)]
Remove hybrid gpu+cpu nonbonded mode

This mode was not very useful, since it ran the non-local non-bonded
interactions on the CPU. The fraction of non-local interaction is set
by the domain decomposition, so this is not flexible.
Also this mode is not being tested.

Amended docs to remove ambiguous reference to hybrid mode

Change-Id: I8cdd31f228e2c0104527f66265fd06a5e971b9da

6 years agoCorrect misplaced CUDA timing event record
Szilárd Páll [Thu, 28 Sep 2017 14:22:17 +0000 (16:22 +0200)]
Correct misplaced CUDA timing event record

The event record happens after a cudaStreamWaitEvent is placed in the
non-local stream and therefore, in that stream it would include the wait
time in the measurement. However, as with DD / two streams timing can
not be performed due to the limitations of CUDA events, in practice this
was never an issue.

Change-Id: I2ca89c7acd461e480a324d40911dd4c6f5aac478

6 years agoQM/MM: remove optimization and trans. state search
tomaskubar [Mon, 18 Sep 2017 16:57:19 +0000 (18:57 +0200)]
QM/MM: remove optimization and trans. state search

These functionalities used to only work with old versions of Orca,
had very limited use and will possibly not work any longer now.
The possibility of optimization with QM/MM using the Gromacs drivers
(steep, cg, lbfgs) has been already tested,
and it will be added in a follow-up commit.
Transition state search functionality will not be available however.

This is a beginning of an attempt to clean up the QM/MM code.
A version that works with Verlet nblists is already prepared,
and will follow also.

Change-Id: Ice166dad0d4080821f1a20671fe698d549b3ce99

6 years agoMove CUDA texture setup code from NB CUDA module to cudautils.cu
Aleksei Iupinov [Fri, 22 Sep 2017 12:41:02 +0000 (14:41 +0200)]
Move CUDA texture setup code from NB CUDA module to cudautils.cu

Change-Id: I7e47a65866c29be06ce522572e90a17c775157ab

6 years agoRename GPU launch/wait cycle counters
Szilárd Páll [Thu, 21 Sep 2017 14:13:43 +0000 (16:13 +0200)]
Rename GPU launch/wait cycle counters

In preparation for the PME GPU task and GPU launch overhead to be
counted together in the same counter for all GPU tasks, the current main
counters have been renamed to be more general. The label of GPU waits in
the performance table have also been renamed to reflect the task name.
Additionally a non-bonded specific sub-counter is been added.

Change-Id: I65a15b0090c1ccebb300cf425c7b3be4100e17a0

6 years agoPut rerun state preparation in a function
Berk Hess [Sat, 23 Sep 2017 09:28:01 +0000 (11:28 +0200)]
Put rerun state preparation in a function

This is only code motion and some variable renaming.
Note that the vsite construction now constructs in the global state
pointer, but the old code asserted that this was identical to
the local state pointer.

Change-Id: I81d0bad0650eb781b68816e917814b2f97e2d529

6 years agoSet global state on master rank only
Berk Hess [Wed, 6 Sep 2017 13:48:04 +0000 (15:48 +0200)]
Set global state on master rank only

The global state class was initialized on the master rank
and broadcasted over all ranks. This lead to unnecessary communication
and it was difficult to know what part of the global state was up to
date at different points in the code.
Now only the master rank has a global state object.
This change requires conditional access to the global state pointer
for the few algorithms that use it.
Replaced bcast_state() by a function that only broadcasts x and box.
Also made the box pointer constant in domdec initialization.

Change-Id: I924487863abe096eeb0b3cbc944b4ba32898ef03

6 years agoFix grompp with Andersen massive and no COM removal
Berk Hess [Sat, 23 Sep 2017 10:15:57 +0000 (12:15 +0200)]
Fix grompp with Andersen massive and no COM removal

Fixed a floating point exception leading to a segv.
Also fixed possible different rounding for the interval for
Andersen massive in grompp in mdrun for the common case where tau_t
is a multiple of delta_t.

Fixes #2256

Change-Id: I161e8a9db2c31fde8a6e8c2fd32551b21423fd9b

6 years agoTemplate the CUDA texture setup code on raw value type T
Aleksei Iupinov [Thu, 21 Sep 2017 16:31:48 +0000 (18:31 +0200)]
Template the CUDA texture setup code on raw value type T

Change-Id: I252e1d68d263f4aca15f00863e9ed67213fdb22f

6 years agoEliminate unused Coulomb correction table size coulomb_tab_size
Aleksei Iupinov [Thu, 21 Sep 2017 15:51:49 +0000 (17:51 +0200)]
Eliminate unused Coulomb correction table size coulomb_tab_size

Change-Id: I35df7fc0590e12de8ad44791bce26cac1193065a

6 years agoEliminate duplicate CUDA texture setup code
Aleksei Iupinov [Thu, 21 Sep 2017 15:43:17 +0000 (17:43 +0200)]
Eliminate duplicate CUDA texture setup code

init_ewald_coulomb_force_table() now uses initParamLookupTable(),
which is moved higher in the file.

Change-Id: I2cb799f1b4b78c650282be37b125b3da88e98f6c

6 years agoDocument t_commrec struct
Vedran Miletić [Tue, 19 Sep 2017 17:32:41 +0000 (19:32 +0200)]
Document t_commrec struct

Describe the mysim and mygroup MPI communicators and add a note about
the communicator subsetting.

Change-Id: I2d39bd6827da59db5b3c38bd33de6903e17d0d06