]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Fix wrong symbol in CUDAWrappers::Vector::print() 7069/head
authorDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Thu, 16 Aug 2018 14:17:16 +0000 (16:17 +0200)
committerDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Thu, 16 Aug 2018 15:31:07 +0000 (17:31 +0200)
source/lac/cuda_vector.cu

index 1809c51f6f18433ed646f57f972e08d25101b8f8..58bdbe4972123d346b1611ce7cd4edd11a48ffe4 100644 (file)
@@ -13,6 +13,7 @@
 //
 // ---------------------------------------------------------------------
 
+#include <deal.II/base/cuda.h>
 #include <deal.II/base/cuda_size.h>
 #include <deal.II/base/exceptions.h>
 
@@ -688,18 +689,11 @@ namespace LinearAlgebra
       out << std::endl;
 
       // Copy the vector to the host
-      Number *    cpu_val    = new Number[n_elements];
-      cudaError_t error_code = cudaMemcpy(cpu_val,
-                                          val,
-                                          n_elements * sizeof(Number),
-                                          cudaMemcpyHostToDevice);
-      AssertCuda(error_code);
+      std::vector<Number> cpu_val(n_elements);
+      Utilities::CUDA::copy_to_host(val, cpu_val);
       for (unsigned int i = 0; i < n_elements; ++i)
         out << cpu_val[i] << std::endl;
       out << std::flush;
-      delete[] cpu_val;
-      cpu_val = nullptr;
-
 
       AssertThrow(out, ExcIO());
       // reset output format

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.