]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Test CUDAMatrixFree not only for DEAL_II_WITH_CUDA
authorDaniel Arndt <arndtd@ornl.gov>
Wed, 24 May 2023 02:13:23 +0000 (22:13 -0400)
committerDaniel Arndt <arndtd@ornl.gov>
Wed, 24 May 2023 16:20:51 +0000 (12:20 -0400)
52 files changed:
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
source/matrix_free/CMakeLists.txt
source/matrix_free/cuda_matrix_free.cc
tests/matrix_free/matrix_free_device_initialize_vector.cc [moved from tests/cuda/matrix_free_initialize_vector.cc with 97% similarity]
tests/matrix_free/matrix_free_device_initialize_vector.with_mpi=on.with_p4est=on.mpirun=2.output [moved from tests/cuda/matrix_free_initialize_vector.with_mpi=on.with_p4est=on.mpirun=2.output with 100% similarity]
tests/matrix_free/matrix_free_device_initialize_vector.with_mpi=on.with_p4est=on.with_cuda=off.mpirun=1.output [moved from tests/cuda/matrix_free_initialize_vector.with_mpi=on.with_p4est=on.mpirun=1.output with 50% similarity]
tests/matrix_free/matrix_free_device_initialize_vector.with_mpi=on.with_p4est=on.with_cuda=on.mpirun=1.output [new file with mode: 0644]
tests/matrix_free/matrix_free_device_matrix_vector_01.cc [moved from tests/cuda/matrix_free_matrix_vector_01.cc with 91% similarity]
tests/matrix_free/matrix_free_device_matrix_vector_01.output [moved from tests/cuda/matrix_free_matrix_vector_01.output with 100% similarity]
tests/matrix_free/matrix_free_device_matrix_vector_02.cc [moved from tests/cuda/matrix_free_matrix_vector_02.cc with 93% similarity]
tests/matrix_free/matrix_free_device_matrix_vector_02.output [moved from tests/cuda/matrix_free_matrix_vector_02.output with 100% similarity]
tests/matrix_free/matrix_free_device_matrix_vector_03.cc [moved from tests/cuda/matrix_free_matrix_vector_03.cc with 95% similarity]
tests/matrix_free/matrix_free_device_matrix_vector_03.output [moved from tests/cuda/matrix_free_matrix_vector_03.output with 100% similarity]
tests/matrix_free/matrix_free_device_matrix_vector_03b.cc [moved from tests/cuda/matrix_free_matrix_vector_03b.cc with 95% similarity]
tests/matrix_free/matrix_free_device_matrix_vector_03b.output [moved from tests/cuda/matrix_free_matrix_vector_03b.output with 100% similarity]
tests/matrix_free/matrix_free_device_matrix_vector_04.cc [moved from tests/cuda/matrix_free_matrix_vector_04.cc with 92% similarity]
tests/matrix_free/matrix_free_device_matrix_vector_04.output [moved from tests/cuda/matrix_free_matrix_vector_04.output with 100% similarity]
tests/matrix_free/matrix_free_device_matrix_vector_05.cc [moved from tests/cuda/matrix_free_matrix_vector_05.cc with 95% similarity]
tests/matrix_free/matrix_free_device_matrix_vector_05.output [moved from tests/cuda/matrix_free_matrix_vector_05.output with 100% similarity]
tests/matrix_free/matrix_free_device_matrix_vector_06.cc [moved from tests/cuda/matrix_free_matrix_vector_06.cc with 95% similarity]
tests/matrix_free/matrix_free_device_matrix_vector_06.output [moved from tests/cuda/matrix_free_matrix_vector_06.output with 100% similarity]
tests/matrix_free/matrix_free_device_matrix_vector_06a.cc [moved from tests/cuda/matrix_free_matrix_vector_06a.cc with 97% similarity]
tests/matrix_free/matrix_free_device_matrix_vector_06a.output [moved from tests/cuda/matrix_free_matrix_vector_06a.output with 100% similarity]
tests/matrix_free/matrix_free_device_matrix_vector_06b.cc [moved from tests/cuda/matrix_free_matrix_vector_06b.cc with 97% similarity]
tests/matrix_free/matrix_free_device_matrix_vector_06b.output [moved from tests/cuda/matrix_free_matrix_vector_06b.output with 100% similarity]
tests/matrix_free/matrix_free_device_matrix_vector_09.cc [moved from tests/cuda/matrix_free_matrix_vector_09.cc with 95% similarity]
tests/matrix_free/matrix_free_device_matrix_vector_09.output [moved from tests/cuda/matrix_free_matrix_vector_09.output with 100% similarity]
tests/matrix_free/matrix_free_device_matrix_vector_10.cc [moved from tests/cuda/matrix_free_matrix_vector_10.cc with 95% similarity]
tests/matrix_free/matrix_free_device_matrix_vector_10.with_trilinos=true.with_p4est=true.mpirun=1.output [moved from tests/cuda/matrix_free_matrix_vector_10.with_trilinos=true.with_p4est=true.mpirun=1.output with 100% similarity]
tests/matrix_free/matrix_free_device_matrix_vector_10.with_trilinos=true.with_p4est=true.mpirun=2.output [moved from tests/cuda/matrix_free_matrix_vector_10.with_trilinos=true.with_p4est=true.mpirun=2.output with 100% similarity]
tests/matrix_free/matrix_free_device_matrix_vector_10a.cc [moved from tests/cuda/matrix_free_matrix_vector_10a.cc with 95% similarity]
tests/matrix_free/matrix_free_device_matrix_vector_10a.with_trilinos=true.with_p4est=true.mpirun=1.output [moved from tests/cuda/matrix_free_matrix_vector_10a.with_trilinos=true.with_p4est=true.mpirun=1.output with 100% similarity]
tests/matrix_free/matrix_free_device_matrix_vector_10a.with_trilinos=true.with_p4est=true.mpirun=2.output [moved from tests/cuda/matrix_free_matrix_vector_10a.with_trilinos=true.with_p4est=true.mpirun=2.output with 100% similarity]
tests/matrix_free/matrix_free_device_matrix_vector_19.cc [moved from tests/cuda/matrix_free_matrix_vector_19.cc with 95% similarity]
tests/matrix_free/matrix_free_device_matrix_vector_19.with_trilinos=true.with_trilinos_with_zoltan=true.mpirun=2.output [moved from tests/cuda/matrix_free_matrix_vector_19.with_trilinos=true.with_trilinos_with_zoltan=true.mpirun=2.output with 100% similarity]
tests/matrix_free/matrix_free_device_matrix_vector_25.cc [moved from tests/cuda/matrix_free_matrix_vector_25.cc with 95% similarity]
tests/matrix_free/matrix_free_device_matrix_vector_25.with_trilinos=true.with_p4est=true.mpirun=1.output [moved from tests/cuda/matrix_free_matrix_vector_25.with_trilinos=true.with_p4est=true.mpirun=1.output with 100% similarity]
tests/matrix_free/matrix_free_device_matrix_vector_25.with_trilinos=true.with_p4est=true.mpirun=2.output [moved from tests/cuda/matrix_free_matrix_vector_25.with_trilinos=true.with_p4est=true.mpirun=2.output with 100% similarity]
tests/matrix_free/matrix_free_device_matrix_vector_26.cc [moved from tests/cuda/matrix_free_matrix_vector_26.cc with 96% similarity]
tests/matrix_free/matrix_free_device_matrix_vector_26.with_trilinos=true.with_p4est=true.mpirun=1.output [moved from tests/cuda/matrix_free_matrix_vector_26.with_trilinos=true.with_p4est=true.mpirun=1.output with 100% similarity]
tests/matrix_free/matrix_free_device_matrix_vector_26.with_trilinos=true.with_p4est=true.mpirun=2.output [moved from tests/cuda/matrix_free_matrix_vector_26.with_trilinos=true.with_p4est=true.mpirun=2.output with 100% similarity]
tests/matrix_free/matrix_free_device_multiple_objects.cc [moved from tests/cuda/matrix_free_multiple_objects.cc with 87% similarity]
tests/matrix_free/matrix_free_device_multiple_objects.output [moved from tests/cuda/matrix_free_multiple_objects.output with 100% similarity]
tests/matrix_free/matrix_free_device_no_index_initialize.cc [moved from tests/cuda/matrix_free_no_index_initialize.cc with 92% similarity]
tests/matrix_free/matrix_free_device_no_index_initialize.output [moved from tests/cuda/matrix_free_no_index_initialize.output with 100% similarity]
tests/matrix_free/matrix_free_device_reinit_01.cc [moved from tests/cuda/matrix_free_reinit_01.cc with 99% similarity]
tests/matrix_free/matrix_free_device_reinit_01.with_mpi=on.with_p4est=on.mpirun=2.output [moved from tests/cuda/matrix_free_reinit_01.with_mpi=on.with_p4est=on.mpirun=2.output with 100% similarity]
tests/matrix_free/matrix_vector_device_common.h [moved from tests/cuda/matrix_vector_common.h with 98% similarity]

