option(GMX_USE_OPENCL "Enable OpenCL acceleration" OFF)
# Decide on GPU settings based on user-settings and GPU/CUDA detection.
-# GCC 4.6 requires CUDA 5.0 and VS2013 requires CUDA 6.5
+# GCC 4.6 requires CUDA 5.0 and VS2015 requires CUDA 8.0
if(MSVC)
- set(REQUIRED_CUDA_VERSION 6.5)
+ set(REQUIRED_CUDA_VERSION 8.0)
else()
set(REQUIRED_CUDA_VERSION 5.0)
endif()
clang-3.4 double no-openmp fftpack asan
# TODO move mdrun-only config to post-submit matrix
clang-3.7 double no-openmp fftpack mdrun-only
-msvc-2013 openmp release
+msvc-2015 openmp release
icc-16.0 msvc-2015 fftpack
icc-16.0 openmp mkl cmake-3.3.2 simd=avx_256
gcc-5.2 openmp simd=avx_128_fma
* MSVC supports only a subset of C99 and work-arounds are required in those cases.
* Before 7.0 (partial support in 6.5) CUDA didn't support C++11. Therefore any
header file which is needed (or likly will be nedded) by CUDA should not use C++11.
-* C++11 features which are not widely implemented (including in MSVC 2013 and GCC 4.6)
+* C++11 features which are not widely implemented (including in MSVC 2015 and GCC 4.6)
should not be used.
.. TODO: Copy important points from http://www.gromacs.org/index.php?title=Developer_Zone/Programming_Guide/Allowed_C%2B%2B_Features
* For clang: ``CFLAGS=--gcc-toolchain=/path/to/gcc/folder
CXXFLAGS=--gcc-toolchain=/path/to/gcc/folder``. This folder should
contain ``include/c++``.
-* On Windows with e.g. Intel: at least MSVC 2013 is required. Load the
+* On Windows with e.g. Intel: at least MSVC 2015 is required. Load the
enviroment with vcvarsall.bat.
For best performance, the |Gromacs| team strongly recommends you get the
It is not possible to configure both CUDA and OpenCL support in the
same version of |Gromacs|.
+Please note that MSVC 2015 is the earliest version of MSVC supported
+by |Gromacs|, but that requires at least CUDA 8 for an officially
+supported CUDA build. This will likely not occur before |Gromacs| 2016
+is released.
+
.. _mpi-support:
MPI support
5.1, and versions 14 and 15 of the Intel compiler as well as Clang
version 3.4 through 3.6. For this, we use a variety of GNU/Linux
flavors and versions as well as recent versions of Mac OS X and Windows. Under
-Windows we test both MSVC and the Intel compiler. For details, you can
+Windows we test both MSVC 2015 and the Intel compiler. For details, you can
have a look at the `continuous integration server used by GROMACS`_,
which runs Jenkins_.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2016, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/fft/fft.h"
+#include <algorithm>
#include <vector>
#include <gtest/gtest.h>
namespace
{
-//! Input data for FFT tests.
-const real inputdata[] = { //print ",\n".join([",".join(["%4s"%(random.randint(-99,99)/10.,) for i in range(25)]) for j in range(20)])
+/*! \brief Input data for FFT tests.
+ *
+ * TODO If we require compilers that all support C++11 user literals,
+ * then this array could be of type real, initialized with e.g. -3.5_r
+ * that does not suffer from implicit narrowing with brace
+ * initializers, and we would not have to do so much useless copying
+ * during the unit tests below.
+ */
+const double inputdata[] = { //print ",\n".join([",".join(["%4s"%(random.randint(-99,99)/10.,) for i in range(25)]) for j in range(20)])
-3.5, 6.3, 1.2, 0.3, 1.1, -5.7, 5.8, -1.9, -6.3, -1.4, 7.4, 2.4, -9.9, -7.2, 5.4, 6.1, -1.9, -7.6, 1.4, -3.5, 0.7, 5.6, -4.2, -1.1, -4.4,
-6.3, -7.2, 4.6, -3.0, -0.9, 7.2, 2.5, -3.6, 6.1, -3.2, -2.1, 6.5, -0.4, -9.0, 2.3, 8.4, 4.0, -5.2, -9.0, 4.7, -3.7, -2.0, -9.5, -3.9, -3.6,
7.1, 0.8, -0.6, 5.2, -9.3, -4.5, 5.9, 2.2, -5.8, 5.0, 1.2, -0.1, 2.2, 0.2, -7.7, 1.9, -8.4, 4.4, 2.3, -2.9, 6.7, 2.7, 5.8, -3.6, 8.9,
TEST_P(FFTTest1D, Complex)
{
const int nx = GetParam();
- ASSERT_LE(nx*2, static_cast<int>(sizeof(inputdata)/sizeof(real)));
+ ASSERT_LE(nx*2, static_cast<int>(sizeof(inputdata)/sizeof(inputdata[0])));
- in_ = std::vector<real>(inputdata, inputdata+nx*2);
+ in_ = std::vector<real>(nx*2);
+ std::copy(inputdata, inputdata+nx*2, in_.begin());
out_ = std::vector<real>(nx*2);
real* in = &in_[0];
real* out = &out_[0];
{
const int rx = GetParam();
const int cx = (rx/2+1);
- ASSERT_LE(cx*2, static_cast<int>(sizeof(inputdata)/sizeof(real)));
+ ASSERT_LE(cx*2, static_cast<int>(sizeof(inputdata)/sizeof(inputdata[0])));
- in_ = std::vector<real>(inputdata, inputdata+cx*2);
+ in_ = std::vector<real>(cx*2);
+ std::copy(inputdata, inputdata+cx*2, in_.begin());
out_ = std::vector<real>(cx*2);
real* in = &in_[0];
real* out = &out_[0];
const int nx = 48;
const int N = 5;
- in_ = std::vector<real>(inputdata, inputdata+nx*2*N);
+ in_ = std::vector<real>(nx*2*N);
+ std::copy(inputdata, inputdata+nx*2*N, in_.begin());
out_ = std::vector<real>(nx*2*N);
real* in = &in_[0];
real* out = &out_[0];
const int cx = (rx/2+1);
const int N = 5;
- in_ = std::vector<real>(inputdata, inputdata+cx*2*N);
+ in_ = std::vector<real>(cx*2*N);
+ std::copy(inputdata, inputdata+cx*2*N, in_.begin());
out_ = std::vector<real>(cx*2*N);
real* in = &in_[0];
real* out = &out_[0];
const int cx = (rx/2+1);
const int ny = 15;
- in_ = std::vector<real>(inputdata, inputdata+cx*2*ny);
+ in_ = std::vector<real>(cx*2*ny);
+ std::copy(inputdata, inputdata+cx*2*ny, in_.begin());
out_ = std::vector<real>(cx*2*ny);
real* in = &in_[0];
real* out = &out_[0];
local_ndata, offset, csize);
checker_.checkVector(rsize, "rsize");
checker_.checkVector(csize, "csize");
- int size = csize[0]*csize[1]*csize[2];
-
- memcpy(rdata, inputdata, size*sizeof(t_complex));
+ int size = csize[0]*csize[1]*csize[2];
+ int sizeInBytes = size*sizeof(t_complex);
+ int sizeInReals = sizeInBytes/sizeof(real);
+
+ in_ = std::vector<real>(sizeInReals);
+ // Use std::copy to convert from double to real easily
+ std::copy(inputdata, inputdata+sizeInReals, in_.begin());
+ // Use memcpy to convert to t_complex easily
+ memcpy(rdata, in_.data(), sizeInBytes);
gmx_parallel_3dfft_execute(fft_, GMX_FFT_REAL_TO_COMPLEX, 0, NULL);
//TODO use std::complex and add checkComplex for it
checker_.checkSequenceArray(size*2,
reinterpret_cast<real*>(cdata), "forward");
- memcpy(cdata, inputdata, size*sizeof(t_complex));
+ // Use std::copy to convert from double to real easily
+ std::copy(inputdata, inputdata+sizeInReals, in_.begin());
+ // Use memcpy to convert to t_complex easily
+ memcpy(cdata, in_.data(), sizeInBytes);
gmx_parallel_3dfft_execute(fft_, GMX_FFT_COMPLEX_TO_REAL, 0, NULL);
for (int i = 0; i < ndata[0]*ndata[1]; i++) //check sequence but skip unused data
{
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/* read only time names */
/* These must correspond to the time units type time_unit_t in oenv.h */
-static const real timefactors[] = { 0, 1e3, 1, 1e-3, 1e-6, 1e-9, 1e-12, 0 };
-static const real timeinvfactors[] = { 0, 1e-3, 1, 1e3, 1e6, 1e9, 1e12, 0 };
+static const real timefactors[] = { real(0), real(1e3), real(1), real(1e-3), real(1e-6), real(1e-9), real(1e-12), real(0) };
+static const real timeinvfactors[] = { real(0), real(1e-3), real(1), real(1e3), real(1e6), real(1e9), real(1e12), real(0) };
static const char *time_units_str[] = {
NULL, "fs", "ps", "ns", "us",
"\\mus", "ms", "s"
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2011,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2011,2014,2015,2016, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#ifndef GMX_FILEIO_RGB_H
#define GMX_FILEIO_RGB_H
-#include "gromacs/utility/real.h"
-
typedef struct t_rgb {
- real r, g, b;
+ double r, g, b;
} t_rgb;
#endif
const gmx_output_env_t *oenv)
{
/* also gets 3J couplings and order parameters S2 */
+ // Avoid warnings about narrowing conversions from double to real
+#ifdef _MSC_VER
+#pragma warning(disable: 4838)
+#endif
t_karplus kkkphi[] = {
{ "J_NHa1", 6.51, -1.76, 1.6, -M_PI/3, 0.0, 0.0 },
{ "J_NHa2", 6.51, -1.76, 1.6, M_PI/3, 0.0, 0.0 },
{ "JHaHb2", 9.5, -1.6, 1.8, -M_PI/3, 0, 0.0 },
{ "JHaHb3", 9.5, -1.6, 1.8, 0, 0, 0.0 }
};
+#ifdef _MSC_VER
+#pragma warning(default: 4838)
+#endif
#define NKKKPHI asize(kkkphi)
#define NKKKPSI asize(kkkpsi)
#define NKKKCHI asize(kkkchi1)
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
typedef struct {
real phi, psi, w;
} t_ppwstr;
-
+ // Avoid warnings about narrowing conversions from double to real
+#ifdef _MSC_VER
+#pragma warning(disable: 4838)
+#endif
static const t_ppwstr ppw[] = {
{ -67, -44, 0.31 },
{ -66, -41, 0.31 },
{ -54, -28, 0.46 },
{ -44, -33, 0.68 }
};
+#ifdef _MSC_VER
+#pragma warning(default: 4838)
+#endif
#define NPPW asize(ppw)
int i, j;
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2010,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2010,2014,2015,2016, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#define AA 0.081649
#define BB 0.0
#define CC 0.0577350
- const rvec matrix1[6] = {
+ const dvec matrix1[6] = {
{ AA, BB, CC },
{ AA, BB, CC },
{ AA, BB, CC },
{ -AA, BB, CC },
{ BB, AA, -CC }
};
- const rvec matrix2[6] = {
+ const dvec matrix2[6] = {
{ -AA, BB, CC },
{ BB, AA, -CC },
{ BB, -AA, -CC },
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2008, The GROMACS development team.
- * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
char atp[7] = "HCNOSX";
#define NATP (asize(atp)-1)
-real blen[NATP][NATP] = {
+double blen[NATP][NATP] = {
{ 0.00, 0.108, 0.105, 0.10, 0.10, 0.10 },
{ 0.108, 0.15, 0.14, 0.14, 0.16, 0.14 },
{ 0.105, 0.14, 0.14, 0.14, 0.16, 0.14 },
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2015, by the GROMACS development team, led by
+ * Copyright (c) 2015,2016, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
TEST(InvertMatrixTest, ComputesInverse)
{
- matrix in = {{1, 2, 3}, {-1, 2.5, 1}, {10, -2, 1.2}};
+ matrix in = {{1, 2, 3}, {-1, real(2.5), 1}, {10, -2, real(1.2)}};
matrix out;
- matrix expected = {{-0.12019230769230768,
- 0.20192307692307693,
- 0.13221153846153844},
- {-0.26923076923076916,
- 0.69230769230769229,
- 0.096153846153846145},
- {0.55288461538461531,
- -0.52884615384615374,
- -0.10817307692307691}};
+ matrix expected = {{real(-0.12019230769230768),
+ real(0.20192307692307693),
+ real(0.13221153846153844)},
+ {real(-0.26923076923076916),
+ real(0.69230769230769229),
+ real(0.096153846153846145)},
+ {real(0.55288461538461531),
+ real(-0.52884615384615374),
+ real(-0.10817307692307691)}};
invertMatrix(in, out);
TEST(InvertBoxMatrixTest, ComputesInverseInPlace)
{
- matrix in = {{1, 0, 0}, {-1, 2.5, 0}, {10, -2, 1.2}};
+ matrix in = {{1, 0, 0}, {-1, real(2.5), 0}, {10, -2, real(1.2)}};
matrix expected = {{1, 0, 0},
- {0.4, 0.4, 0},
- {-23.0/3.0, 2.0/3.0, 5.0/6.0}};
+ {real(0.4), real(0.4), 0},
+ {real(-23.0/3.0), real(2.0/3.0), real(5.0/6.0)}};
invertBoxMatrix(in, in);
{
//! Database of 51 water atom input positions (DIM reals per atom, taken from spc216.gro) for use as test inputs.
-const real g_positions[] = {
+const double g_positions[] = {
.130, -.041, -.291,
.120, -.056, -.192,
.044, -.005, -.327,
};
//! Simple cubic simulation box to use in tests
-matrix g_box = {{1.86206, 0, 0}, {0, 1.86206, 0}, {0, 0, 1.86206}};
+matrix g_box = {{real(1.86206), 0, 0}, {0, real(1.86206), 0}, {0, 0, real(1.86206)}};
//! Convenience typedef
typedef std::tuple<int, bool, bool, bool> SettleTestParameters;
gmx_settledata_t settled = settle_init(mtop);
settle_set_constraints(settled, &mtop->moltype[0].ilist[F_SETTLE], &mdatoms);
+ // Copy the original positions from the array of doubles to a vector of reals
+ std::vector<real> startingPositions(std::begin(g_positions), std::end(g_positions));
+
// Run the test
bool errorOccured;
tensor virial = {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}};
const real reciprocalTimeStep = 1.0/0.002;
csettle(settled, numThreads, threadIndex,
usePbc ? &pbcXYZ_ : &pbcNone_,
- std::begin(g_positions), updatedPositions_.data(), reciprocalTimeStep,
+ startingPositions.data(), updatedPositions_.data(), reciprocalTimeStep,
useVelocities ? velocities_.data() : nullptr,
calcVirial, virial, &errorOccured);
EXPECT_FALSE(errorOccured) << testDescription;
// MSVC does not handle extern template class members correctly even in MSVC 2015,
// so in that case we have to instantiate in every object using it.
-#if !defined(_MSC_VER) || defined(__INTEL_COMPILER)
+#if !defined(_MSC_VER)
// This is by far the most common version of the normal distribution table,
// so we use this as an extern template specialization to avoid instantiating
// the table in all files using it, unless the user has requested a different
// so in that case we have to instantiate in every object using it. In addition,
// doxygen is convinced this defines a function (which leads to crashes in our python
// scripts), so to avoid confusion we hide it from doxygen too.
-#if (!defined(_MSC_VER) || defined(__INTEL_COMPILER)) && !defined(DOXYGEN)
+#if !defined(_MSC_VER) && !defined(DOXYGEN)
// Declaration of template specialization
template<>
const std::vector<real> TabulatedNormalDistribution<real, 14>::c_table_;
static inline SimdDouble
frexp(SimdDouble value, SimdDInt32 * exponent)
{
- // Don't use _mm_set1_epi64x() - on MSVC it is only supported for 64-bit builds
const __vector double exponentMask = reinterpret_cast<__vector double>(vec_splats(0x7FF0000000000000ULL));
const __vector signed int exponentBias = vec_splats(1022);
const __vector double half = vec_splats(0.5);
* types from C99 headers `stdint.h` and `inttypes.h`. These headers are also
* there in C++11. The types and macros from here should be used instead of
* `int32_t` etc.
- * MSVC doesn't support these before Visual Studio 2013.
+ *
+ * (MSVC 2015 still doesn't support the format strings.)
*/
/*! \{ */
+typedef int32_t gmx_int32_t;
+typedef int64_t gmx_int64_t;
+typedef uint32_t gmx_uint32_t;
+typedef uint64_t gmx_uint64_t;
+
#ifdef _MSC_VER
-typedef __int32 gmx_int32_t;
#define GMX_PRId32 "I32d"
#define GMX_SCNd32 "I32d"
-typedef __int64 gmx_int64_t;
#define GMX_PRId64 "I64d"
#define GMX_SCNd64 "I64d"
-typedef unsigned __int32 gmx_uint32_t;
#define GMX_PRIu32 "I32u"
#define GMX_SCNu32 "I32u"
-typedef unsigned __int64 gmx_uint64_t;
#define GMX_PRIu64 "I64u"
#define GMX_SCNu64 "I64u"
#else
-typedef int32_t gmx_int32_t;
#define GMX_PRId32 PRId32
#define GMX_SCNd32 SCNd32
-typedef int64_t gmx_int64_t;
#define GMX_PRId64 PRId64
#define GMX_SCNd64 SCNd64
-typedef uint32_t gmx_uint32_t;
#define GMX_PRIu32 PRIu32
#define GMX_SCNu32 SCNu32
-typedef uint64_t gmx_uint64_t;
#define GMX_PRIu64 PRIu64
#define GMX_SCNu64 SCNu64
#endif
/*! \def gmx_constexpr
* \brief C++11 constexpr everywhere except MSVC 2013, where it is empty.
*
- * Support for constexpr was not added until MSVC 2015.
- * Since interacting with parts of libc++ and libstdc++ depend on it
- * (for instance the min/max calls in our random engines), we need to specify it
- * for other compilers.
+ * Support for constexpr was not added until MSVC 2015, and it still
+ * seems to be unreliable. Since interacting with parts of libc++ and
+ * libstdc++ depend on it (for instance the min/max calls in our
+ * random engines), we need to specify it for other compilers.
*/
#ifndef gmx_constexpr
-#if (!defined(_MSC_VER) || (defined(_MSC_FULL_VER) && _MSC_FULL_VER >= 190023026))
+#if !defined(_MSC_VER)
# define gmx_constexpr constexpr
#else
# define gmx_constexpr
\endcode
*/
-#if defined(_MSC_VER) && (_MSC_VER <= 1800) && !defined(__ICL)
-// For MSVC2013 and eariler we use a hack and assume an alignment of 128 bytes is sufficient in all cases
-# define GMX_ALIGNED(type, alignment) __declspec(align(128)) type
-#elif defined(__GNUC__) || defined(__clang__) || defined(__ibmxl__) || defined(__xlC__) || defined(__PATHCC__)
+#if defined(__GNUC__) || defined(__clang__) || defined(__ibmxl__) || defined(__xlC__) || defined(__PATHCC__)
// Gcc-4.6.4 does not support alignas, but both gcc, clang, pathscale and xlc
// support the standard GNU alignment attributes. PGI also sets __GNUC__ now,
// and mostly supports it.