]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Fix warnings: do not use Assert in CUDA kernel 5737/head
authorBruno Turcksin <bruno.turcksin@gmail.com>
Tue, 16 Jan 2018 00:23:03 +0000 (19:23 -0500)
committerBruno Turcksin <bruno.turcksin@gmail.com>
Tue, 16 Jan 2018 00:23:03 +0000 (19:23 -0500)
include/deal.II/base/tensor.h

index 443f60bbe17e0a78a6f7a7a478fa552e7bb64436..18a7821e4633874ba13e62b6fe356bfab2a02e7c 100644 (file)
@@ -675,7 +675,10 @@ template <int dim, typename Number>
 inline
 DEAL_II_CUDA_HOST_DEV Tensor<0,dim,Number>::operator Number &()
 {
+  // We cannot use Assert inside a CUDA kernel
+#ifndef DEAL_II_WITH_CUDA
   Assert(dim != 0, ExcMessage("Cannot access an object of type Tensor<0,0,Number>"));
+#endif
   return value;
 }
 
@@ -684,7 +687,10 @@ template <int dim, typename Number>
 inline
 DEAL_II_CUDA_HOST_DEV Tensor<0,dim,Number>::operator const Number &() const
 {
+  // We cannot use Assert inside a CUDA kernel
+#ifndef DEAL_II_WITH_CUDA
   Assert(dim != 0, ExcMessage("Cannot access an object of type Tensor<0,0,Number>"));
+#endif
   return value;
 }
 
@@ -882,7 +888,10 @@ namespace internal
                const unsigned int i,
                std::integral_constant<int, dim>)
     {
+      // We cannot use Assert in a CUDA kernel
+#ifndef DEAL_II_WITH_CUDA
       Assert (i<dim, ExcIndexRange(i, 0, dim));
+#endif
       return values[i];
     }
 
@@ -894,7 +903,10 @@ namespace internal
                const unsigned int,
                std::integral_constant<int, 0>)
     {
+      // We cannot use Assert in a CUDA kernel
+#ifndef DEAL_II_WITH_CUDA
       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.