index b106f850b431982c0b3de3e749625deaf131dd9a..ae1b6ed9ff72afceb2fb6981ddf69556b70aea98 100644 (file)
 
 #include <deal.II/base/config.h>
 
-#ifdef DEAL_II_WITH_CUDA
+#include <deal.II/base/memory_space.h>
+#include <deal.II/base/tensor.h>
+#include <deal.II/base/utilities.h>
 
-#  include <deal.II/base/memory_space.h>
-#  include <deal.II/base/tensor.h>
-#  include <deal.II/base/utilities.h>
+#include <deal.II/lac/cuda_atomic.h>
+#include <deal.II/lac/cuda_vector.h>
 
-#  include <deal.II/lac/cuda_atomic.h>
-#  include <deal.II/lac/cuda_vector.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>
 
-#  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>
-
-#  include <Kokkos_Core.hpp>
+#include <Kokkos_Core.hpp>
 
 DEAL_II_NAMESPACE_OPEN
 
@@ -526,5 +524,3 @@ namespace CUDAWrappers
 DEAL_II_NAMESPACE_CLOSE
 
 #endif
-
-#endif
index 90942f92fe3b98c98c3aa0ff6b6a6082942e0f3c..743b06f0155ab700575a1929fd7babb44ea8d087 100644 (file)
 
 #include <deal.II/base/config.h>
 
-#ifdef DEAL_II_WITH_CUDA
+#include <deal.II/base/cuda_size.h>
 
-#  include <deal.II/base/cuda_size.h>
+#include <deal.II/matrix_free/hanging_nodes_internal.h>
 
-#  include <deal.II/matrix_free/hanging_nodes_internal.h>
-
-#  include <Kokkos_Macros.hpp>
+#include <Kokkos_Macros.hpp>
 
 DEAL_II_NAMESPACE_OPEN
 namespace CUDAWrappers
@@ -464,5 +462,3 @@ namespace CUDAWrappers
 
 DEAL_II_NAMESPACE_CLOSE
 #endif
-
-#endif
index 3666d7e853ff970c56986848dc1bf73846965c54..a30d57b2603d7475a93a1764ad99bd81e6e781b9 100644 (file)
 
 #include <deal.II/base/config.h>
 
-#ifdef DEAL_II_WITH_CUDA
-
-#  include <deal.II/base/cuda_size.h>
-#  include <deal.II/base/memory_space.h>
-#  include <deal.II/base/mpi_stub.h>
-#  include <deal.II/base/partitioner.h>
-#  include <deal.II/base/quadrature.h>
-#  include <deal.II/base/tensor.h>
-#  include <deal.II/base/utilities.h>
+#include <deal.II/base/cuda_size.h>
+#include <deal.II/base/memory_space.h>
+#include <deal.II/base/mpi_stub.h>
+#include <deal.II/base/partitioner.h>
+#include <deal.II/base/quadrature.h>
+#include <deal.II/base/tensor.h>
+#include <deal.II/base/utilities.h>
 
-#  include <deal.II/dofs/dof_handler.h>
+#include <deal.II/dofs/dof_handler.h>
 
-#  include <deal.II/fe/fe_update_flags.h>
-#  include <deal.II/fe/mapping.h>
+#include <deal.II/fe/fe_update_flags.h>
+#include <deal.II/fe/mapping.h>
 
-#  include <deal.II/grid/filtered_iterator.h>
+#include <deal.II/grid/filtered_iterator.h>
 
-#  include <deal.II/lac/affine_constraints.h>
-#  include <deal.II/lac/cuda_vector.h>
-#  include <deal.II/lac/la_parallel_vector.h>
+#include <deal.II/lac/affine_constraints.h>
+#include <deal.II/lac/cuda_vector.h>
+#include <deal.II/lac/la_parallel_vector.h>
 
-#  include <Kokkos_Core.hpp>
+#include <Kokkos_Core.hpp>
 
 
 
