Change to test TSAN with clang and libomp
authorMark Abraham <mark.j.abraham@gmail.com>
Tue, 2 Oct 2018 09:48:59 +0000 (11:48 +0200)
committerMark Abraham <mark.j.abraham@gmail.com>
Fri, 5 Oct 2018 12:55:05 +0000 (14:55 +0200)
This permits openmp and simd to be tested with ThreadSanitizer

Used more of the safe gatherLoadUTranspose, since that is required
for Jenkins to pass.

Change-Id: I262a5e61b715679e23cee641cf3be553714644ce

admin/builds/pre-submit-matrix.txt
src/gromacs/mdlib/lincs.cpp

index abff968f5ece738954479bfbb5c7e86640b6df37..d1a9cd16e469fc916d13b96ebe768abd6440fe6e 100644 (file)
@@ -32,12 +32,9 @@ gcc-4.8 gpuhw=nvidia cuda-7.0 cmake-3.8.1 mpi npme=1 nranks=2 openmp
 # Test SIMD implementation of pair search for GPU code-path
 gcc-7 gpuhw=nvidia gpu_id=1 cuda-9.2 thread-mpi openmp cmake-3.6.1 release-with-assert simd=avx2_256
 
-# Test with ThreadSanitizer (compiled without OpenMP, even though
-#   this gcc was configured with --disable-linux-futex, because
-#   Redmine #1850 is unresolved, which causes more suspected
-#   false positives than races detected)
-# Test newest gcc at time of release
-gcc-7 tsan no-openmp cmake-3.10.0
+# Test with libcxx
+# Test with ThreadSanitizer + OpenMP + SIMD
+clang-7 no-hwloc tsan libcxx-7 openmp cmake-3.12.1 simd=avx2_256
 
 # Test on MacOS (the gcc-6 and/or x11 flags implicitly steer jobs to the OSX agent)
 # Test X11 build
@@ -91,7 +88,6 @@ gcc-5 openmp simd=avx_128_fma gpuhw=amd opencl-1.2 clFFT-2.14
 # Add OpenMP support to ASAN build (but libomp.so in clang-4 reports leaks, so might need a suitable build or suppression)
 # Test hwloc-2 support
 # Test newest supported LTS Ubuntu
-# Resolve Redmine #1850 so that ThreadSanitizer can test our OpenMP code
 # Test AVX-512 when hardware is available
 # Update to test gcc 8
 # Update to test clang 7
index fb3e2c0d7970539f0b8f58472f5ab316118a33c1..f57d901a034b42bf21d1c197848da938e6e014aa 100644 (file)
@@ -500,6 +500,23 @@ static void lincs_update_atoms(Lincs *li, int th,
 }
 
 #if GMX_SIMD_HAVE_REAL
+//! Helper function so that we can run TSAN with SIMD support (where implemented).
+template <int align>
+static inline void gmx_simdcall
+gatherLoadUTransposeTSANSafe(const real         *base,
+                             const std::int32_t *offset,
+                             SimdReal           *v0,
+                             SimdReal           *v1,
+                             SimdReal           *v2)
+{
+#if (CMAKE_BUILD_TYPE == CMAKE_BUILD_TYPE_TSAN) && GMX_SIMD_X86_AVX2_256
+    // This function is only implemented in this case
+    gatherLoadUTransposeSafe<align>(base, offset, v0, v1, v2);
+#else
+    gatherLoadUTranspose<align>(base, offset, v0, v1, v2);
+#endif
+}
+
 /*! \brief Calculate the constraint distance vectors r to project on from x.
  *
  * Determine the right-hand side of the matrix equation using quantity f.
@@ -541,8 +558,8 @@ calc_dr_x_f_simd(int                       b0,
             offset1[i] = bla[bs*2 + i*2 + 1];
         }
 
-        gatherLoadUTranspose<3>(reinterpret_cast<const real *>(x), offset0, &x0_S, &y0_S, &z0_S);
-        gatherLoadUTranspose<3>(reinterpret_cast<const real *>(x), offset1, &x1_S, &y1_S, &z1_S);
+        gatherLoadUTransposeTSANSafe<3>(reinterpret_cast<const real *>(x), offset0, &x0_S, &y0_S, &z0_S);
+        gatherLoadUTransposeTSANSafe<3>(reinterpret_cast<const real *>(x), offset1, &x1_S, &y1_S, &z1_S);
         rx_S = x0_S - x1_S;
         ry_S = y0_S - y1_S;
         rz_S = z0_S - z1_S;
@@ -558,8 +575,8 @@ calc_dr_x_f_simd(int                       b0,
 
         transposeScatterStoreU<3>(reinterpret_cast<real *>(r + bs), offset2, rx_S, ry_S, rz_S);
 
-        gatherLoadUTranspose<3>(reinterpret_cast<const real *>(f), offset0, &x0_S, &y0_S, &z0_S);
-        gatherLoadUTranspose<3>(reinterpret_cast<const real *>(f), offset1, &x1_S, &y1_S, &z1_S);
+        gatherLoadUTransposeTSANSafe<3>(reinterpret_cast<const real *>(f), offset0, &x0_S, &y0_S, &z0_S);
+        gatherLoadUTransposeTSANSafe<3>(reinterpret_cast<const real *>(f), offset1, &x1_S, &y1_S, &z1_S);
         fx_S = x0_S - x1_S;
         fy_S = y0_S - y1_S;
         fz_S = z0_S - z1_S;
@@ -757,23 +774,6 @@ static void do_lincsp(const rvec *x, rvec *f, rvec *fp, t_pbc *pbc,
 
 #if GMX_SIMD_HAVE_REAL
 
-//! Helper function so that we can run TSAN with SIMD support (where implemented).
-template <int align>
-static inline void gmx_simdcall
-gatherLoadUTransposeTSANSafe(const real         *base,
-                             const std::int32_t *offset,
-                             SimdReal           *v0,
-                             SimdReal           *v1,
-                             SimdReal           *v2)
-{
-#if (CMAKE_BUILD_TYPE == CMAKE_BUILD_TYPE_TSAN) && GMX_SIMD_X86_AVX2_256
-    // This function is only implemented in this case
-    gatherLoadUTransposeSafe<align>(base, offset, v0, v1, v2);
-#else
-    gatherLoadUTranspose<align>(base, offset, v0, v1, v2);
-#endif
-}
-
 /*! \brief Calculate the constraint distance vectors r to project on from x.
  *
  * Determine the right-hand side of the matrix equation using coordinates xp. */