From: Daniel Arndt Date: Thu, 26 Apr 2018 21:45:12 +0000 (+0200) Subject: Allow Asserts for functions running on host X-Git-Tag: v9.0.0-rc1~97^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=972bb3ce9813e890d4bb5a9e69dfa50142a39739;p=dealii.git Allow Asserts for functions running on host --- diff --git a/cmake/configure/configure_1_cuda.cmake b/cmake/configure/configure_1_cuda.cmake index 7b9f2e1906..f1fbe8fd5e 100644 --- a/cmake/configure/configure_1_cuda.cmake +++ b/cmake/configure/configure_1_cuda.cmake @@ -95,6 +95,8 @@ MACRO(FEATURE_CUDA_FIND_EXTERNAL var) ) SET(${var} FALSE) ENDIF() + + ADD_FLAGS(DEAL_II_CUDA_FLAGS_DEBUG "-G") ENDIF() ENDMACRO() diff --git a/include/deal.II/base/tensor.h b/include/deal.II/base/tensor.h index 7ad948b63b..f87caf7618 100644 --- a/include/deal.II/base/tensor.h +++ b/include/deal.II/base/tensor.h @@ -780,7 +780,7 @@ 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 +#ifndef __CUDA_ARCH__ Assert(dim != 0, ExcMessage("Cannot access an object of type Tensor<0,0,Number>")); #endif return value; @@ -792,7 +792,7 @@ 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 +#ifndef __CUDA_ARCH__ Assert(dim != 0, ExcMessage("Cannot access an object of type Tensor<0,0,Number>")); #endif return value; @@ -910,7 +910,7 @@ typename Tensor<0,dim,Number>::real_type DEAL_II_CUDA_HOST_DEV Tensor<0,dim,Number>::norm_square () const { // We cannot use Assert inside a CUDA kernel -#ifndef DEAL_II_WITH_CUDA +#ifndef __CUDA_ARCH__ Assert(dim != 0, ExcMessage("Cannot access an object of type Tensor<0,0,Number>")); #endif return numbers::NumberTraits::abs_square (value); @@ -1015,7 +1015,7 @@ namespace internal std::integral_constant) { // We cannot use Assert in a CUDA kernel -#ifndef DEAL_II_WITH_CUDA +#ifndef __CUDA_ARCH__ Assert (i) { // We cannot use Assert in a CUDA kernel -#ifndef DEAL_II_WITH_CUDA +#ifndef __CUDA_ARCH__ Assert(false, ExcMessage("Cannot access elements of an object of type Tensor.")); #endif static ArrayElementType t;