]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Make variable volatile to avoid incorrect optimization 9038/head
authorBruno Turcksin <bruno.turcksin@gmail.com>
Mon, 11 Nov 2019 14:10:07 +0000 (14:10 +0000)
committerBruno Turcksin <bruno.turcksin@gmail.com>
Mon, 11 Nov 2019 22:09:38 +0000 (22:09 +0000)
See https://devtalk.nvidia.com/default/topic/965588/race-condition-within-warp/

include/deal.II/lac/cuda_kernels.templates.h

index 8c962b0e93b84f5a715ddf99ecb73659996ec15e..6eb0469f39d37cd4039d8a2dcabfac59e5d97969 100644 (file)
@@ -191,11 +191,11 @@ namespace LinearAlgebra
 
       template <typename Number, typename Operation>
       __device__ void
-      reduce(Number *        result,
-             Number *        result_buffer,
-             const size_type local_idx,
-             const size_type global_idx,
-             const size_type N)
+      reduce(Number *         result,
+             volatile Number *result_buffer,
+             const size_type  local_idx,
+             const size_type  global_idx,
+             const size_type  N)
       {
         for (size_type s = block_size / 2; s > warp_size; s = s >> 1)
           {

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.