Fix nightly failures
authorPaul Bauer <paul.bauer.q@gmail.com>
Fri, 13 Sep 2019 08:51:48 +0000 (10:51 +0200)
committerChristian Blau <cblau@gwdg.de>
Fri, 13 Sep 2019 11:42:25 +0000 (13:42 +0200)
Also fixed extra warnings from clang-tidy in simd_math tests.

Change-Id: I7a47a9b8d5e8b276bab82467274d2d23367d805f

src/gromacs/ewald/pme_gpu_internal.cpp
src/gromacs/simd/simd_math.h
src/gromacs/simd/tests/simd_math.cpp

index 5af75515661afa295a87447e02efca3190611abe..c11580aa88de2466d29adec57411afefbb03dbc4 100644 (file)
@@ -663,13 +663,13 @@ void pme_gpu_getEnergyAndVirial(const gmx_pme_t &pme,
  * \param[in]   pmeGpu      PME GPU data structure
  * \param[out]  output      Pointer to PME output data structure
  */
-static void pme_gpu_getForceOutput(PmeGpu    &pmeGpu,
+static void pme_gpu_getForceOutput(PmeGpu    *pmeGpu,
                                    PmeOutput *output)
 {
-    output->haveForceOutput_ = !pmeGpu.settings.useGpuForceReduction;
+    output->haveForceOutput_ = !pmeGpu->settings.useGpuForceReduction;
     if (output->haveForceOutput_)
     {
-        output->forces_      =  pmeGpu.staging.h_forces;
+        output->forces_      =  pmeGpu->staging.h_forces;
     }
 }
 
@@ -681,7 +681,7 @@ PmeOutput pme_gpu_getOutput(const gmx_pme_t &pme,
 
     PmeOutput  output;
 
-    pme_gpu_getForceOutput(*pmeGpu, &output);
+    pme_gpu_getForceOutput(pmeGpu, &output);
 
     // The caller knows from the flags that the energy and the virial are not usable
     // on the else branch
index dab7a5adb54edf940429f29794e957bde8071deb..f77f35fe2d7885f0fd2fb981891f4faea2deceda 100644 (file)
@@ -450,7 +450,7 @@ cbrt(SimdFloat x)
 
     // Compile-time sanity check that our math is correct
     static_assert( offset % 3 == 0, "Internal math algorithm/implementation inconsistency");
-    SimdFInt32 expDiv3       = cvtR2I(offsetExpDiv3 - SimdFloat(static_cast<float>(offset/3)));
+    SimdFInt32 expDiv3       = cvtR2I(offsetExpDiv3 - SimdFloat(static_cast<float>(int(offset/3))));
 
     SimdFloat  remainder      = offsetExp - offsetExpDiv3 * three;
 
@@ -520,7 +520,7 @@ invcbrt(SimdFloat x)
     // Compile-time sanity check that our math is correct
     static_assert( offset % 3 == 0, "Internal math algorithm/implementation inconsistency");
     // We should swap the sign here, so we change order of the terms in the subtraction
-    SimdFInt32 expDiv3       = cvtR2I(SimdFloat(static_cast<float>(offset/3)) - offsetExpDiv3);
+    SimdFInt32 expDiv3       = cvtR2I(SimdFloat(static_cast<float>(int(offset/3))) - offsetExpDiv3);
 
     // Swap sign here too, so remainder is either 0, -1 or -2
     SimdFloat remainder      = offsetExpDiv3 * three - offsetExp;
@@ -2088,7 +2088,7 @@ cbrt(SimdDouble x)
     SimdDouble  offsetExp      = cvtI2R(exponent) + SimdDouble(static_cast<double>(offset) + 0.1);
     SimdDouble  offsetExpDiv3  = trunc(offsetExp * oneThird); // important to truncate here to mimic integer division
     static_assert( offset % 3 == 0, "Internal math algorithm/implementation inconsistency");
-    SimdDInt32  expDiv3        = cvtR2I(offsetExpDiv3 - SimdDouble(static_cast<double>(offset/3)));
+    SimdDInt32  expDiv3        = cvtR2I(offsetExpDiv3 - SimdDouble(static_cast<double>(int(offset/3))));
     SimdDouble  remainder      = offsetExp - offsetExpDiv3 * three;
     SimdDouble  factor         = blend(one, cbrt2, SimdDouble(0.5) < remainder);
     factor                    = blend(factor, sqrCbrt2, SimdDouble(1.5) < remainder);
@@ -2144,7 +2144,7 @@ invcbrt(SimdDouble x)
     SimdDouble  offsetExp      = cvtI2R(exponent) + SimdDouble(static_cast<double>(offset) + 0.1);
     SimdDouble  offsetExpDiv3  = trunc(offsetExp * oneThird); // important to truncate here to mimic integer division
     static_assert( offset % 3 == 0, "Internal math algorithm/implementation inconsistency");
-    SimdDInt32  expDiv3        = cvtR2I(SimdDouble(static_cast<double>(offset/3)) - offsetExpDiv3);
+    SimdDInt32  expDiv3        = cvtR2I(SimdDouble(static_cast<double>(int(offset/3))) - offsetExpDiv3);
     SimdDouble  remainder      = offsetExpDiv3 * three - offsetExp;
     SimdDouble  factor         = blend(one, invCbrt2, remainder < SimdDouble(-0.5) );
     factor                    = blend(factor, invSqrCbrt2, remainder < SimdDouble(-1.5));
@@ -3670,7 +3670,7 @@ cbrtSingleAccuracy(SimdDouble x)
     SimdDouble  offsetExp      = cvtI2R(exponent) + SimdDouble(static_cast<double>(offset) + 0.1);
     SimdDouble  offsetExpDiv3  = trunc(offsetExp * oneThird); // important to truncate here to mimic integer division
     static_assert( offset % 3 == 0, "Internal math algorithm/implementation inconsistency");
-    SimdDInt32  expDiv3        = cvtR2I(offsetExpDiv3 - SimdDouble(static_cast<double>(offset/3)));
+    SimdDInt32  expDiv3        = cvtR2I(offsetExpDiv3 - SimdDouble(static_cast<double>(int(offset/3))));
     SimdDouble  remainder      = offsetExp - offsetExpDiv3 * three;
     SimdDouble  factor         = blend(one, cbrt2, SimdDouble(0.5) < remainder);
     factor                    = blend(factor, sqrCbrt2, SimdDouble(1.5) < remainder);
@@ -3717,7 +3717,7 @@ invcbrtSingleAccuracy(SimdDouble x)
     SimdDouble  offsetExp      = cvtI2R(exponent) + SimdDouble(static_cast<double>(offset) + 0.1);
     SimdDouble  offsetExpDiv3  = trunc(offsetExp * oneThird); // important to truncate here to mimic integer division
     static_assert( offset % 3 == 0, "Internal math algorithm/implementation inconsistency");
-    SimdDInt32  expDiv3        = cvtR2I(SimdDouble(static_cast<double>(offset/3)) - offsetExpDiv3);
+    SimdDInt32  expDiv3        = cvtR2I(SimdDouble(static_cast<double>(int(offset/3))) - offsetExpDiv3);
     SimdDouble  remainder      = offsetExpDiv3 * three - offsetExp;
     SimdDouble  factor         = blend(one, invCbrt2, remainder < SimdDouble(-0.5) );
     factor                    = blend(factor, invSqrCbrt2, remainder < SimdDouble(-1.5));
index ef2b2c1e9da13ad4e509cdb6fdcc39cf4907dd1e..d5faf4c95242d9a254447d3d185674811103415f 100644 (file)
@@ -185,8 +185,8 @@ SimdMathTest::generateTestPoints(Range inputRange, std::size_t inputPoints)
 
     if (inputRange.first < 0 && inputRange.second > 0)
     {
-        testRanges.push_back({inputRange.first, -std::numeric_limits<real>::min()});
-        testRanges.push_back({0.0, inputRange.second});
+        testRanges.emplace_back(Range({inputRange.first, -std::numeric_limits<real>::min()}));
+        testRanges.emplace_back(Range({0.0, inputRange.second}));
     }
     else
     {
@@ -772,7 +772,7 @@ TEST_F(SimdMathTest, expUnsafe)
 {
     // See test of exp() for comments about test ranges
     const real      lowestRealThatProducesNormal     = (std::numeric_limits<real>::min_exponent - 1)*std::log(2.0);
-    const real      lowestRealThatProducesCorrectExp = lowestRealThatProducesNormal + GMX_SIMD_HAVE_FMA ? 0.0 : 0.5 * std::numeric_limits<real>::digits * std::log(2.0);
+    const real      lowestRealThatProducesCorrectExp = lowestRealThatProducesNormal + (GMX_SIMD_HAVE_FMA ? 0.0 : 0.5 * std::numeric_limits<real>::digits * std::log(2.0));
     const real      highestRealThatProducesNormal    = (std::numeric_limits<real>::max_exponent - 1)*std::log(2.0);
 
     CompareSettings settings {
@@ -1258,7 +1258,7 @@ TEST_F(SimdMathTest, expSingleAccuracyUnsafe)
 {
     // See test of exp() for comments about test ranges
     const real lowestRealThatProducesNormal     = (std::numeric_limits<real>::min_exponent - 1)*std::log(2.0);
-    const real lowestRealThatProducesCorrectExp = lowestRealThatProducesNormal + GMX_SIMD_HAVE_FMA ? 0.0 : 0.5 * std::numeric_limits<real>::digits * std::log(2.0);
+    const real lowestRealThatProducesCorrectExp = lowestRealThatProducesNormal + (GMX_SIMD_HAVE_FMA ? 0.0 : 0.5 * std::numeric_limits<real>::digits * std::log(2.0));
     const real highestRealThatProducesNormal    = (std::numeric_limits<real>::max_exponent - 1)*std::log(2.0);
 
     // Increase the allowed error by the difference between the actual precision and single