From a9ea7d884654c959567ddc1dc419e3dce938ebb2 Mon Sep 17 00:00:00 2001 From: Daniel Arndt Date: Thu, 5 Dec 2019 20:43:00 +0000 Subject: [PATCH] Test matrix-free CUDA for float --- .../matrix_free/cuda_matrix_free.templates.h | 14 ++--- tests/cuda/matrix_free_matrix_vector_01.cu | 12 ++--- .../cuda/matrix_free_matrix_vector_01.output | 54 ++++++++++++------- tests/cuda/matrix_free_matrix_vector_02.cu | 12 ++--- .../cuda/matrix_free_matrix_vector_02.output | 54 ++++++++++++------- tests/cuda/matrix_free_matrix_vector_03.cu | 11 ++-- .../cuda/matrix_free_matrix_vector_03.output | 54 ++++++++++++------- tests/cuda/matrix_free_matrix_vector_03b.cu | 11 ++-- .../cuda/matrix_free_matrix_vector_03b.output | 54 ++++++++++++------- tests/cuda/matrix_free_matrix_vector_04.cu | 11 ++-- .../cuda/matrix_free_matrix_vector_04.output | 54 ++++++++++++------- tests/cuda/matrix_free_matrix_vector_05.cu | 11 ++-- .../cuda/matrix_free_matrix_vector_05.output | 54 ++++++++++++------- tests/cuda/matrix_free_matrix_vector_06.cu | 11 ++-- .../cuda/matrix_free_matrix_vector_06.output | 18 ++++--- tests/cuda/matrix_free_matrix_vector_06a.cu | 11 ++-- .../cuda/matrix_free_matrix_vector_06a.output | 18 ++++--- tests/cuda/matrix_free_matrix_vector_06b.cu | 11 ++-- .../cuda/matrix_free_matrix_vector_06b.output | 18 ++++--- tests/cuda/matrix_free_matrix_vector_09.cu | 11 ++-- .../cuda/matrix_free_matrix_vector_09.output | 18 ++++--- tests/cuda/matrix_vector_common.h | 32 +++++++---- 22 files changed, 335 insertions(+), 219 deletions(-) diff --git a/include/deal.II/matrix_free/cuda_matrix_free.templates.h b/include/deal.II/matrix_free/cuda_matrix_free.templates.h index 9900fe10e2..a7ea5cd2b3 100644 --- a/include/deal.II/matrix_free/cuda_matrix_free.templates.h +++ b/include/deal.II/matrix_free/cuda_matrix_free.templates.h @@ -381,9 +381,9 @@ namespace CUDAWrappers { const std::vector> &q_points = fe_values.get_quadrature_points(); - memcpy(&q_points_host[cell_id * padding_length], - q_points.data(), - q_points_per_cell * sizeof(Point)); + std::copy(q_points.begin(), + q_points.end(), + &q_points_host[cell_id * padding_length]); } if (update_flags & update_JxW_values) @@ -398,9 +398,11 @@ namespace CUDAWrappers { const std::vector> &inv_jacobians = fe_values.get_inverse_jacobians(); - memcpy(&inv_jacobian_host[cell_id * padding_length * dim * dim], - inv_jacobians.data(), - q_points_per_cell * sizeof(DerivativeForm<1, dim, dim>)); + std::copy(&inv_jacobians[0][0][0], + &inv_jacobians[0][0][0] + + q_points_per_cell * sizeof(DerivativeForm<1, dim, dim>) / + sizeof(double), + &inv_jacobian_host[cell_id * padding_length * dim * dim]); } } diff --git a/tests/cuda/matrix_free_matrix_vector_01.cu b/tests/cuda/matrix_free_matrix_vector_01.cu index ce08bb12f1..6a0f58dad5 100644 --- a/tests/cuda/matrix_free_matrix_vector_01.cu +++ b/tests/cuda/matrix_free_matrix_vector_01.cu @@ -21,13 +21,9 @@ // constraints #include "../tests.h" - -std::ofstream logfile("output"); - #include "matrix_vector_common.h" - -template +template void test() { @@ -38,12 +34,12 @@ test() FE_Q fe(fe_degree); DoFHandler dof(tria); dof.distribute_dofs(fe); - AffineConstraints constraints; + AffineConstraints constraints; constraints.close(); do_test, + Number, + LinearAlgebra::CUDAWrappers::Vector, fe_degree + 1>(dof, constraints, tria.n_active_cells()); } diff --git a/tests/cuda/matrix_free_matrix_vector_01.output b/tests/cuda/matrix_free_matrix_vector_01.output index 43ef13cd75..6497d6d888 100644 --- a/tests/cuda/matrix_free_matrix_vector_01.output +++ b/tests/cuda/matrix_free_matrix_vector_01.output @@ -1,19 +1,37 @@ -DEAL:2d::Testing FE_Q<2>(1) -DEAL:2d::Norm of difference: 0 -DEAL:2d:: -DEAL:2d::Testing FE_Q<2>(2) -DEAL:2d::Norm of difference: 0 -DEAL:2d:: -DEAL:2d::Testing FE_Q<2>(3) -DEAL:2d::Norm of difference: 0 -DEAL:2d:: -DEAL:3d::Testing FE_Q<3>(1) -DEAL:3d::Norm of difference: 0 -DEAL:3d:: -DEAL:3d::Testing FE_Q<3>(2) -DEAL:3d::Norm of difference: 0 -DEAL:3d:: -DEAL:3d::Testing FE_Q<3>(3) -DEAL:3d::Norm of difference: 0 -DEAL:3d:: +DEAL:double:2d::Testing FE_Q<2>(1) +DEAL:double:2d::Norm of difference: 1.54e-15 +DEAL:double:2d:: +DEAL:double:2d::Testing FE_Q<2>(2) +DEAL:double:2d::Norm of difference: 2.38e-15 +DEAL:double:2d:: +DEAL:double:2d::Testing FE_Q<2>(3) +DEAL:double:2d::Norm of difference: 9.36e-15 +DEAL:double:2d:: +DEAL:double:3d::Testing FE_Q<3>(1) +DEAL:double:3d::Norm of difference: 1.78e-15 +DEAL:double:3d:: +DEAL:double:3d::Testing FE_Q<3>(2) +DEAL:double:3d::Norm of difference: 4.05e-15 +DEAL:double:3d:: +DEAL:double:3d::Testing FE_Q<3>(3) +DEAL:double:3d::Norm of difference: 2.13e-14 +DEAL:double:3d:: +DEAL:float:2d::Testing FE_Q<2>(1) +DEAL:float:2d::Norm of difference: 1.42e-15 +DEAL:float:2d:: +DEAL:float:2d::Testing FE_Q<2>(2) +DEAL:float:2d::Norm of difference: 2.49e-15 +DEAL:float:2d:: +DEAL:float:2d::Testing FE_Q<2>(3) +DEAL:float:2d::Norm of difference: 9.43e-15 +DEAL:float:2d:: +DEAL:float:3d::Testing FE_Q<3>(1) +DEAL:float:3d::Norm of difference: 1.25e-15 +DEAL:float:3d:: +DEAL:float:3d::Testing FE_Q<3>(2) +DEAL:float:3d::Norm of difference: 4.01e-15 +DEAL:float:3d:: +DEAL:float:3d::Testing FE_Q<3>(3) +DEAL:float:3d::Norm of difference: 2.37e-14 +DEAL:float:3d:: diff --git a/tests/cuda/matrix_free_matrix_vector_02.cu b/tests/cuda/matrix_free_matrix_vector_02.cu index 166b73cf87..2f20b805f4 100644 --- a/tests/cuda/matrix_free_matrix_vector_02.cu +++ b/tests/cuda/matrix_free_matrix_vector_02.cu @@ -21,13 +21,9 @@ #include #include "../tests.h" - -std::ofstream logfile("output"); - #include "matrix_vector_common.h" - -template +template void test() { @@ -38,7 +34,7 @@ test() FE_Q fe(fe_degree); DoFHandler dof(tria); dof.distribute_dofs(fe); - AffineConstraints constraints; + AffineConstraints constraints; VectorTools::interpolate_boundary_values(dof, 0, Functions::ZeroFunction(), @@ -47,7 +43,7 @@ test() do_test, + Number, + LinearAlgebra::CUDAWrappers::Vector, fe_degree + 1>(dof, constraints, tria.n_active_cells()); } diff --git a/tests/cuda/matrix_free_matrix_vector_02.output b/tests/cuda/matrix_free_matrix_vector_02.output index 43ef13cd75..bbd6a6cc7a 100644 --- a/tests/cuda/matrix_free_matrix_vector_02.output +++ b/tests/cuda/matrix_free_matrix_vector_02.output @@ -1,19 +1,37 @@ -DEAL:2d::Testing FE_Q<2>(1) -DEAL:2d::Norm of difference: 0 -DEAL:2d:: -DEAL:2d::Testing FE_Q<2>(2) -DEAL:2d::Norm of difference: 0 -DEAL:2d:: -DEAL:2d::Testing FE_Q<2>(3) -DEAL:2d::Norm of difference: 0 -DEAL:2d:: -DEAL:3d::Testing FE_Q<3>(1) -DEAL:3d::Norm of difference: 0 -DEAL:3d:: -DEAL:3d::Testing FE_Q<3>(2) -DEAL:3d::Norm of difference: 0 -DEAL:3d:: -DEAL:3d::Testing FE_Q<3>(3) -DEAL:3d::Norm of difference: 0 -DEAL:3d:: +DEAL:double:2d::Testing FE_Q<2>(1) +DEAL:double:2d::Norm of difference: 1.16e-15 +DEAL:double:2d:: +DEAL:double:2d::Testing FE_Q<2>(2) +DEAL:double:2d::Norm of difference: 2.12e-15 +DEAL:double:2d:: +DEAL:double:2d::Testing FE_Q<2>(3) +DEAL:double:2d::Norm of difference: 1.01e-14 +DEAL:double:2d:: +DEAL:double:3d::Testing FE_Q<3>(1) +DEAL:double:3d::Norm of difference: 1.01e-15 +DEAL:double:3d:: +DEAL:double:3d::Testing FE_Q<3>(2) +DEAL:double:3d::Norm of difference: 2.26e-15 +DEAL:double:3d:: +DEAL:double:3d::Testing FE_Q<3>(3) +DEAL:double:3d::Norm of difference: 1.76e-14 +DEAL:double:3d:: +DEAL:float:2d::Testing FE_Q<2>(1) +DEAL:float:2d::Norm of difference: 1.02e-15 +DEAL:float:2d:: +DEAL:float:2d::Testing FE_Q<2>(2) +DEAL:float:2d::Norm of difference: 1.64e-15 +DEAL:float:2d:: +DEAL:float:2d::Testing FE_Q<2>(3) +DEAL:float:2d::Norm of difference: 8.83e-15 +DEAL:float:2d:: +DEAL:float:3d::Testing FE_Q<3>(1) +DEAL:float:3d::Norm of difference: 4.55e-16 +DEAL:float:3d:: +DEAL:float:3d::Testing FE_Q<3>(2) +DEAL:float:3d::Norm of difference: 2.65e-15 +DEAL:float:3d:: +DEAL:float:3d::Testing FE_Q<3>(3) +DEAL:float:3d::Norm of difference: 1.54e-14 +DEAL:float:3d:: diff --git a/tests/cuda/matrix_free_matrix_vector_03.cu b/tests/cuda/matrix_free_matrix_vector_03.cu index c175a423ad..09a9cc7150 100644 --- a/tests/cuda/matrix_free_matrix_vector_03.cu +++ b/tests/cuda/matrix_free_matrix_vector_03.cu @@ -23,12 +23,9 @@ #include #include "../tests.h" - -std::ofstream logfile("output"); - #include "matrix_vector_common.h" -template +template void test() { @@ -57,7 +54,7 @@ test() FE_Q fe(fe_degree); DoFHandler dof(tria); dof.distribute_dofs(fe); - AffineConstraints constraints; + AffineConstraints constraints; DoFTools::make_hanging_node_constraints(dof, constraints); VectorTools::interpolate_boundary_values(dof, @@ -68,7 +65,7 @@ test() do_test, + Number, + LinearAlgebra::CUDAWrappers::Vector, fe_degree + 1>(dof, constraints, tria.n_active_cells()); } diff --git a/tests/cuda/matrix_free_matrix_vector_03.output b/tests/cuda/matrix_free_matrix_vector_03.output index afa453aed9..0e61608812 100644 --- a/tests/cuda/matrix_free_matrix_vector_03.output +++ b/tests/cuda/matrix_free_matrix_vector_03.output @@ -1,19 +1,37 @@ -DEAL:2d::Testing FE_Q<2>(1) -DEAL:2d::Norm of difference: 0. -DEAL:2d:: -DEAL:2d::Testing FE_Q<2>(2) -DEAL:2d::Norm of difference: 0. -DEAL:2d:: -DEAL:2d::Testing FE_Q<2>(3) -DEAL:2d::Norm of difference: 0. -DEAL:2d:: -DEAL:3d::Testing FE_Q<3>(1) -DEAL:3d::Norm of difference: 0. -DEAL:3d:: -DEAL:3d::Testing FE_Q<3>(2) -DEAL:3d::Norm of difference: 0. -DEAL:3d:: -DEAL:3d::Testing FE_Q<3>(3) -DEAL:3d::Norm of difference: 0. -DEAL:3d:: +DEAL:double:2d::Testing FE_Q<2>(1) +DEAL:double:2d::Norm of difference: 1.86e-15 +DEAL:double:2d:: +DEAL:double:2d::Testing FE_Q<2>(2) +DEAL:double:2d::Norm of difference: 4.71e-15 +DEAL:double:2d:: +DEAL:double:2d::Testing FE_Q<2>(3) +DEAL:double:2d::Norm of difference: 2.01e-14 +DEAL:double:2d:: +DEAL:double:3d::Testing FE_Q<3>(1) +DEAL:double:3d::Norm of difference: 1.51e-15 +DEAL:double:3d:: +DEAL:double:3d::Testing FE_Q<3>(2) +DEAL:double:3d::Norm of difference: 2.65e-15 +DEAL:double:3d:: +DEAL:double:3d::Testing FE_Q<3>(3) +DEAL:double:3d::Norm of difference: 1.74e-14 +DEAL:double:3d:: +DEAL:float:2d::Testing FE_Q<2>(1) +DEAL:float:2d::Norm of difference: 1.78e-15 +DEAL:float:2d:: +DEAL:float:2d::Testing FE_Q<2>(2) +DEAL:float:2d::Norm of difference: 3.77e-15 +DEAL:float:2d:: +DEAL:float:2d::Testing FE_Q<2>(3) +DEAL:float:2d::Norm of difference: 1.88e-14 +DEAL:float:2d:: +DEAL:float:3d::Testing FE_Q<3>(1) +DEAL:float:3d::Norm of difference: 9.36e-16 +DEAL:float:3d:: +DEAL:float:3d::Testing FE_Q<3>(2) +DEAL:float:3d::Norm of difference: 2.59e-15 +DEAL:float:3d:: +DEAL:float:3d::Testing FE_Q<3>(3) +DEAL:float:3d::Norm of difference: 1.87e-14 +DEAL:float:3d:: diff --git a/tests/cuda/matrix_free_matrix_vector_03b.cu b/tests/cuda/matrix_free_matrix_vector_03b.cu index f386db0bb6..ab8d0fd644 100644 --- a/tests/cuda/matrix_free_matrix_vector_03b.cu +++ b/tests/cuda/matrix_free_matrix_vector_03b.cu @@ -24,12 +24,9 @@ #include #include "../tests.h" - -std::ofstream logfile("output"); - #include "matrix_vector_common.h" -template +template void test() { @@ -58,7 +55,7 @@ test() FE_Q fe(fe_degree); DoFHandler dof(tria); dof.distribute_dofs(fe); - AffineConstraints constraints; + AffineConstraints constraints; DoFTools::make_hanging_node_constraints(dof, constraints); VectorTools::interpolate_boundary_values(dof, @@ -69,7 +66,7 @@ test() do_test, + Number, + LinearAlgebra::CUDAWrappers::Vector, fe_degree + 1>(dof, constraints, tria.n_active_cells(), true, true); } diff --git a/tests/cuda/matrix_free_matrix_vector_03b.output b/tests/cuda/matrix_free_matrix_vector_03b.output index afa453aed9..30022064b3 100644 --- a/tests/cuda/matrix_free_matrix_vector_03b.output +++ b/tests/cuda/matrix_free_matrix_vector_03b.output @@ -1,19 +1,37 @@ -DEAL:2d::Testing FE_Q<2>(1) -DEAL:2d::Norm of difference: 0. -DEAL:2d:: -DEAL:2d::Testing FE_Q<2>(2) -DEAL:2d::Norm of difference: 0. -DEAL:2d:: -DEAL:2d::Testing FE_Q<2>(3) -DEAL:2d::Norm of difference: 0. -DEAL:2d:: -DEAL:3d::Testing FE_Q<3>(1) -DEAL:3d::Norm of difference: 0. -DEAL:3d:: -DEAL:3d::Testing FE_Q<3>(2) -DEAL:3d::Norm of difference: 0. -DEAL:3d:: -DEAL:3d::Testing FE_Q<3>(3) -DEAL:3d::Norm of difference: 0. -DEAL:3d:: +DEAL:double:2d::Testing FE_Q<2>(1) +DEAL:double:2d::Norm of difference: 6.11e-15 +DEAL:double:2d:: +DEAL:double:2d::Testing FE_Q<2>(2) +DEAL:double:2d::Norm of difference: 4.71e-15 +DEAL:double:2d:: +DEAL:double:2d::Testing FE_Q<2>(3) +DEAL:double:2d::Norm of difference: 2.02e-14 +DEAL:double:2d:: +DEAL:double:3d::Testing FE_Q<3>(1) +DEAL:double:3d::Norm of difference: 1.54e-15 +DEAL:double:3d:: +DEAL:double:3d::Testing FE_Q<3>(2) +DEAL:double:3d::Norm of difference: 2.64e-15 +DEAL:double:3d:: +DEAL:double:3d::Testing FE_Q<3>(3) +DEAL:double:3d::Norm of difference: 1.74e-14 +DEAL:double:3d:: +DEAL:float:2d::Testing FE_Q<2>(1) +DEAL:float:2d::Norm of difference: 5.83e-15 +DEAL:float:2d:: +DEAL:float:2d::Testing FE_Q<2>(2) +DEAL:float:2d::Norm of difference: 3.76e-15 +DEAL:float:2d:: +DEAL:float:2d::Testing FE_Q<2>(3) +DEAL:float:2d::Norm of difference: 1.88e-14 +DEAL:float:2d:: +DEAL:float:3d::Testing FE_Q<3>(1) +DEAL:float:3d::Norm of difference: 1.10e-15 +DEAL:float:3d:: +DEAL:float:3d::Testing FE_Q<3>(2) +DEAL:float:3d::Norm of difference: 2.61e-15 +DEAL:float:3d:: +DEAL:float:3d::Testing FE_Q<3>(3) +DEAL:float:3d::Norm of difference: 1.87e-14 +DEAL:float:3d:: diff --git a/tests/cuda/matrix_free_matrix_vector_04.cu b/tests/cuda/matrix_free_matrix_vector_04.cu index c4c1085670..b56afcb732 100644 --- a/tests/cuda/matrix_free_matrix_vector_04.cu +++ b/tests/cuda/matrix_free_matrix_vector_04.cu @@ -20,13 +20,10 @@ // type: 2) #include "../tests.h" - -std::ofstream logfile("output"); - #include "matrix_vector_common.h" -template +template void test() { @@ -41,12 +38,12 @@ test() FE_Q fe(fe_degree); DoFHandler dof(tria); dof.distribute_dofs(fe); - AffineConstraints constraints; + AffineConstraints constraints; constraints.close(); do_test, + Number, + LinearAlgebra::CUDAWrappers::Vector, fe_degree + 1>(dof, constraints, tria.n_active_cells()); } diff --git a/tests/cuda/matrix_free_matrix_vector_04.output b/tests/cuda/matrix_free_matrix_vector_04.output index 43ef13cd75..5a75226da3 100644 --- a/tests/cuda/matrix_free_matrix_vector_04.output +++ b/tests/cuda/matrix_free_matrix_vector_04.output @@ -1,19 +1,37 @@ -DEAL:2d::Testing FE_Q<2>(1) -DEAL:2d::Norm of difference: 0 -DEAL:2d:: -DEAL:2d::Testing FE_Q<2>(2) -DEAL:2d::Norm of difference: 0 -DEAL:2d:: -DEAL:2d::Testing FE_Q<2>(3) -DEAL:2d::Norm of difference: 0 -DEAL:2d:: -DEAL:3d::Testing FE_Q<3>(1) -DEAL:3d::Norm of difference: 0 -DEAL:3d:: -DEAL:3d::Testing FE_Q<3>(2) -DEAL:3d::Norm of difference: 0 -DEAL:3d:: -DEAL:3d::Testing FE_Q<3>(3) -DEAL:3d::Norm of difference: 0 -DEAL:3d:: +DEAL:double:2d::Testing FE_Q<2>(1) +DEAL:double:2d::Norm of difference: 4.74e-15 +DEAL:double:2d:: +DEAL:double:2d::Testing FE_Q<2>(2) +DEAL:double:2d::Norm of difference: 8.33e-15 +DEAL:double:2d:: +DEAL:double:2d::Testing FE_Q<2>(3) +DEAL:double:2d::Norm of difference: 3.49e-14 +DEAL:double:2d:: +DEAL:double:3d::Testing FE_Q<3>(1) +DEAL:double:3d::Norm of difference: 1.78e-15 +DEAL:double:3d:: +DEAL:double:3d::Testing FE_Q<3>(2) +DEAL:double:3d::Norm of difference: 4.72e-15 +DEAL:double:3d:: +DEAL:double:3d::Testing FE_Q<3>(3) +DEAL:double:3d::Norm of difference: 2.10e-14 +DEAL:double:3d:: +DEAL:float:2d::Testing FE_Q<2>(1) +DEAL:float:2d::Norm of difference: 4.74e-15 +DEAL:float:2d:: +DEAL:float:2d::Testing FE_Q<2>(2) +DEAL:float:2d::Norm of difference: 8.87e-15 +DEAL:float:2d:: +DEAL:float:2d::Testing FE_Q<2>(3) +DEAL:float:2d::Norm of difference: 3.24e-14 +DEAL:float:2d:: +DEAL:float:3d::Testing FE_Q<3>(1) +DEAL:float:3d::Norm of difference: 1.94e-15 +DEAL:float:3d:: +DEAL:float:3d::Testing FE_Q<3>(2) +DEAL:float:3d::Norm of difference: 3.55e-15 +DEAL:float:3d:: +DEAL:float:3d::Testing FE_Q<3>(3) +DEAL:float:3d::Norm of difference: 2.32e-14 +DEAL:float:3d:: diff --git a/tests/cuda/matrix_free_matrix_vector_05.cu b/tests/cuda/matrix_free_matrix_vector_05.cu index 4226aec558..119ed67d7b 100644 --- a/tests/cuda/matrix_free_matrix_vector_05.cu +++ b/tests/cuda/matrix_free_matrix_vector_05.cu @@ -21,13 +21,10 @@ // type: 1 = linear). #include "../tests.h" - -std::ofstream logfile("output"); - #include "matrix_vector_common.h" -template +template void test() { @@ -72,13 +69,13 @@ test() FE_Q fe(fe_degree); DoFHandler dof(tria); dof.distribute_dofs(fe); - AffineConstraints constraints; + AffineConstraints constraints; DoFTools::make_hanging_node_constraints(dof, constraints); constraints.close(); do_test, + Number, + LinearAlgebra::CUDAWrappers::Vector, fe_degree + 1>(dof, constraints, tria.n_active_cells()); } diff --git a/tests/cuda/matrix_free_matrix_vector_05.output b/tests/cuda/matrix_free_matrix_vector_05.output index 43ef13cd75..c3d51aad15 100644 --- a/tests/cuda/matrix_free_matrix_vector_05.output +++ b/tests/cuda/matrix_free_matrix_vector_05.output @@ -1,19 +1,37 @@ -DEAL:2d::Testing FE_Q<2>(1) -DEAL:2d::Norm of difference: 0 -DEAL:2d:: -DEAL:2d::Testing FE_Q<2>(2) -DEAL:2d::Norm of difference: 0 -DEAL:2d:: -DEAL:2d::Testing FE_Q<2>(3) -DEAL:2d::Norm of difference: 0 -DEAL:2d:: -DEAL:3d::Testing FE_Q<3>(1) -DEAL:3d::Norm of difference: 0 -DEAL:3d:: -DEAL:3d::Testing FE_Q<3>(2) -DEAL:3d::Norm of difference: 0 -DEAL:3d:: -DEAL:3d::Testing FE_Q<3>(3) -DEAL:3d::Norm of difference: 0 -DEAL:3d:: +DEAL:double:2d::Testing FE_Q<2>(1) +DEAL:double:2d::Norm of difference: 4.24e-15 +DEAL:double:2d:: +DEAL:double:2d::Testing FE_Q<2>(2) +DEAL:double:2d::Norm of difference: 2.98e-15 +DEAL:double:2d:: +DEAL:double:2d::Testing FE_Q<2>(3) +DEAL:double:2d::Norm of difference: 8.07e-15 +DEAL:double:2d:: +DEAL:double:3d::Testing FE_Q<3>(1) +DEAL:double:3d::Norm of difference: 6.42e-15 +DEAL:double:3d:: +DEAL:double:3d::Testing FE_Q<3>(2) +DEAL:double:3d::Norm of difference: 4.84e-15 +DEAL:double:3d:: +DEAL:double:3d::Testing FE_Q<3>(3) +DEAL:double:3d::Norm of difference: 1.04e-14 +DEAL:double:3d:: +DEAL:float:2d::Testing FE_Q<2>(1) +DEAL:float:2d::Norm of difference: 3.53e-15 +DEAL:float:2d:: +DEAL:float:2d::Testing FE_Q<2>(2) +DEAL:float:2d::Norm of difference: 3.08e-15 +DEAL:float:2d:: +DEAL:float:2d::Testing FE_Q<2>(3) +DEAL:float:2d::Norm of difference: 7.39e-15 +DEAL:float:2d:: +DEAL:float:3d::Testing FE_Q<3>(1) +DEAL:float:3d::Norm of difference: 8.25e-15 +DEAL:float:3d:: +DEAL:float:3d::Testing FE_Q<3>(2) +DEAL:float:3d::Norm of difference: 5.28e-15 +DEAL:float:3d:: +DEAL:float:3d::Testing FE_Q<3>(3) +DEAL:float:3d::Norm of difference: 9.10e-15 +DEAL:float:3d:: diff --git a/tests/cuda/matrix_free_matrix_vector_06.cu b/tests/cuda/matrix_free_matrix_vector_06.cu index 704255a86e..54f94cb488 100644 --- a/tests/cuda/matrix_free_matrix_vector_06.cu +++ b/tests/cuda/matrix_free_matrix_vector_06.cu @@ -25,12 +25,9 @@ #include "../tests.h" #include "create_mesh.h" - -std::ofstream logfile("output"); - #include "matrix_vector_common.h" -template +template void test() { @@ -66,7 +63,7 @@ test() FE_Q fe(fe_degree); DoFHandler dof(tria); dof.distribute_dofs(fe); - AffineConstraints constraints; + AffineConstraints constraints; DoFTools::make_hanging_node_constraints(dof, constraints); VectorTools::interpolate_boundary_values(dof, 0, @@ -76,7 +73,7 @@ test() do_test, + Number, + LinearAlgebra::CUDAWrappers::Vector, fe_degree + 1>(dof, constraints, tria.n_active_cells()); } diff --git a/tests/cuda/matrix_free_matrix_vector_06.output b/tests/cuda/matrix_free_matrix_vector_06.output index e9e176a4c1..2eb9b9d368 100644 --- a/tests/cuda/matrix_free_matrix_vector_06.output +++ b/tests/cuda/matrix_free_matrix_vector_06.output @@ -1,7 +1,13 @@ -DEAL:2d::Testing FE_Q<2>(1) -DEAL:2d::Norm of difference: 0 -DEAL:2d:: -DEAL:3d::Testing FE_Q<3>(1) -DEAL:3d::Norm of difference: 0 -DEAL:3d:: +DEAL:double:2d::Testing FE_Q<2>(1) +DEAL:double:2d::Norm of difference: 3.00e-15 +DEAL:double:2d:: +DEAL:double:3d::Testing FE_Q<3>(1) +DEAL:double:3d::Norm of difference: 6.24e-16 +DEAL:double:3d:: +DEAL:float:2d::Testing FE_Q<2>(1) +DEAL:float:2d::Norm of difference: 3.17e-15 +DEAL:float:2d:: +DEAL:float:3d::Testing FE_Q<3>(1) +DEAL:float:3d::Norm of difference: 6.94e-16 +DEAL:float:3d:: diff --git a/tests/cuda/matrix_free_matrix_vector_06a.cu b/tests/cuda/matrix_free_matrix_vector_06a.cu index 7aa0b084fd..9f97896609 100644 --- a/tests/cuda/matrix_free_matrix_vector_06a.cu +++ b/tests/cuda/matrix_free_matrix_vector_06a.cu @@ -21,12 +21,9 @@ #include "../tests.h" #include "create_mesh.h" - -std::ofstream logfile("output"); - #include "matrix_vector_common.h" -template +template void test() { @@ -62,7 +59,7 @@ test() FE_Q fe(fe_degree); DoFHandler dof(tria); dof.distribute_dofs(fe); - AffineConstraints constraints; + AffineConstraints constraints; DoFTools::make_hanging_node_constraints(dof, constraints); VectorTools::interpolate_boundary_values(dof, 0, @@ -72,7 +69,7 @@ test() do_test, + Number, + LinearAlgebra::distributed::Vector, fe_degree + 1>(dof, constraints, tria.n_active_cells()); } diff --git a/tests/cuda/matrix_free_matrix_vector_06a.output b/tests/cuda/matrix_free_matrix_vector_06a.output index e9e176a4c1..e97ca667b1 100644 --- a/tests/cuda/matrix_free_matrix_vector_06a.output +++ b/tests/cuda/matrix_free_matrix_vector_06a.output @@ -1,7 +1,13 @@ -DEAL:2d::Testing FE_Q<2>(1) -DEAL:2d::Norm of difference: 0 -DEAL:2d:: -DEAL:3d::Testing FE_Q<3>(1) -DEAL:3d::Norm of difference: 0 -DEAL:3d:: +DEAL:double:2d::Testing FE_Q<2>(1) +DEAL:double:2d::Norm of difference: 2.98e-15 +DEAL:double:2d:: +DEAL:double:3d::Testing FE_Q<3>(1) +DEAL:double:3d::Norm of difference: 6.11e-16 +DEAL:double:3d:: +DEAL:float:2d::Testing FE_Q<2>(1) +DEAL:float:2d::Norm of difference: 3.16e-15 +DEAL:float:2d:: +DEAL:float:3d::Testing FE_Q<3>(1) +DEAL:float:3d::Norm of difference: 6.99e-16 +DEAL:float:3d:: diff --git a/tests/cuda/matrix_free_matrix_vector_06b.cu b/tests/cuda/matrix_free_matrix_vector_06b.cu index 30a8465be4..1c5124a6b8 100644 --- a/tests/cuda/matrix_free_matrix_vector_06b.cu +++ b/tests/cuda/matrix_free_matrix_vector_06b.cu @@ -20,12 +20,9 @@ #include "../tests.h" #include "create_mesh.h" - -std::ofstream logfile("output"); - #include "matrix_vector_common.h" -template +template void test() { @@ -61,7 +58,7 @@ test() FE_Q fe(fe_degree); DoFHandler dof(tria); dof.distribute_dofs(fe); - AffineConstraints constraints; + AffineConstraints constraints; DoFTools::make_hanging_node_constraints(dof, constraints); VectorTools::interpolate_boundary_values(dof, 0, @@ -71,7 +68,7 @@ test() do_test, + Number, + LinearAlgebra::distributed::Vector, fe_degree + 1>(dof, constraints, tria.n_active_cells(), false); } diff --git a/tests/cuda/matrix_free_matrix_vector_06b.output b/tests/cuda/matrix_free_matrix_vector_06b.output index e9e176a4c1..c9943d2628 100644 --- a/tests/cuda/matrix_free_matrix_vector_06b.output +++ b/tests/cuda/matrix_free_matrix_vector_06b.output @@ -1,7 +1,13 @@ -DEAL:2d::Testing FE_Q<2>(1) -DEAL:2d::Norm of difference: 0 -DEAL:2d:: -DEAL:3d::Testing FE_Q<3>(1) -DEAL:3d::Norm of difference: 0 -DEAL:3d:: +DEAL:double:2d::Testing FE_Q<2>(1) +DEAL:double:2d::Norm of difference: 3.24e-15 +DEAL:double:2d:: +DEAL:double:3d::Testing FE_Q<3>(1) +DEAL:double:3d::Norm of difference: 8.86e-16 +DEAL:double:3d:: +DEAL:float:2d::Testing FE_Q<2>(1) +DEAL:float:2d::Norm of difference: 3.44e-15 +DEAL:float:2d:: +DEAL:float:3d::Testing FE_Q<3>(1) +DEAL:float:3d::Norm of difference: 7.30e-16 +DEAL:float:3d:: diff --git a/tests/cuda/matrix_free_matrix_vector_09.cu b/tests/cuda/matrix_free_matrix_vector_09.cu index 24f36ed4f3..10252fac16 100644 --- a/tests/cuda/matrix_free_matrix_vector_09.cu +++ b/tests/cuda/matrix_free_matrix_vector_09.cu @@ -23,12 +23,9 @@ #include "../tests.h" #include "create_mesh.h" - -std::ofstream logfile("output"); - #include "matrix_vector_common.h" -template +template void test() { @@ -64,7 +61,7 @@ test() FE_Q fe(fe_degree); DoFHandler dof(tria); dof.distribute_dofs(fe); - AffineConstraints constraints; + AffineConstraints constraints; DoFTools::make_hanging_node_constraints(dof, constraints); VectorTools::interpolate_boundary_values(dof, 0, @@ -74,7 +71,7 @@ test() do_test, + Number, + LinearAlgebra::CUDAWrappers::Vector, fe_degree + 1>(dof, constraints, tria.n_active_cells()); } diff --git a/tests/cuda/matrix_free_matrix_vector_09.output b/tests/cuda/matrix_free_matrix_vector_09.output index e9e176a4c1..c202017a2f 100644 --- a/tests/cuda/matrix_free_matrix_vector_09.output +++ b/tests/cuda/matrix_free_matrix_vector_09.output @@ -1,7 +1,13 @@ -DEAL:2d::Testing FE_Q<2>(1) -DEAL:2d::Norm of difference: 0 -DEAL:2d:: -DEAL:3d::Testing FE_Q<3>(1) -DEAL:3d::Norm of difference: 0 -DEAL:3d:: +DEAL:double:2d::Testing FE_Q<2>(1) +DEAL:double:2d::Norm of difference: 2.03e-15 +DEAL:double:2d:: +DEAL:double:3d::Testing FE_Q<3>(1) +DEAL:double:3d::Norm of difference: 4.13e-16 +DEAL:double:3d:: +DEAL:float:2d::Testing FE_Q<2>(1) +DEAL:float:2d::Norm of difference: 1.64e-15 +DEAL:float:2d:: +DEAL:float:3d::Testing FE_Q<3>(1) +DEAL:float:3d::Norm of difference: 3.36e-16 +DEAL:float:3d:: diff --git a/tests/cuda/matrix_vector_common.h b/tests/cuda/matrix_vector_common.h index 317aee39b7..2559351603 100644 --- a/tests/cuda/matrix_vector_common.h +++ b/tests/cuda/matrix_vector_common.h @@ -49,7 +49,7 @@ // forward declare this function. will be implemented in .cu files -template +template void test(); @@ -76,7 +76,7 @@ template void do_test(const DoFHandler & dof, - const AffineConstraints &constraints, + const AffineConstraints &constraints, const unsigned int n_locally_owned_cells, const bool constant_coefficient = true, const bool coloring = false) @@ -188,7 +188,7 @@ do_test(const DoFHandler & dof, int main() { - deallog.attach(logfile); + initlog(); deallog.depth_console(0); deallog << std::setprecision(3); @@ -196,15 +196,29 @@ main() init_cuda(); { + deallog.push("double"); deallog.push("2d"); - test<2, 1>(); - test<2, 2>(); - test<2, 3>(); + test<2, 1, double>(); + test<2, 2, double>(); + test<2, 3, double>(); deallog.pop(); deallog.push("3d"); - test<3, 1>(); - test<3, 2>(); - test<3, 3>(); + test<3, 1, double>(); + test<3, 2, double>(); + test<3, 3, double>(); + deallog.pop(); + deallog.pop(); + deallog.push("float"); + deallog.push("2d"); + test<2, 1, double>(); + test<2, 2, double>(); + test<2, 3, double>(); + deallog.pop(); + deallog.push("3d"); + test<3, 1, double>(); + test<3, 2, double>(); + test<3, 3, double>(); + deallog.pop(); deallog.pop(); } -- 2.39.5