]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Static variable cannot be allocated inside a __device__ function 6905/head
authorBruno Turcksin <bruno.turcksin@gmail.com>
Mon, 9 Jul 2018 19:04:43 +0000 (19:04 +0000)
committerBruno Turcksin <bruno.turcksin@gmail.com>
Mon, 9 Jul 2018 19:04:43 +0000 (19:04 +0000)
Fix the following error:
dynamic initialization is not supported for function-scope static
variables within a __device__/__global__ function

include/deal.II/base/tensor.h

index 88919243c87b1597fa334d7acc8bfd3dd3d2abbf..558e4ae8843a6c27140d4c5c61e0a736a1eecd07 100644 (file)
@@ -1079,18 +1079,15 @@ namespace internal
 
 
     template <typename ArrayElementType>
-    DEAL_II_CUDA_HOST_DEV ArrayElementType &
-                          subscript(ArrayElementType *,
-                                    const unsigned int,
-                                    std::integral_constant<int, 0>)
+    ArrayElementType &
+    subscript(ArrayElementType *,
+              const unsigned int,
+              std::integral_constant<int, 0>)
     {
-      // We cannot use Assert in a CUDA kernel
-#ifndef __CUDA_ARCH__
       Assert(
         false,
         ExcMessage(
           "Cannot access elements of an object of type Tensor<rank,0,Number>."));
-#endif
       static ArrayElementType t;
       return t;
     }

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.