@@ -58,13 +56,13 @@ namespace internal
 namespace CUDAWrappers
 {
   // forward declaration
-#  ifndef DOXYGEN
+#ifndef DOXYGEN
   namespace internal
   {
     template <int dim, typename Number>
     class ReinitHelper;
   }
-#  endif
+#endif
 
   /**
    * This class collects all the data that is stored for the matrix free
@@ -118,12 +116,12 @@ namespace CUDAWrappers
         , use_coloring(use_coloring)
         , overlap_communication_computation(overlap_communication_computation)
       {
-#  ifndef DEAL_II_MPI_WITH_DEVICE_SUPPORT
+#ifndef DEAL_II_MPI_WITH_DEVICE_SUPPORT
         AssertThrow(
           overlap_communication_computation == false,
           ExcMessage(
             "Overlapping communication and computation requires CUDA-aware MPI."));
-#  endif
+#endif
         if (overlap_communication_computation == true)
           AssertThrow(
             use_coloring == false || overlap_communication_computation == false,
@@ -377,6 +375,7 @@ namespace CUDAWrappers
     void
     set_constrained_values(const Number val, VectorType &dst) const;
 
+#ifdef DEAL_II_WITH_CUDA
     /**
      * Initialize a serial vector. The size corresponds to the number of degrees
      * of freedom in the DoFHandler object.
@@ -384,6 +383,7 @@ namespace CUDAWrappers
     void
     initialize_dof_vector(
       LinearAlgebra::CUDAWrappers::Vector<Number> &vec) const;
+#endif
 
     /**
      * Initialize a distributed vector. The local elements correspond to the
@@ -392,7 +392,8 @@ namespace CUDAWrappers
      */
     void
     initialize_dof_vector(
-      LinearAlgebra::distributed::Vector<Number, MemorySpace::CUDA> &vec) const;
+      LinearAlgebra::distributed::Vector<Number, MemorySpace::Default> &vec)
+      const;
 
     /**
      * Return the colored graph of locally owned active cells.
@@ -456,10 +457,13 @@ namespace CUDAWrappers
     template <typename Functor>
     void
     distributed_cell_loop(
-      const Functor &                                                      func,
-      const LinearAlgebra::distributed::Vector<Number, MemorySpace::CUDA> &src,
-      LinearAlgebra::distributed::Vector<Number, MemorySpace::CUDA> &dst) const;
+      const Functor &func,
+      const LinearAlgebra::distributed::Vector<Number, MemorySpace::Default>
+        &                                                               src,
+      LinearAlgebra::distributed::Vector<Number, MemorySpace::Default> &dst)
+      const;
 
+#ifdef DEAL_II_WITH_CUDA
     /**
      * This function should never be called. Calling it results in an internal
      * error. This function exists only because cell_loop needs
@@ -471,6 +475,7 @@ namespace CUDAWrappers
       const Functor &                                    func,
       const LinearAlgebra::CUDAWrappers::Vector<Number> &src,
       LinearAlgebra::CUDAWrappers::Vector<Number> &      dst) const;
+#endif
 
     /**
      * Unique ID associated with the object.
@@ -591,18 +596,6 @@ namespace CUDAWrappers
     Kokkos::View<Number *, MemorySpace::Default::kokkos_space>
       constraint_weights;
 
-    /**
-     * Grid dimensions associated to the different colors. The grid dimensions
-     * are used to launch the CUDA kernels.
-     */
-    std::vector<dim3> grid_dim;
-
-    /**
-     * Block dimensions associated to the different colors. The block dimensions
-     * are used to launch the CUDA kernels.
-     */
-    std::vector<dim3> block_dim;
-
     /**
      * Shared pointer to a Partitioner for distributed Vectors used in
      * cell_loop. When MPI is not used the pointer is null.
@@ -788,8 +781,6 @@ namespace CUDAWrappers
     data_host.row_start      = data.row_start;
     data_host.use_coloring   = data.use_coloring;
 
-    const unsigned int n_elements =
-      data_host.n_cells * data_host.padding_length;
     if (update_flags & update_quadrature_points)
       {
         data_host.q_points = Kokkos::create_mirror(data.q_points);
@@ -820,7 +811,7 @@ namespace CUDAWrappers
 
   /*----------------------- Inline functions ---------------------------------*/
 
-#  ifndef DOXYGEN
+#ifndef DOXYGEN
 
   template <int dim, typename Number>
   inline const std::vector<std::vector<
@@ -850,11 +841,10 @@ namespace CUDAWrappers
     return *dof_handler;
   }
 
-#  endif
+#endif
 
 } // namespace CUDAWrappers
 
 DEAL_II_NAMESPACE_CLOSE
 
 #endif
-#endif
index 6884cf56819bb1091e289882a6f8bc7790921048..981e525d44b4ad6c4a21540ceaf63af4c423feca 100644 (file)
 
 #include <deal.II/base/config.h>
 
-#ifdef DEAL_II_WITH_CUDA
-
-#  include <deal.II/base/cuda.h>
-#  include <deal.II/base/cuda_size.h>
-#  include <deal.II/base/graph_coloring.h>
-#  include <deal.II/base/memory_space.h>
+#include <deal.II/base/cuda.h>
+#include <deal.II/base/cuda_size.h>
+#include <deal.II/base/graph_coloring.h>
+#include <deal.II/base/memory_space.h>
 
-#  include <deal.II/dofs/dof_tools.h>
+#include <deal.II/dofs/dof_tools.h>
 
-#  include <deal.II/fe/fe_dgq.h>
-#  include <deal.II/fe/fe_values.h>
-#  include <deal.II/fe/mapping_q1.h>
+#include <deal.II/fe/fe_dgq.h>
+#include <deal.II/fe/fe_values.h>
+#include <deal.II/fe/mapping_q1.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/shape_info.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/shape_info.h>
 
-#  include <Kokkos_Core.hpp>
+#include <Kokkos_Core.hpp>
+#ifdef DEAL_II_WITH_CUDA
 #  include <cuda_runtime_api.h>
+#endif
 
-#  include <cmath>
-#  include <functional>
-#  include <string>
+#include <cmath>
+#include <functional>
+#include <string>
 
 
 DEAL_II_NAMESPACE_OPEN
@@ -132,8 +132,6 @@ namespace CUDAWrappers
       // We need at least three colors when we are using CUDA-aware MPI and
       // overlapping the communication
       data->n_cells.resize(std::max(n_colors, 3U), 0);
-      data->grid_dim.resize(n_colors);
-      data->block_dim.resize(n_colors);
       data->local_to_global.resize(n_colors);
       data->constraint_mask.resize(n_colors);
 
@@ -309,6 +307,7 @@ namespace CUDAWrappers
       }
     };
 
+#ifdef DEAL_II_WITH_CUDA
     template <>
     struct VectorLocalSize<LinearAlgebra::CUDAWrappers::Vector<double>>
     {
@@ -328,6 +327,7 @@ namespace CUDAWrappers
         return vec.size();
       }
     };
+#endif
 
 
 
@@ -557,7 +557,7 @@ namespace CUDAWrappers
   }
 
 
