]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Avoid warnings in device code
authorDaniel Arndt <arndtd@ornl.gov>
Fri, 5 Jul 2019 19:22:15 +0000 (15:22 -0400)
committerDaniel Arndt <arndtd@ornl.gov>
Tue, 9 Jul 2019 01:29:17 +0000 (21:29 -0400)
include/deal.II/base/tensor.h

index 961ceb7a18c228a717995e5bdedb2192b7fe895a..5754cbc7f230afd6d1e03fe63b08a42989c246b4 100644 (file)
@@ -940,8 +940,7 @@ template <typename OtherNumber>
 DEAL_II_CONSTEXPR inline bool
 Tensor<0, dim, Number>::operator==(const Tensor<0, dim, OtherNumber> &p) const
 {
-#if defined(DEAL_II_ADOLC_WITH_ADVANCED_BRANCHING) && \
-  !defined(DEAL_II_COMPILER_CUDA_AWARE)
+#if defined(DEAL_II_ADOLC_WITH_ADVANCED_BRANCHING)
   Assert(!(std::is_same<Number, adouble>::value ||
            std::is_same<OtherNumber, adouble>::value),
          ExcMessage(
@@ -1037,18 +1036,21 @@ Tensor<0, dim, Number>::operator-() const
 
 
 template <int dim, typename Number>
-DEAL_II_CONSTEXPR inline typename Tensor<0, dim, Number>::real_type
-Tensor<0, dim, Number>::norm() const
+DEAL_II_CONSTEXPR DEAL_II_CUDA_HOST_DEV inline
+  typename Tensor<0, dim, Number>::real_type
+  Tensor<0, dim, Number>::norm() const
 {
+#ifndef __CUDA_ARCH__
   Assert(dim != 0,
          ExcMessage("Cannot access an object of type Tensor<0,0,Number>"));
+#endif
   return numbers::NumberTraits<Number>::abs(value);
 }
 
 
 template <int dim, typename Number>
-inline typename Tensor<0, dim, Number>::real_type DEAL_II_CUDA_HOST_DEV
-                                                  Tensor<0, dim, Number>::norm_square() const
+DEAL_II_CUDA_HOST_DEV inline typename Tensor<0, dim, Number>::real_type
+Tensor<0, dim, Number>::norm_square() const
 {
   // We cannot use Assert inside a CUDA kernel
 #ifndef __CUDA_ARCH__
@@ -1201,8 +1203,7 @@ DEAL_II_ALWAYS_INLINE constexpr DEAL_II_CUDA_HOST_DEV const typename Tensor<
   Number>::value_type &Tensor<rank_, dim, Number>::
                        operator[](const unsigned int i) const
 {
-  return values[i]; /*dealii::internal::TensorSubscriptor::subscript(
-     values, i, std::integral_constant<int, dim>());*/
+  return values[i];
 }
 
 

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.