From f6cc9b282b0e82380ef116b8d86bb4be554db4c0 Mon Sep 17 00:00:00 2001 From: Mark Abraham Date: Tue, 16 Feb 2016 23:29:17 +0100 Subject: [PATCH] Require 2015 version for MSVC C++11 support is best in this compiler in its latest version, which is an acceptable compromise for this platform. This is not good for a CUDA build, which won't officially support MSVC 2015 until CUDA 8, which is unlikely to be released before GROMACS 2016. Thus, there is likely to be a few months where CUDA-enabled GROMACS 2016 cannot be built by a supported MSVC host compiler. MSVC 2015 adds warnings for illegal implicit narrowing of double to float, when used in a brace initializer. In some cases * we intend the interpretation as real, which is now explicit * we can just use double * we can suppress the warning * in some test code, it is more convenient to initialize as double and copy Change-Id: Ic6b2f9165b6f1aaa3dc59ce05cd6ffb3abe8861c --- CMakeLists.txt | 4 +- admin/builds/pre-submit-matrix.txt | 2 +- docs/dev-manual/language-features.rst | 2 +- docs/install-guide/index.rst | 9 +++- src/gromacs/fft/tests/fft.cpp | 50 +++++++++++++------ src/gromacs/fileio/oenv.cpp | 6 +-- src/gromacs/fileio/rgb.h | 6 +-- src/gromacs/gmxana/gmx_chi.cpp | 7 +++ src/gromacs/gmxana/hxprops.cpp | 10 +++- src/gromacs/gmxpreprocess/calch.cpp | 6 +-- src/gromacs/gmxpreprocess/x2top.cpp | 4 +- src/gromacs/math/tests/invertmatrix.cpp | 28 +++++------ src/gromacs/mdlib/tests/settle.cpp | 9 ++-- .../random/tabulatednormaldistribution.cpp | 2 +- .../random/tabulatednormaldistribution.h | 2 +- .../impl_ibm_vsx/impl_ibm_vsx_simd_double.h | 1 - src/gromacs/utility/basedefinitions.h | 31 +++++------- 17 files changed, 107 insertions(+), 72 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f70c940baa..d70b099aeb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -193,9 +193,9 @@ gmx_add_cache_dependency(GMX_COOL_QUOTES BOOL "NOT GMX_FAHCORE" OFF) 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() diff --git a/admin/builds/pre-submit-matrix.txt b/admin/builds/pre-submit-matrix.txt index efe73e751e..071ef56aa9 100644 --- a/admin/builds/pre-submit-matrix.txt +++ b/admin/builds/pre-submit-matrix.txt @@ -5,7 +5,7 @@ gcc-5.1 double mpi 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 diff --git a/docs/dev-manual/language-features.rst b/docs/dev-manual/language-features.rst index ceb0e34774..d4d3a9edd8 100644 --- a/docs/dev-manual/language-features.rst +++ b/docs/dev-manual/language-features.rst @@ -11,7 +11,7 @@ these standards fully. * 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 diff --git a/docs/install-guide/index.rst b/docs/install-guide/index.rst index ecda804883..cb3ce2a7cf 100644 --- a/docs/install-guide/index.rst +++ b/docs/install-guide/index.rst @@ -110,7 +110,7 @@ supported by the compiler. To select the C++ library version use: * 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 @@ -203,6 +203,11 @@ minimum OpenCL version required is |REQUIRED_OPENCL_MIN_VERSION|. 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 @@ -1171,7 +1176,7 @@ is currently tested on x86 with gcc versions ranging from 4.6 through 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_. diff --git a/src/gromacs/fft/tests/fft.cpp b/src/gromacs/fft/tests/fft.cpp index dfe4dbd331..ca0b6d273b 100644 --- a/src/gromacs/fft/tests/fft.cpp +++ b/src/gromacs/fft/tests/fft.cpp @@ -1,7 +1,7 @@ /* * 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. @@ -46,6 +46,7 @@ #include "gromacs/fft/fft.h" +#include #include #include @@ -59,8 +60,15 @@ 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, @@ -167,9 +175,10 @@ class FFFTest3D : public BaseFFTTest TEST_P(FFTTest1D, Complex) { const int nx = GetParam(); - ASSERT_LE(nx*2, static_cast(sizeof(inputdata)/sizeof(real))); + ASSERT_LE(nx*2, static_cast(sizeof(inputdata)/sizeof(inputdata[0]))); - in_ = std::vector(inputdata, inputdata+nx*2); + in_ = std::vector(nx*2); + std::copy(inputdata, inputdata+nx*2, in_.begin()); out_ = std::vector(nx*2); real* in = &in_[0]; real* out = &out_[0]; @@ -186,9 +195,10 @@ TEST_P(FFTTest1D, Real) { const int rx = GetParam(); const int cx = (rx/2+1); - ASSERT_LE(cx*2, static_cast(sizeof(inputdata)/sizeof(real))); + ASSERT_LE(cx*2, static_cast(sizeof(inputdata)/sizeof(inputdata[0]))); - in_ = std::vector(inputdata, inputdata+cx*2); + in_ = std::vector(cx*2); + std::copy(inputdata, inputdata+cx*2, in_.begin()); out_ = std::vector(cx*2); real* in = &in_[0]; real* out = &out_[0]; @@ -210,7 +220,8 @@ TEST_F(ManyFFTTest, Complex1DLength48Multi5Test) const int nx = 48; const int N = 5; - in_ = std::vector(inputdata, inputdata+nx*2*N); + in_ = std::vector(nx*2*N); + std::copy(inputdata, inputdata+nx*2*N, in_.begin()); out_ = std::vector(nx*2*N); real* in = &in_[0]; real* out = &out_[0]; @@ -229,7 +240,8 @@ TEST_F(ManyFFTTest, Real1DLength48Multi5Test) const int cx = (rx/2+1); const int N = 5; - in_ = std::vector(inputdata, inputdata+cx*2*N); + in_ = std::vector(cx*2*N); + std::copy(inputdata, inputdata+cx*2*N, in_.begin()); out_ = std::vector(cx*2*N); real* in = &in_[0]; real* out = &out_[0]; @@ -248,7 +260,8 @@ TEST_F(FFTTest, Real2DLength18_15Test) const int cx = (rx/2+1); const int ny = 15; - in_ = std::vector(inputdata, inputdata+cx*2*ny); + in_ = std::vector(cx*2*ny); + std::copy(inputdata, inputdata+cx*2*ny, in_.begin()); out_ = std::vector(cx*2*ny); real* in = &in_[0]; real* out = &out_[0]; @@ -279,15 +292,24 @@ TEST_F(FFFTest3D, Real5_6_9) 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(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(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 { diff --git a/src/gromacs/fileio/oenv.cpp b/src/gromacs/fileio/oenv.cpp index f586190c0f..a006992084 100644 --- a/src/gromacs/fileio/oenv.cpp +++ b/src/gromacs/fileio/oenv.cpp @@ -3,7 +3,7 @@ * * 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. @@ -76,8 +76,8 @@ struct gmx_output_env_t /* 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" diff --git a/src/gromacs/fileio/rgb.h b/src/gromacs/fileio/rgb.h index 6ce4507602..37d375a9c1 100644 --- a/src/gromacs/fileio/rgb.h +++ b/src/gromacs/fileio/rgb.h @@ -3,7 +3,7 @@ * * 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. @@ -37,10 +37,8 @@ #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 diff --git a/src/gromacs/gmxana/gmx_chi.cpp b/src/gromacs/gmxana/gmx_chi.cpp index 2ff98fe445..9beba9718e 100644 --- a/src/gromacs/gmxana/gmx_chi.cpp +++ b/src/gromacs/gmxana/gmx_chi.cpp @@ -453,6 +453,10 @@ static void histogramming(FILE *log, int nbin, gmx_residuetype_t *rt, 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 }, @@ -467,6 +471,9 @@ static void histogramming(FILE *log, int nbin, gmx_residuetype_t *rt, { "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) diff --git a/src/gromacs/gmxana/hxprops.cpp b/src/gromacs/gmxana/hxprops.cpp index 941fac4662..e5ee9493d2 100644 --- a/src/gromacs/gmxana/hxprops.cpp +++ b/src/gromacs/gmxana/hxprops.cpp @@ -3,7 +3,7 @@ * * 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. @@ -58,7 +58,10 @@ real ellipticity(int nres, t_bb bb[]) 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 }, @@ -73,6 +76,9 @@ real ellipticity(int nres, t_bb bb[]) { -54, -28, 0.46 }, { -44, -33, 0.68 } }; +#ifdef _MSC_VER +#pragma warning(default: 4838) +#endif #define NPPW asize(ppw) int i, j; diff --git a/src/gromacs/gmxpreprocess/calch.cpp b/src/gromacs/gmxpreprocess/calch.cpp index d4aac2a5b4..2b0f49f641 100644 --- a/src/gromacs/gmxpreprocess/calch.cpp +++ b/src/gromacs/gmxpreprocess/calch.cpp @@ -3,7 +3,7 @@ * * 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. @@ -64,7 +64,7 @@ static void gen_waterhydrogen(int nh, rvec xa[], rvec xh[], int *l) #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 }, @@ -72,7 +72,7 @@ static void gen_waterhydrogen(int nh, rvec xa[], rvec xh[], int *l) { -AA, BB, CC }, { BB, AA, -CC } }; - const rvec matrix2[6] = { + const dvec matrix2[6] = { { -AA, BB, CC }, { BB, AA, -CC }, { BB, -AA, -CC }, diff --git a/src/gromacs/gmxpreprocess/x2top.cpp b/src/gromacs/gmxpreprocess/x2top.cpp index 23014ecbca..4971ad76ca 100644 --- a/src/gromacs/gmxpreprocess/x2top.cpp +++ b/src/gromacs/gmxpreprocess/x2top.cpp @@ -3,7 +3,7 @@ * * 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. @@ -69,7 +69,7 @@ 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 }, diff --git a/src/gromacs/math/tests/invertmatrix.cpp b/src/gromacs/math/tests/invertmatrix.cpp index 5dadb3c274..4021cb6594 100644 --- a/src/gromacs/math/tests/invertmatrix.cpp +++ b/src/gromacs/math/tests/invertmatrix.cpp @@ -1,7 +1,7 @@ /* * 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. @@ -80,17 +80,17 @@ TEST(InvertMatrixTest, IdentityIsImpotent) 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); @@ -124,10 +124,10 @@ TEST(InvertBoxMatrixTest, IdentityIsImpotent) 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); diff --git a/src/gromacs/mdlib/tests/settle.cpp b/src/gromacs/mdlib/tests/settle.cpp index ef53ee1373..4fcb49b719 100644 --- a/src/gromacs/mdlib/tests/settle.cpp +++ b/src/gromacs/mdlib/tests/settle.cpp @@ -59,7 +59,7 @@ namespace test { //! 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, @@ -114,7 +114,7 @@ const real g_positions[] = { }; //! 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 SettleTestParameters; @@ -248,6 +248,9 @@ TEST_P(SettleTest, SatisfiesConstraints) 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 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}}; @@ -255,7 +258,7 @@ TEST_P(SettleTest, SatisfiesConstraints) 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; diff --git a/src/gromacs/random/tabulatednormaldistribution.cpp b/src/gromacs/random/tabulatednormaldistribution.cpp index b0d7ce2640..46f9168f44 100644 --- a/src/gromacs/random/tabulatednormaldistribution.cpp +++ b/src/gromacs/random/tabulatednormaldistribution.cpp @@ -42,7 +42,7 @@ namespace gmx // 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 diff --git a/src/gromacs/random/tabulatednormaldistribution.h b/src/gromacs/random/tabulatednormaldistribution.h index 2174f38b51..c914b66549 100644 --- a/src/gromacs/random/tabulatednormaldistribution.h +++ b/src/gromacs/random/tabulatednormaldistribution.h @@ -358,7 +358,7 @@ class TabulatedNormalDistribution // 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 TabulatedNormalDistribution::c_table_; diff --git a/src/gromacs/simd/impl_ibm_vsx/impl_ibm_vsx_simd_double.h b/src/gromacs/simd/impl_ibm_vsx/impl_ibm_vsx_simd_double.h index 69fca4f5dd..6bac451c76 100644 --- a/src/gromacs/simd/impl_ibm_vsx/impl_ibm_vsx_simd_double.h +++ b/src/gromacs/simd/impl_ibm_vsx/impl_ibm_vsx_simd_double.h @@ -421,7 +421,6 @@ trunc(SimdDouble x) 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); diff --git a/src/gromacs/utility/basedefinitions.h b/src/gromacs/utility/basedefinitions.h index 1e1f6e7fce..e6a3c1ceca 100644 --- a/src/gromacs/utility/basedefinitions.h +++ b/src/gromacs/utility/basedefinitions.h @@ -78,39 +78,37 @@ typedef int gmx_bool; * 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 @@ -231,13 +229,13 @@ typedef uint64_t gmx_uint64_t; /*! \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 @@ -257,10 +255,7 @@ typedef uint64_t gmx_uint64_t; \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. -- 2.22.0