From 972bb3ce9813e890d4bb5a9e69dfa50142a39739 Mon Sep 17 00:00:00 2001 From: Daniel Arndt Date: Thu, 26 Apr 2018 23:45:12 +0200 Subject: [PATCH] Allow Asserts for functions running on host --- cmake/configure/configure_1_cuda.cmake | 2 ++ include/deal.II/base/tensor.h | 10 +++++----- 2 files changed, 7 insertions(+), 5 deletions(-) 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; -- 2.39.5