-
+#ifdef DEAL_II_WITH_CUDA
   template <int dim, typename Number>
   void
   MatrixFree<dim, Number>::initialize_dof_vector(
@@ -565,13 +565,14 @@ namespace CUDAWrappers
   {
     vec.reinit(n_dofs);
   }
+#endif
 
 
 
   template <int dim, typename Number>
   void
   MatrixFree<dim, Number>::initialize_dof_vector(
-    LinearAlgebra::distributed::Vector<Number, MemorySpace::CUDA> &vec) const
+    LinearAlgebra::distributed::Vector<Number, MemorySpace::Default> &vec) const
   {
     if (partitioner)
       vec.reinit(partitioner);
@@ -635,7 +636,6 @@ namespace CUDAWrappers
     // First compute the size of n_cells, row_starts, kernel launch parameters,
     // and constrained_dofs
     std::size_t bytes = n_cells.size() * sizeof(unsigned int) * 2 +
-                        2 * n_colors * sizeof(dim3) +
                         n_constrained_dofs * sizeof(unsigned int);
 
     // For each color, add local_to_global, inv_jacobian, JxW, and q_points.
@@ -668,9 +668,6 @@ namespace CUDAWrappers
   {
     dof_handler = &dof_handler_;
 
-    if (typeid(Number) == typeid(double))
-      cudaDeviceSetSharedMemConfig(cudaSharedMemBankSizeEightByte);
-
     UpdateFlags update_flags = additional_data.mapping_update_flags;
     if (update_flags & update_gradients)
       update_flags |= update_JxW_values;
@@ -937,9 +934,9 @@ namespace CUDAWrappers
   template <typename Functor>
   void
   MatrixFree<dim, Number>::distributed_cell_loop(
-    const Functor &                                                      func,
-    const LinearAlgebra::distributed::Vector<Number, MemorySpace::CUDA> &src,
-    LinearAlgebra::distributed::Vector<Number, MemorySpace::CUDA> &dst) const
+    const Functor &func,
+    const LinearAlgebra::distributed::Vector<Number, MemorySpace::Default> &src,
+    LinearAlgebra::distributed::Vector<Number, MemorySpace::Default> &dst) const
   {
     MemorySpace::Default::kokkos_space::execution_space exec;
 
@@ -1046,12 +1043,13 @@ namespace CUDAWrappers
     else
       {
         // Create the ghosted source and the ghosted destination
-        LinearAlgebra::distributed::Vector<Number, MemorySpace::CUDA>
+        LinearAlgebra::distributed::Vector<Number, MemorySpace::Default>
           ghosted_src(partitioner);
-        LinearAlgebra::distributed::Vector<Number, MemorySpace::CUDA>
+        LinearAlgebra::distributed::Vector<Number, MemorySpace::Default>
           ghosted_dst(ghosted_src);
         ghosted_src = src;
         ghosted_dst = dst;
+        ghosted_dst.zero_out_ghost_values();
 
         // Execute the loop on the cells
         for (unsigned int i = 0; i < n_colors; ++i)
@@ -1062,7 +1060,10 @@ namespace CUDAWrappers
                 team_policy(exec, n_cells[i], Kokkos::AUTO);
 
               internal::ApplyKernel<dim, Number, Functor> apply_kernel(
-                func, get_data(i), src.get_values(), dst.get_values());
+                func,
+                get_data(i),
+                ghosted_src.get_values(),
+                ghosted_dst.get_values());
 
               Kokkos::parallel_for(
                 "dealii::MatrixFree::distributed_cell_loop_" +
@@ -1077,8 +1078,7 @@ namespace CUDAWrappers
       }
   }
 
-
-
+#ifdef DEAL_II_WITH_CUDA
   template <int dim, typename Number>
   template <typename Functor>
   void
@@ -1089,10 +1089,9 @@ namespace CUDAWrappers
   {
     Assert(false, ExcInternalError());
   }
+#endif
 } // namespace CUDAWrappers
 
 DEAL_II_NAMESPACE_CLOSE
 
 #endif
-
-#endif
index b191a0cf5bdc4759da4ff5ceccdeaa554f3d94b3..ae39a56f51cecd9949eeec022415632d59664a9a 100644 (file)
@@ -23,8 +23,6 @@
 
 #include <deal.II/matrix_free/cuda_matrix_free.templates.h>
 
-#ifdef DEAL_II_WITH_CUDA
-
 DEAL_II_NAMESPACE_OPEN
 
 
@@ -756,5 +754,3 @@ namespace CUDAWrappers
 DEAL_II_NAMESPACE_CLOSE
 
 #endif
