DEAL_II_WITH_CXX14=1 \
DEAL_II_WITH_CXX17=1 \
DEAL_II_WITH_CUDA=1 \
+ DEAL_II_COMPILER_CUDA_AWARE=1 \
DEAL_II_WITH_GSL=1 \
DEAL_II_WITH_GMSH=1 \
DEAL_II_WITH_HDF5=1 \
#cmakedefine DEAL_II_RESTRICT @DEAL_II_RESTRICT@
#cmakedefine DEAL_II_COMPILER_HAS_DIAGNOSTIC_PRAGMA
+/*
+ * A variable to tell if the compiler used in the current compilation process
+ * understands CUDA code.
+ */
+#if defined(DEAL_II_WITH_CUDA) && defined(__CUDACC__)
+# define DEAL_II_COMPILER_CUDA_AWARE
+#endif
/***********************************************************************
* CPU features:
#include <deal.II/base/exceptions.h>
-#if defined(DEAL_II_WITH_CUDA) && defined(__CUDACC__)
+#ifdef DEAL_II_COMPILER_CUDA_AWARE
# include <cusolverDn.h>
# include <cusolverSp.h>
# include <cusparse.h>
*/
~Handle();
-#if defined(DEAL_II_WITH_CUDA) && defined(__CUDACC__)
+#ifdef DEAL_II_COMPILER_CUDA_AWARE
cusolverDnHandle_t cusolver_dn_handle;
cusolverSpHandle_t cusolver_sp_handle;
inline void
malloc(T *&pointer, const unsigned int n_elements)
{
-#if defined(DEAL_II_WITH_CUDA) && defined(__CUDACC__)
+#ifdef DEAL_II_COMPILER_CUDA_AWARE
cudaError_t cuda_error_code =
cudaMalloc(&pointer, n_elements * sizeof(T));
AssertCuda(cuda_error_code);
inline void
free(T *&pointer)
{
-#if defined(DEAL_II_WITH_CUDA) && defined(__CUDACC__)
+#ifdef DEAL_II_COMPILER_CUDA_AWARE
cudaError_t cuda_error_code = cudaFree(pointer);
AssertCuda(cuda_error_code);
pointer = nullptr;
inline void
copy_to_host(const T *pointer_dev, std::vector<T> &vector_host)
{
-#if defined(DEAL_II_WITH_CUDA) && defined(__CUDACC__)
+#ifdef DEAL_II_COMPILER_CUDA_AWARE
cudaError_t cuda_error_code = cudaMemcpy(vector_host.data(),
pointer_dev,
vector_host.size() * sizeof(T),
inline void
copy_to_dev(const std::vector<T> &vector_host, T *pointer_dev)
{
-#if defined(DEAL_II_WITH_CUDA) && defined(__CUDACC__)
+#ifdef DEAL_II_COMPILER_CUDA_AWARE
cudaError_t cuda_error_code = cudaMemcpy(pointer_dev,
vector_host.data(),
vector_host.size() * sizeof(T),
#include <complex>
#include <cstdlib>
-#if defined(DEAL_II_WITH_CUDA) && defined(__CUDACC__)
+#ifdef DEAL_II_COMPILER_CUDA_AWARE
# define DEAL_II_CUDA_HOST_DEV __host__ __device__
#else
# define DEAL_II_CUDA_HOST_DEV
#include <deal.II/base/config.h>
-#if defined(DEAL_II_WITH_CUDA) && defined(__CUDACC__)
+#ifdef DEAL_II_COMPILER_CUDA_AWARE
DEAL_II_NAMESPACE_OPEN
#include <deal.II/base/config.h>
-#if defined(DEAL_II_WITH_CUDA) && defined(__CUDACC__)
+#ifdef DEAL_II_COMPILER_CUDA_AWARE
# include <deal.II/base/cuda_size.h>
#include <deal.II/lac/cuda_kernels.h>
-#if defined(DEAL_II_WITH_CUDA) && defined(__CUDACC__)
+#ifdef DEAL_II_COMPILER_CUDA_AWARE
DEAL_II_NAMESPACE_OPEN
#include <deal.II/base/config.h>
-#if defined(DEAL_II_WITH_CUDA) && defined(__CUDACC__)
+#ifdef DEAL_II_COMPILER_CUDA_AWARE
# include <deal.II/base/cuda.h>
# include <deal.II/lac/cuda_sparse_matrix.h>
#include <deal.II/base/subscriptor.h>
-#if defined(DEAL_II_WITH_CUDA) && defined(__CUDACC__)
+#ifdef DEAL_II_COMPILER_CUDA_AWARE
# include <deal.II/base/cuda.h>
# include <deal.II/lac/cuda_vector.h>
#include <deal.II/base/config.h>
-#if defined(DEAL_II_WITH_CUDA) && defined(__CUDACC__)
+#ifdef DEAL_II_COMPILER_CUDA_AWARE
# include <deal.II/base/tensor.h>
# include <deal.II/base/utilities.h>
#include <deal.II/base/config.h>
-#if defined(DEAL_II_WITH_CUDA) && defined(__CUDACC__)
+#ifdef DEAL_II_COMPILER_CUDA_AWARE
# include <deal.II/base/utilities.h>
#include <deal.II/base/config.h>
-#if defined(DEAL_II_WITH_CUDA) && defined(__CUDACC__)
+#ifdef DEAL_II_COMPILER_CUDA_AWARE
# include <deal.II/base/quadrature.h>
# include <deal.II/base/tensor.h>
#include <deal.II/matrix_free/cuda_matrix_free.h>
-#if defined(DEAL_II_WITH_CUDA) && defined(__CUDACC__)
+#ifdef DEAL_II_COMPILER_CUDA_AWARE
# include <deal.II/base/cuda_size.h>
# include <deal.II/base/graph_coloring.h>
#include <deal.II/base/config.h>
-#if defined(DEAL_II_WITH_CUDA) && defined(__CUDACC__)
+#ifdef DEAL_II_COMPILER_CUDA_AWARE
DEAL_II_NAMESPACE_OPEN