]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Introduce DEAL_II_COMPILER_CUDA_AWARE
authorDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Thu, 16 Aug 2018 08:18:30 +0000 (10:18 +0200)
committerDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Thu, 16 Aug 2018 08:18:30 +0000 (10:18 +0200)
14 files changed:
doc/doxygen/options.dox.in
include/deal.II/base/config.h.in
include/deal.II/base/cuda.h
include/deal.II/base/numbers.h
include/deal.II/lac/cuda_atomic.h
include/deal.II/lac/cuda_kernels.h
include/deal.II/lac/cuda_kernels.templates.h
include/deal.II/lac/cuda_solver_direct.h
include/deal.II/lac/cuda_sparse_matrix.h
include/deal.II/matrix_free/cuda_fe_evaluation.h
include/deal.II/matrix_free/cuda_hanging_nodes_internal.h
include/deal.II/matrix_free/cuda_matrix_free.h
include/deal.II/matrix_free/cuda_matrix_free.templates.h
include/deal.II/matrix_free/cuda_tensor_product_kernels.h

index e94a58259d6359ec8f4fd6c71b19086116a24a8e..6f2038a253ebe6b0a5d22cb093a319e8589332a0 100644 (file)
@@ -176,6 +176,7 @@ PREDEFINED             = DOXYGEN=1 \
                          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 \
index 2aaa907e5b9e30f06235594921cac98140b64b77..c0666e98a1c1c2df67ab8b74ca16fce0ae5a9a66 100644 (file)
 #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:
index fa26cacf2add0087c4fbe89ae7b2722f6060d033..9a4d57dd4771ade59f5a7f0793aad39430ef5c11 100644 (file)
@@ -20,7 +20,7 @@
 
 #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>
@@ -58,7 +58,7 @@ namespace Utilities
        */
       ~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;
@@ -77,7 +77,7 @@ namespace Utilities
     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);
@@ -94,7 +94,7 @@ namespace Utilities
     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;
@@ -110,7 +110,7 @@ namespace Utilities
     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),
@@ -130,7 +130,7 @@ namespace Utilities
     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),
index 1bc05e63452f1625ca50ce948128beb9b30d8194..7c5e9a271240c57fee55224013323a9843b6b6e6 100644 (file)
@@ -25,7 +25,7 @@
 #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
index e717b633b915ecf708d46f0c88215c8e3ec40628..7a6cc604960a5b124a80781162009948ea38451f 100644 (file)
@@ -18,7 +18,7 @@
 
 #include <deal.II/base/config.h>
 
-#if defined(DEAL_II_WITH_CUDA) && defined(__CUDACC__)
+#ifdef DEAL_II_COMPILER_CUDA_AWARE
 
 DEAL_II_NAMESPACE_OPEN
 
index 367df1c0815242865ac7f079d2174e3934b9ab0c..8e525463c481a2b6b97d7764a5077a08b9bf4fa7 100644 (file)
@@ -18,7 +18,7 @@
 
 #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>
index 81d8ef9bcf7208534cda830a948e5f7543be345d..3a228834535c04dc7efb0aee27b73ef788049f40 100644 (file)
@@ -18,7 +18,7 @@
 
 #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
 
index 493a70e9f11628a3377dbe603a792f30687b940a..e53eef8accfc9a5b10cb23515284c5d6d4d0570e 100644 (file)
@@ -18,7 +18,7 @@
 
 #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>
index 0be2bf0e8285e7fed00e2054bfc261014973d7be..51cf57d2fbb1c9e438cab8b94a54cdfe4057e4ec 100644 (file)
@@ -20,7 +20,7 @@
 
 #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>
index 2f7c46a76657016c39858a42d836e0a58b573e8c..b097cfc5a7d031a39d4f325a34b387d9c60f7958 100644 (file)
@@ -18,7 +18,7 @@
 
 #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>
index f9ee32cc690bb60f5ca666e733cd4b5167c03e7f..946af3f1c8a626e3374a08e9343b8d4dddd4c241 100644 (file)
@@ -18,7 +18,7 @@
 
 #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>
 
index 0bc0dacf570a737927cc9ee8c2af229d5aa9a106..3ebe12d846bae66bb5dca13ef4fe0db45bd0b4e3 100644 (file)
@@ -19,7 +19,7 @@
 
 #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>
index a227dff179960b0b299f1e88e2df076d57ad16ff..d8cc558025d5e4c65f155d45b734c14dfe6e5cdb 100644 (file)
@@ -19,7 +19,7 @@
 
 #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>
index e1232ad56d8bc833713d46b4f775375697dfb932..81c8fff6ab22b4bdba0a88c5fd3f97df698b84eb 100644 (file)
@@ -19,7 +19,7 @@
 
 #include <deal.II/base/config.h>
 
-#if defined(DEAL_II_WITH_CUDA) && defined(__CUDACC__)
+#ifdef DEAL_II_COMPILER_CUDA_AWARE
 
 DEAL_II_NAMESPACE_OPEN
 

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.