-
-#endif
index 995f85a3917321bec3f570106feccca828c39ae5..19212afd9424fa23608d82a6893d0113b4446433 100644 (file)
@@ -14,6 +14,7 @@
 ## ---------------------------------------------------------------------
 
 set(_src
+  cuda_matrix_free.cc
   dof_info.cc
   evaluation_template_factory.cc
   evaluation_template_factory_inst2.cc
@@ -52,15 +53,5 @@ file(GLOB _header
   ${CMAKE_SOURCE_DIR}/include/deal.II/matrix_free/*.h
   )
 
-if(DEAL_II_WITH_CUDA)
-  set(_src
-    cuda_matrix_free.cc
-    ${_src}
-    )
-  set(_inst
-    ${_inst}
-    )
-endif()
-
 define_object_library(object_matrix_free OBJECT ${_src} ${_header} ${_inst})
 expand_instantiations(object_matrix_free "${_inst}")
index 2ff0a5968f02b04402f3fc058321b7f740ff218b..22f89f3b11c3eac44a53905aac2978a4942d7b9f 100644 (file)
@@ -15,8 +15,6 @@
 
 #include <deal.II/matrix_free/cuda_matrix_free.templates.h>
 
-#ifdef DEAL_II_WITH_CUDA
-
 DEAL_II_NAMESPACE_OPEN
 
 
@@ -31,5 +29,3 @@ namespace CUDAWrappers
 } // namespace CUDAWrappers
 
 DEAL_II_NAMESPACE_CLOSE
-
-#endif
similarity index 97%
rename from tests/cuda/matrix_free_initialize_vector.cc
rename to tests/matrix_free/matrix_free_device_initialize_vector.cc
index 7cdefebe5fc9b576269de3b8639d06067d3006c3..0c53f24828f7197fba981ae35d8d333ea4bfc665 100644 (file)
@@ -50,6 +50,7 @@ check(const LinearAlgebra::distributed::Vector<Number, MemorySpace::Default>
          ExcInternalError());
 }
 
+#ifdef DEAL_II_WITH_CUDA
 template <typename Number>
 void
 check(const LinearAlgebra::CUDAWrappers::Vector<Number> &vector,
@@ -57,6 +58,7 @@ check(const LinearAlgebra::CUDAWrappers::Vector<Number> &vector,
 {
   AssertDimension(vector.size(), reference_partitioner.size());
 }
+#endif
 
 template <int dim, int fe_degree, typename VectorType>
 void
@@ -113,14 +115,16 @@ main(int argc, char **argv)
   unsigned int myid = Utilities::MPI::this_mpi_process(MPI_COMM_WORLD);
   deallog.push(Utilities::int_to_string(myid));
 
-  init_cuda(true);
+  // init_cuda(true);
   MPILogInitAll mpi_inilog;
 
   test<2,
        1,
        LinearAlgebra::distributed::Vector<double, MemorySpace::Default>>();
+
+#ifdef DEAL_II_WITH_CUDA
   if (Utilities::MPI::n_mpi_processes(MPI_COMM_WORLD) == 1)
     test<2, 1, LinearAlgebra::CUDAWrappers::Vector<double>>();
-
+#endif
   return 0;
 }
diff --git a/tests/matrix_free/matrix_free_device_initialize_vector.with_mpi=on.with_p4est=on.with_cuda=on.mpirun=1.output b/tests/matrix_free/matrix_free_device_initialize_vector.with_mpi=on.with_p4est=on.with_cuda=on.mpirun=1.output
new file mode 100644 (file)
index 0000000..7e4be31
--- /dev/null
@@ -0,0 +1,13 @@
+
+
+-
+-DEAL:0:0::locally owned dofs :
+-{[0,24]}
+-DEAL:0:0::locally relevant dofs :
+-{[0,24]}
+-DEAL:0:0::OK
+-DEAL:0:0::locally owned dofs :
+-{[0,24]}
+-DEAL:0:0::locally relevant dofs :
+-{[0,24]}
+-DEAL:0:0::OK
similarity index 91%
rename from tests/cuda/matrix_free_matrix_vector_01.cc
rename to tests/matrix_free/matrix_free_device_matrix_vector_01.cc
index c6a79083fc26cbdf4a19ea889d4177b86bf5bcaa..e626ae812cef72dfaaa439e9ae12d3a689560e3c 100644 (file)
@@ -22,7 +22,7 @@
 
 #include "../tests.h"
 
-#include "matrix_vector_common.h"
+#include "matrix_vector_device_common.h"
 
 template <int dim, int fe_degree, typename Number>
 void
@@ -41,6 +41,6 @@ test()
   do_test<dim,
           fe_degree,
           Number,
-          LinearAlgebra::CUDAWrappers::Vector<Number>,
+          LinearAlgebra::distributed::Vector<Number, MemorySpace::Default>,
           fe_degree + 1>(dof, constraints, tria.n_active_cells());
 }
similarity index 93%
rename from tests/cuda/matrix_free_matrix_vector_02.cc
rename to tests/matrix_free/matrix_free_device_matrix_vector_02.cc
index ceaa73a31a55477456d18038bc7f149ca1a6a59e..f50cb6c52232b44ac65ba7206bed5623ef95e2a5 100644 (file)
@@ -22,7 +22,7 @@
 
 #include "../tests.h"
 
-#include "matrix_vector_common.h"
+#include "matrix_vector_device_common.h"
 
 template <int dim, int fe_degree, typename Number>
 void
@@ -45,6 +45,6 @@ test()
   do_test<dim,
           fe_degree,
           Number,
-          LinearAlgebra::CUDAWrappers::Vector<Number>,
+          LinearAlgebra::distributed::Vector<Number, MemorySpace::Default>,
           fe_degree + 1>(dof, constraints, tria.n_active_cells());
 }
similarity index 95%
rename from tests/cuda/matrix_free_matrix_vector_03.cc
rename to tests/matrix_free/matrix_free_device_matrix_vector_03.cc
index cd581a99c5f43180ba301319e36a22df36ce2643..2894340c29de8150ab2888f1e1da569ea1e13316 100644 (file)
@@ -24,7 +24,7 @@
 
 #include "../tests.h"
 
-#include "matrix_vector_common.h"
+#include "matrix_vector_device_common.h"
 
 template <int dim, int fe_degree, typename Number>
 void
@@ -66,6 +66,6 @@ test()
   do_test<dim,
           fe_degree,
           Number,
-          LinearAlgebra::CUDAWrappers::Vector<Number>,
+          LinearAlgebra::distributed::Vector<Number, MemorySpace::Default>,
           fe_degree + 1>(dof, constraints, tria.n_active_cells());
 }
similarity index 95%
rename from tests/cuda/matrix_free_matrix_vector_03b.cc
rename to tests/matrix_free/matrix_free_device_matrix_vector_03b.cc
index 464aadc676132ea3d12a8e3e44c51c474868ba45..38e924ea143b6148d94edba39f65fc7d1367a6d4 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "../tests.h"
 
-#include "matrix_vector_common.h"
+#include "matrix_vector_device_common.h"
 
 template <int dim, int fe_degree, typename Number>
 void
@@ -68,6 +68,6 @@ test()
   do_test<dim,
           fe_degree,
           Number,
-          LinearAlgebra::CUDAWrappers::Vector<Number>,
+          LinearAlgebra::distributed::Vector<Number, MemorySpace::Default>,
           fe_degree + 1>(dof, constraints, tria.n_active_cells(), true, true);
 }
similarity index 92%
rename from tests/cuda/matrix_free_matrix_vector_04.cc
rename to tests/matrix_free/matrix_free_device_matrix_vector_04.cc
index c27adc0907eca3e03472562f53a69e0e22985355..f68d81e5fb485af6e42246926f73393df83f80f3 100644 (file)
@@ -21,7 +21,7 @@
 
 #include "../tests.h"
 
-#include "matrix_vector_common.h"
+#include "matrix_vector_device_common.h"
 
 
 template <int dim, int fe_degree, typename Number>
@@ -45,6 +45,6 @@ test()
   do_test<dim,
           fe_degree,
           Number,
-          LinearAlgebra::CUDAWrappers::Vector<Number>,
+          LinearAlgebra::distributed::Vector<Number, MemorySpace::Default>,
           fe_degree + 1>(dof, constraints, tria.n_active_cells());
 }
similarity index 95%
rename from tests/cuda/matrix_free_matrix_vector_05.cc
rename to tests/matrix_free/matrix_free_device_matrix_vector_05.cc
index cffa01115f5e22b7e37fb6c3f6bbbe622072b5b3..b8daf713cc99a594f201a9569becf8fa6572858f 100644 (file)
@@ -22,7 +22,7 @@
 
 #include "../tests.h"
 
-#include "matrix_vector_common.h"
+#include "matrix_vector_device_common.h"
 
 
 template <int dim, int fe_degree, typename Number>
@@ -77,6 +77,6 @@ test()
   do_test<dim,
           fe_degree,
           Number,
-          LinearAlgebra::CUDAWrappers::Vector<Number>,
+          LinearAlgebra::distributed::Vector<Number, MemorySpace::Default>,
           fe_degree + 1>(dof, constraints, tria.n_active_cells());
 }
similarity index 95%
rename from tests/cuda/matrix_free_matrix_vector_06.cc
rename to tests/matrix_free/matrix_free_device_matrix_vector_06.cc
index 27fdf46f730ca7007d9467d6cc26e4da8b11c58f..14776e9dc8ee9f17842296dee4616320119bb32d 100644 (file)
@@ -26,7 +26,7 @@
 #include "../tests.h"
 
 #include "create_mesh.h"
-#include "matrix_vector_common.h"
+#include "matrix_vector_device_common.h"
 
 template <int dim, int fe_degree, typename Number>
 void
@@ -75,6 +75,6 @@ test()
   do_test<dim,
           fe_degree,
           Number,
-          LinearAlgebra::CUDAWrappers::Vector<Number>,
+          LinearAlgebra::distributed::Vector<Number, MemorySpace::Default>,
           fe_degree + 1>(dof, constraints, tria.n_active_cells());
 }
similarity index 97%
rename from tests/cuda/matrix_free_matrix_vector_06a.cc
rename to tests/matrix_free/matrix_free_device_matrix_vector_06a.cc
index e20b65caaa3afa2d4b0e3d442af589d76ca8dac3..41ea3e611b9be7890f062435e19860a50ea3ae6e 100644 (file)
@@ -22,7 +22,7 @@
 #include "../tests.h"
 
 #include "create_mesh.h"
-#include "matrix_vector_common.h"
+#include "matrix_vector_device_common.h"
 
 template <int dim, int fe_degree, typename Number>
 void
@@ -71,6 +71,6 @@ test()
   do_test<dim,
           fe_degree,
           Number,
-          LinearAlgebra::distributed::Vector<Number, MemorySpace::CUDA>,
+          LinearAlgebra::distributed::Vector<Number, MemorySpace::Default>,
           fe_degree + 1>(dof, constraints, tria.n_active_cells());
 }
similarity index 97%
rename from tests/cuda/matrix_free_matrix_vector_06b.cc
rename to tests/matrix_free/matrix_free_device_matrix_vector_06b.cc
index 473297c9b36dcb3574114988480c7b5cfe3a6fed..5d7d72718ac7961de12188694d014ad6fa6cb181 100644 (file)
@@ -21,7 +21,7 @@
 #include "../tests.h"
 
 #include "create_mesh.h"
-#include "matrix_vector_common.h"
+#include "matrix_vector_device_common.h"
 
 template <int dim, int fe_degree, typename Number>
 void
@@ -70,6 +70,6 @@ test()
   do_test<dim,
           fe_degree,
           Number,
-          LinearAlgebra::distributed::Vector<Number, MemorySpace::CUDA>,
+          LinearAlgebra::distributed::Vector<Number, MemorySpace::Default>,
           fe_degree + 1>(dof, constraints, tria.n_active_cells(), false);
 }
similarity index 95%
rename from tests/cuda/matrix_free_matrix_vector_09.cc
rename to tests/matrix_free/matrix_free_device_matrix_vector_09.cc
index 13244c274df26b17e1ebb2645c27e78796eea6c1..833319faef17e0d8817e6b7c14f0d77993ade47a 100644 (file)
@@ -24,7 +24,7 @@
 #include "../tests.h"
 
 #include "create_mesh.h"
-#include "matrix_vector_common.h"
+#include "matrix_vector_device_common.h"
 
 template <int dim, int fe_degree, typename Number>
 void
@@ -73,6 +73,6 @@ test()
   do_test<dim,
           fe_degree,
           Number,
-          LinearAlgebra::CUDAWrappers::Vector<Number>,
+          LinearAlgebra::distributed::Vector<Number, MemorySpace::Default>,
           fe_degree + 1>(dof, constraints, tria.n_active_cells());
 }
similarity index 95%
rename from tests/cuda/matrix_free_matrix_vector_10.cc
rename to tests/matrix_free/matrix_free_device_matrix_vector_10.cc
index 6ea858759ae424276d2ec87d2e23a4286b1075e1..92b50ded61262d0bb526342db9f5416543733ee8 100644 (file)
@@ -46,7 +46,7 @@
 
 #include "../tests.h"
 
-#include "matrix_vector_mf.h"
+#include "matrix_vector_device_mf.h"
 
 
 
@@ -117,13 +117,14 @@ test()
 
   const unsigned int coef_size =
     tria.n_locally_owned_active_cells() * std::pow(fe_degree + 1, dim);
-  MatrixFreeTest<dim,
-                 fe_degree,
-                 Number,
-                 LinearAlgebra::distributed::Vector<Number, MemorySpace::CUDA>>
+  MatrixFreeTest<
+    dim,
+    fe_degree,
+    Number,
+    LinearAlgebra::distributed::Vector<Number, MemorySpace::Default>>
     mf(mf_data, coef_size);
-  LinearAlgebra::distributed::Vector<Number, MemorySpace::CUDA> in_dev;
-  LinearAlgebra::distributed::Vector<Number, MemorySpace::CUDA> out_dev;
+  LinearAlgebra::distributed::Vector<Number, MemorySpace::Default> in_dev;
+  LinearAlgebra::distributed::Vector<Number, MemorySpace::Default> out_dev;
   mf_data.initialize_dof_vector(in_dev);
   mf_data.initialize_dof_vector(out_dev);
 
@@ -224,8 +225,6 @@ main(int argc, char **argv)
   unsigned int myid = Utilities::MPI::this_mpi_process(MPI_COMM_WORLD);
   deallog.push(Utilities::int_to_string(myid));
 
-  init_cuda(true);
-
   if (myid == 0)
     {
       initlog();
similarity index 95%
rename from tests/cuda/matrix_free_matrix_vector_10a.cc
rename to tests/matrix_free/matrix_free_device_matrix_vector_10a.cc
index 7c434dd7bbb7ea3a3155f91d241e2ab866099f64..513c8bdb824b264662c62a89ae1bbae380dbe3d5 100644 (file)
@@ -41,7 +41,7 @@
 
 #include "../tests.h"
 
-#include "matrix_vector_mf.h"
+#include "matrix_vector_device_mf.h"
 
 
 template <int dim>
@@ -119,14 +119,15 @@ test()
 
   const unsigned int coef_size =
     tria.n_locally_owned_active_cells() * std::pow(fe_degree + 1, dim);
-  MatrixFreeTest<dim,
-                 fe_degree,
-                 Number,
-                 LinearAlgebra::distributed::Vector<Number, MemorySpace::CUDA>>
+  MatrixFreeTest<
+    dim,
+    fe_degree,
+    Number,
+    LinearAlgebra::distributed::Vector<Number, MemorySpace::Default>>
     mf(mf_data, coef_size, false);
 
-  LinearAlgebra::distributed::Vector<Number, MemorySpace::CUDA> in_dev;
-  LinearAlgebra::distributed::Vector<Number, MemorySpace::CUDA> out_dev;
+  LinearAlgebra::distributed::Vector<Number, MemorySpace::Default> in_dev;
+  LinearAlgebra::distributed::Vector<Number, MemorySpace::Default> out_dev;
   mf_data.initialize_dof_vector(in_dev);
   mf_data.initialize_dof_vector(out_dev);
   LinearAlgebra::ReadWriteVector<Number> rw_in(owned_set);
@@ -230,8 +231,6 @@ main(int argc, char **argv)
   unsigned int myid = Utilities::MPI::this_mpi_process(MPI_COMM_WORLD);
   deallog.push(Utilities::int_to_string(myid));
 
-  init_cuda(true);
-
   if (myid == 0)
     {
       initlog();
similarity index 95%
rename from tests/cuda/matrix_free_matrix_vector_19.cc
rename to tests/matrix_free/matrix_free_device_matrix_vector_19.cc
index 39fba645166426210ec80ea23be57f7a00a7010d..f71c3c5f33c7e3979caaf42726b8a46f4c4b3513 100644 (file)
@@ -42,7 +42,7 @@
 
 #include "../tests.h"
 
-#include "matrix_vector_mf.h"
+#include "matrix_vector_device_mf.h"
 
 
 
@@ -113,14 +113,15 @@ test()
 
   const unsigned int coef_size =
     tria.n_locally_owned_active_cells() * std::pow(fe_degree + 1, dim);
-  MatrixFreeTest<dim,
-                 fe_degree,
-                 Number,
-                 LinearAlgebra::distributed::Vector<Number, MemorySpace::CUDA>>
+  MatrixFreeTest<
+    dim,
+    fe_degree,
+    Number,
+    LinearAlgebra::distributed::Vector<Number, MemorySpace::Default>>
     mf(mf_data, coef_size);
-  LinearAlgebra::distributed::Vector<Number, MemorySpace::CUDA> in_dev(
+  LinearAlgebra::distributed::Vector<Number, MemorySpace::Default> in_dev(
     owned_set, MPI_COMM_WORLD);
-  LinearAlgebra::distributed::Vector<Number, MemorySpace::CUDA> out_dev(
+  LinearAlgebra::distributed::Vector<Number, MemorySpace::Default> out_dev(
     owned_set, MPI_COMM_WORLD);
 
   LinearAlgebra::ReadWriteVector<Number> rw_in(owned_set);
@@ -220,8 +221,6 @@ main(int argc, char **argv)
   unsigned int myid = Utilities::MPI::this_mpi_process(MPI_COMM_WORLD);
   deallog.push(Utilities::int_to_string(myid));
 
-  init_cuda(true);
-
   if (myid == 0)
     {
       initlog();
similarity index 95%
rename from tests/cuda/matrix_free_matrix_vector_25.cc
rename to tests/matrix_free/matrix_free_device_matrix_vector_25.cc
index a80c6ac3b434d25ecbd0037546cef8062ce498c0..dcb5464c43f1f18d2f00824b5eb9cdc8a6e4a1fc 100644 (file)
@@ -40,7 +40,7 @@
 
 #include "../tests.h"
 
-#include "matrix_vector_mf.h"
+#include "matrix_vector_device_mf.h"
 
 
 
@@ -120,13 +120,14 @@ test()
 
   const unsigned int coef_size =
     tria.n_locally_owned_active_cells() * std::pow(fe_degree + 1, dim);
-  MatrixFreeTest<dim,
-                 fe_degree,
-                 Number,
-                 LinearAlgebra::distributed::Vector<Number, MemorySpace::CUDA>>
+  MatrixFreeTest<
+    dim,
+    fe_degree,
+    Number,
+    LinearAlgebra::distributed::Vector<Number, MemorySpace::Default>>
     mf(mf_data, coef_size);
-  LinearAlgebra::distributed::Vector<Number, MemorySpace::CUDA> in_dev;
-  LinearAlgebra::distributed::Vector<Number, MemorySpace::CUDA> out_dev;
+  LinearAlgebra::distributed::Vector<Number, MemorySpace::Default> in_dev;
+  LinearAlgebra::distributed::Vector<Number, MemorySpace::Default> out_dev;
   mf_data.initialize_dof_vector(in_dev);
   mf_data.initialize_dof_vector(out_dev);
 
@@ -227,8 +228,6 @@ main(int argc, char **argv)
   unsigned int myid = Utilities::MPI::this_mpi_process(MPI_COMM_WORLD);
   deallog.push(Utilities::int_to_string(myid));
 
-  init_cuda(true);
-
   if (myid == 0)
     {
       initlog();
similarity index 96%
rename from tests/cuda/matrix_free_matrix_vector_26.cc
rename to tests/matrix_free/matrix_free_device_matrix_vector_26.cc
index 8c1eeaf80391676dc726b7527ba31e51964f9c6c..32b73b449b7af9006904912642894b3671d505cc 100644 (file)
@@ -42,7 +42,7 @@
 
 #include "../tests.h"
 
-#include "matrix_vector_mf.h"
+#include "matrix_vector_device_mf.h"
 
 
 
@@ -126,13 +126,14 @@ test()
 
   const unsigned int coef_size =
     tria.n_locally_owned_active_cells() * std::pow(fe_degree + 1, dim);
-  MatrixFreeTest<dim,
-                 fe_degree,
-                 Number,
-                 LinearAlgebra::distributed::Vector<Number, MemorySpace::CUDA>>
+  MatrixFreeTest<
+    dim,
+    fe_degree,
+    Number,
+    LinearAlgebra::distributed::Vector<Number, MemorySpace::Default>>
     mf(mf_data, coef_size);
-  LinearAlgebra::distributed::Vector<Number, MemorySpace::CUDA> in_dev;
-  LinearAlgebra::distributed::Vector<Number, MemorySpace::CUDA> out_dev;
+  LinearAlgebra::distributed::Vector<Number, MemorySpace::Default> in_dev;
+  LinearAlgebra::distributed::Vector<Number, MemorySpace::Default> out_dev;
   mf_data.initialize_dof_vector(in_dev);
   mf_data.initialize_dof_vector(out_dev);
 
@@ -233,8 +234,6 @@ main(int argc, char **argv)
   unsigned int myid = Utilities::MPI::this_mpi_process(MPI_COMM_WORLD);
   deallog.push(Utilities::int_to_string(myid));
 
-  init_cuda(true);
-
   if (myid == 0)
     {
       initlog();
similarity index 87%
rename from tests/cuda/matrix_free_multiple_objects.cc
rename to tests/matrix_free/matrix_free_device_multiple_objects.cc
index e1bf9da3b2d63fdf340f8c532879589389b41707..04d44ba029473c27d343c121afe35b2d5462a148 100644 (file)
 #include "../tests.h"
 
 #include "Kokkos_Core.hpp"
-#include "matrix_vector_mf.h"
+#include "matrix_vector_device_mf.h"
 
 template <int fe_degree, int n_q_points_1d>
 void
-do_test(const DoFHandler<2> &            dof,
-        MatrixFreeTest<2,
-                       fe_degree,
-                       double,
-                       LinearAlgebra::CUDAWrappers::Vector<double>,
-                       n_q_points_1d> &  mf,
+do_test(const DoFHandler<2> &dof,
+        MatrixFreeTest<
+          2,
+          fe_degree,
+          double,
+          LinearAlgebra::distributed::Vector<double, MemorySpace::Default>,
+          n_q_points_1d> &               mf,
         unsigned int                     n_dofs,
         MappingQ<2> &                    mapping,
         const AffineConstraints<double> &constraints)
 {
-  Vector<double>                              in_host(n_dofs), out_host(n_dofs);
-  LinearAlgebra::ReadWriteVector<double>      in(n_dofs), out(n_dofs);
-  LinearAlgebra::CUDAWrappers::Vector<double> in_device(n_dofs);
-  LinearAlgebra::CUDAWrappers::Vector<double> out_device(n_dofs);
+  Vector<double>                         in_host(n_dofs), out_host(n_dofs);
+  LinearAlgebra::ReadWriteVector<double> in(n_dofs), out(n_dofs);
+  LinearAlgebra::distributed::Vector<double, MemorySpace::Default> in_device(
+    n_dofs);
+  LinearAlgebra::distributed::Vector<double, MemorySpace::Default> out_device(
+    n_dofs);
 
   for (unsigned int i = 0; i < n_dofs; ++i)
     {
@@ -73,7 +76,7 @@ do_test(const DoFHandler<2> &            dof,
 
   in_device.import_elements(in, VectorOperation::insert);
   mf.vmult(out_device, in_device);
-  cudaDeviceSynchronize();
+  Kokkos::fence();
   out.import_elements(out_device, VectorOperation::insert);
 
   // assemble sparse matrix with (\nabla v, \nabla u) + (v, 10 * u)
@@ -149,7 +152,6 @@ main()
   deallog << std::setprecision(3);
 
   Kokkos::initialize();
-  init_cuda();
 
   {
     Triangulation<2> tria;
@@ -174,11 +176,12 @@ main()
     const QGauss<1> quad_1(n_q_points_1d_1);
     mf_data_1.reinit(mapping_1, dof_1, constraints, quad_1, additional_data_1);
     const unsigned int n_dofs_1 = dof_1.n_dofs();
-    MatrixFreeTest<2,
-                   fe_degree_1,
-                   double,
-                   LinearAlgebra::CUDAWrappers::Vector<double>,
-                   n_q_points_1d_1>
+    MatrixFreeTest<
+      2,
+      fe_degree_1,
+      double,
+      LinearAlgebra::distributed::Vector<double, MemorySpace::Default>,
+      n_q_points_1d_1>
       mf_1(mf_data_1,
            n_dofs_1 * std::pow(n_q_points_1d_1, 2),
            constant_coefficient);
@@ -198,11 +201,12 @@ main()
     const QGauss<1> quad_2(n_q_points_1d_2);
     mf_data_2.reinit(mapping_2, dof_2, constraints, quad_2, additional_data_2);
     const unsigned int n_dofs_2 = dof_2.n_dofs();
-    MatrixFreeTest<2,
-                   fe_degree_2,
-                   double,
-                   LinearAlgebra::CUDAWrappers::Vector<double>,
-                   n_q_points_1d_2>
+    MatrixFreeTest<
+      2,
+      fe_degree_2,
+      double,
+      LinearAlgebra::distributed::Vector<double, MemorySpace::Default>,
+      n_q_points_1d_2>
       mf_2(mf_data_2,
            n_dofs_2 * std::pow(n_q_points_1d_2, 2),
            constant_coefficient);
similarity index 92%
rename from tests/cuda/matrix_free_no_index_initialize.cc
rename to tests/matrix_free/matrix_free_device_no_index_initialize.cc
index bda055ddc69f2147e42c4f5a7302df1093863a9a..9ab2222c4f6eaa777aaa164ab4870f7e1fb78a92 100644 (file)
@@ -83,15 +83,12 @@ public:
   void
   test() const
   {
-    LinearAlgebra::distributed::Vector<Number, MemorySpace::CUDA> dst_dummy;
-    LinearAlgebra::distributed::Vector<Number, MemorySpace::CUDA> src_dummy;
+    LinearAlgebra::distributed::Vector<Number, MemorySpace::Default> dst_dummy;
+    LinearAlgebra::distributed::Vector<Number, MemorySpace::Default> src_dummy;
 
     data.cell_loop(*this, src_dummy, dst_dummy);
 
-    // Check that the kernel was launched correctly
-    AssertCuda(cudaPeekAtLastError());
-    // Check that there was no problem during the execution of the kernel
-    AssertCuda(cudaDeviceSynchronize());
+    Kokkos::fence();
 
     deallog << "OK" << std::endl;
   };
@@ -160,7 +157,6 @@ main()
   initlog();
 
   Kokkos::initialize();
-  init_cuda();
 
   test<2, 1>();
 
similarity index 99%
rename from tests/cuda/matrix_free_reinit_01.cc
rename to tests/matrix_free/matrix_free_device_reinit_01.cc
index 0d072baba338796124dcc9f71e752804bc1ff44c..6067986f162e6916e25d731f27f928b47eda0d8d 100644 (file)
@@ -91,7 +91,6 @@ main(int argc, char **argv)
   unsigned int myid = Utilities::MPI::this_mpi_process(MPI_COMM_WORLD);
   deallog.push(Utilities::int_to_string(myid));
 
-  init_cuda(true);
   MPILogInitAll mpi_inilog;
 
   test<2, 1>();
similarity index 98%
rename from tests/cuda/matrix_vector_common.h
rename to tests/matrix_free/matrix_vector_device_common.h
index 7420cf503242ebb1bcecba8f317ab17ae651bc2a..de11174444dedc3c43ad7dce78febe3ed19b46aa 100644 (file)
@@ -47,7 +47,7 @@
 #include "../tests.h"
 
 #include "Kokkos_Core.hpp"
-#include "matrix_vector_mf.h"
+#include "matrix_vector_device_mf.h"
 
 
 // forward declare this function. will be implemented in .cc files
@@ -116,7 +116,7 @@ do_test(const DoFHandler<dim> &          dof,
 
   in_device.import_elements(in, VectorOperation::insert);
   mf.vmult(out_device, in_device);
-  cudaDeviceSynchronize();
+  Kokkos::fence();
   out.import_elements(out_device, VectorOperation::insert);
 
   // assemble sparse matrix with (\nabla v, \nabla u) + (v, 10 * u)
@@ -197,8 +197,6 @@ main()
 
   Kokkos::initialize();
 
-  init_cuda();
-
   {
     deallog.push("double");
     deallog.push("2d");

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.