structure.compress();
A.reinit(structure);
testproblem.five_point(A);
- A.print(std::cout);
// Solve on the device
CUDAWrappers::SparseMatrix<Number> A_dev(cuda_handle, A);
for (unsigned int i = 0; i < size; ++i)
rw_vector[i] = static_cast<Number>(i);
rhs_dev.import(rw_vector, VectorOperation::insert);
- SolverControl control(100, 1.e-10);
+ const Number tolerance = 1000. * std::numeric_limits<Number>::epsilon();
+ SolverControl control(100, tolerance);
SolverCG<LinearAlgebra::CUDAWrappers::Vector<Number>> cg_dev(control);
CUDAWrappers::PreconditionIC<Number> prec_ic(cuda_handle);
cg_dev.solve(A_dev, sol_dev, rhs_dev, prec_ic);
// Check the result
- rw_vector.import(sol_dev, VectorOperation::insert);
- for (unsigned int i = 0; i < size; ++i)
- deallog << rw_vector[i] << std::endl;
+ LinearAlgebra::CUDAWrappers::Vector<Number> residual(size);
+ A_dev.residual(residual, sol_dev, rhs_dev);
+ Assert(residual.l2_norm() < 20 * tolerance, ExcInternalError());
+ deallog << "OK" << std::endl;
}
int
main()
{
initlog();
+ deallog << std::setprecision(10);
deallog.depth_console(0);
Utilities::CUDA::Handle cuda_handle;
+ deallog << "Testing float" << std::endl;
test<float>(cuda_handle);
+ deallog << "Testing double" << std::endl;
test<double>(cuda_handle);
deallog << "OK" << std::endl;
-DEAL:cg::Starting value 416.989
-DEAL:cg::Convergence step 19 value 1.41136e-11
-DEAL::20.9607
-DEAL::38.8073
-DEAL::52.3525
-DEAL::61.2758
-DEAL::65.4369
-DEAL::64.6135
-DEAL::58.3945
-DEAL::46.1455
-DEAL::27.0190
-DEAL::45.0353
-DEAL::80.9161
-DEAL::107.327
-DEAL::124.314
-DEAL::131.858
-DEAL::129.623
-DEAL::116.819
-DEAL::92.1685
-DEAL::53.9305
-DEAL::69.2645
-DEAL::122.495
-DEAL::160.725
-DEAL::184.794
-DEAL::195.060
-DEAL::191.200
-DEAL::172.090
-DEAL::135.779
-DEAL::79.5345
-DEAL::91.5276
-DEAL::160.074
-DEAL::208.285
-DEAL::238.076
-DEAL::250.389
-DEAL::245.025
-DEAL::220.563
-DEAL::174.324
-DEAL::102.428
-DEAL::109.771
-DEAL::189.991
-DEAL::245.262
-DEAL::278.838
-DEAL::292.394
-DEAL::285.950
-DEAL::257.813
-DEAL::204.524
-DEAL::120.855
-DEAL::121.567
-DEAL::207.855
-DEAL::265.937
-DEAL::300.618
-DEAL::314.399
-DEAL::307.567
-DEAL::278.215
-DEAL::222.104
-DEAL::132.468
-DEAL::123.643
-DEAL::207.924
-DEAL::263.011
-DEAL::295.300
-DEAL::308.015
-DEAL::301.706
-DEAL::274.376
-DEAL::221.208
-DEAL::133.913
-DEAL::111.079
-DEAL::182.188
-DEAL::226.884
-DEAL::252.556
-DEAL::262.656
-DEAL::257.865
-DEAL::236.376
-DEAL::193.440
-DEAL::119.974
-DEAL::75.4858
-DEAL::118.864
-DEAL::144.783
-DEAL::159.382
-DEAL::165.189
-DEAL::162.720
-DEAL::150.825
-DEAL::126.202
-DEAL::81.5441
-DEAL:cg::Starting value 416.989
-DEAL:cg::Convergence step 17 value 5.54040e-11
-DEAL::20.9607
-DEAL::38.8073
-DEAL::52.3525
-DEAL::61.2757
-DEAL::65.4369
-DEAL::64.6135
-DEAL::58.3945
-DEAL::46.1455
-DEAL::27.0190
-DEAL::45.0353
-DEAL::80.9161
-DEAL::107.327
-DEAL::124.314
-DEAL::131.858
-DEAL::129.623
-DEAL::116.819
-DEAL::92.1685
-DEAL::53.9305
-DEAL::69.2645
-DEAL::122.495
-DEAL::160.725
-DEAL::184.794
-DEAL::195.060
-DEAL::191.200
-DEAL::172.090
-DEAL::135.779
-DEAL::79.5345
-DEAL::91.5276
-DEAL::160.074
-DEAL::208.285
-DEAL::238.076
-DEAL::250.389
-DEAL::245.025
-DEAL::220.563
-DEAL::174.324
-DEAL::102.428
-DEAL::109.771
-DEAL::189.991
-DEAL::245.262
-DEAL::278.838
-DEAL::292.394
-DEAL::285.950
-DEAL::257.813
-DEAL::204.524
-DEAL::120.855
-DEAL::121.567
-DEAL::207.855
-DEAL::265.937
-DEAL::300.618
-DEAL::314.399
-DEAL::307.567
-DEAL::278.215
-DEAL::222.104
-DEAL::132.468
-DEAL::123.643
-DEAL::207.924
-DEAL::263.011
-DEAL::295.300
-DEAL::308.015
-DEAL::301.706
-DEAL::274.376
-DEAL::221.208
-DEAL::133.913
-DEAL::111.079
-DEAL::182.188
-DEAL::226.884
-DEAL::252.556
-DEAL::262.656
-DEAL::257.865
-DEAL::236.376
-DEAL::193.440
-DEAL::119.974
-DEAL::75.4858
-DEAL::118.864
-DEAL::144.783
-DEAL::159.382
-DEAL::165.189
-DEAL::162.720
-DEAL::150.825
-DEAL::126.202
-DEAL::81.5441
+DEAL::Testing float
+DEAL:cg::Starting value 416.9891968
+DEAL:cg::Convergence step 11 value 3.993874634e-05
+DEAL::OK
+DEAL::Testing double
+DEAL:cg::Starting value 416.9892085
+DEAL:cg::Convergence step 20 value 9.834412497e-14
+DEAL::OK
DEAL::OK
structure.compress();
A.reinit(structure);
testproblem.five_point(A);
- A.print(std::cout);
// Solve on the device
CUDAWrappers::SparseMatrix<Number> A_dev(cuda_handle, A);
for (unsigned int i = 0; i < size; ++i)
rw_vector[i] = static_cast<Number>(i);
rhs_dev.import(rw_vector, VectorOperation::insert);
- SolverControl control(100, 1.e-10);
+ const Number tolerance = 1000. * std::numeric_limits<Number>::epsilon();
+ SolverControl control(100, tolerance);
SolverCG<LinearAlgebra::CUDAWrappers::Vector<Number>> cg_dev(control);
CUDAWrappers::PreconditionILU<Number> prec_ilu(cuda_handle);
cg_dev.solve(A_dev, sol_dev, rhs_dev, prec_ilu);
// Check the result
- rw_vector.import(sol_dev, VectorOperation::insert);
- for (unsigned int i = 0; i < size; ++i)
- deallog << rw_vector[i] << std::endl;
+ LinearAlgebra::CUDAWrappers::Vector<Number> residual(size);
+ A_dev.residual(residual, sol_dev, rhs_dev);
+ Assert(residual.l2_norm() < 20 * tolerance, ExcInternalError());
+ deallog << "OK" << std::endl;
}
int
main()
{
initlog();
+ deallog << std::setprecision(10);
deallog.depth_console(0);
Utilities::CUDA::Handle cuda_handle;
+ deallog << "Testing float" << std::endl;
test<float>(cuda_handle);
+ deallog << "Testing double" << std::endl;
test<double>(cuda_handle);
deallog << "OK" << std::endl;
-DEAL:cg::Starting value 416.989
-DEAL:cg::Convergence step 19 value 1.40142e-11
-DEAL::20.9607
-DEAL::38.8073
-DEAL::52.3525
-DEAL::61.2758
-DEAL::65.4369
-DEAL::64.6135
-DEAL::58.3945
-DEAL::46.1455
-DEAL::27.0190
-DEAL::45.0353
-DEAL::80.9161
-DEAL::107.327
-DEAL::124.314
-DEAL::131.858
-DEAL::129.623
-DEAL::116.819
-DEAL::92.1685
-DEAL::53.9305
-DEAL::69.2645
-DEAL::122.495
-DEAL::160.725
-DEAL::184.794
-DEAL::195.060
-DEAL::191.200
-DEAL::172.090
-DEAL::135.779
-DEAL::79.5345
-DEAL::91.5276
-DEAL::160.074
-DEAL::208.285
-DEAL::238.076
-DEAL::250.389
-DEAL::245.025
-DEAL::220.563
-DEAL::174.324
-DEAL::102.428
-DEAL::109.771
-DEAL::189.991
-DEAL::245.262
-DEAL::278.838
-DEAL::292.394
-DEAL::285.950
-DEAL::257.813
-DEAL::204.524
-DEAL::120.855
-DEAL::121.567
-DEAL::207.855
-DEAL::265.937
-DEAL::300.618
-DEAL::314.399
-DEAL::307.567
-DEAL::278.215
-DEAL::222.104
-DEAL::132.468
-DEAL::123.643
-DEAL::207.924
-DEAL::263.011
-DEAL::295.300
-DEAL::308.015
-DEAL::301.706
-DEAL::274.376
-DEAL::221.208
-DEAL::133.913
-DEAL::111.079
-DEAL::182.188
-DEAL::226.884
-DEAL::252.556
-DEAL::262.656
-DEAL::257.865
-DEAL::236.376
-DEAL::193.440
-DEAL::119.974
-DEAL::75.4858
-DEAL::118.864
-DEAL::144.783
-DEAL::159.382
-DEAL::165.189
-DEAL::162.720
-DEAL::150.825
-DEAL::126.202
-DEAL::81.5441
-DEAL:cg::Starting value 416.989
-DEAL:cg::Convergence step 17 value 5.54040e-11
-DEAL::20.9607
-DEAL::38.8073
-DEAL::52.3525
-DEAL::61.2757
-DEAL::65.4369
-DEAL::64.6135
-DEAL::58.3945
-DEAL::46.1455
-DEAL::27.0190
-DEAL::45.0353
-DEAL::80.9161
-DEAL::107.327
-DEAL::124.314
-DEAL::131.858
-DEAL::129.623
-DEAL::116.819
-DEAL::92.1685
-DEAL::53.9305
-DEAL::69.2645
-DEAL::122.495
-DEAL::160.725
-DEAL::184.794
-DEAL::195.060
-DEAL::191.200
-DEAL::172.090
-DEAL::135.779
-DEAL::79.5345
-DEAL::91.5276
-DEAL::160.074
-DEAL::208.285
-DEAL::238.076
-DEAL::250.389
-DEAL::245.025
-DEAL::220.563
-DEAL::174.324
-DEAL::102.428
-DEAL::109.771
-DEAL::189.991
-DEAL::245.262
-DEAL::278.838
-DEAL::292.394
-DEAL::285.950
-DEAL::257.813
-DEAL::204.524
-DEAL::120.855
-DEAL::121.567
-DEAL::207.855
-DEAL::265.937
-DEAL::300.618
-DEAL::314.399
-DEAL::307.567
-DEAL::278.215
-DEAL::222.104
-DEAL::132.468
-DEAL::123.643
-DEAL::207.924
-DEAL::263.011
-DEAL::295.300
-DEAL::308.015
-DEAL::301.706
-DEAL::274.376
-DEAL::221.208
-DEAL::133.913
-DEAL::111.079
-DEAL::182.188
-DEAL::226.884
-DEAL::252.556
-DEAL::262.656
-DEAL::257.865
-DEAL::236.376
-DEAL::193.440
-DEAL::119.974
-DEAL::75.4858
-DEAL::118.864
-DEAL::144.783
-DEAL::159.382
-DEAL::165.189
-DEAL::162.720
-DEAL::150.825
-DEAL::126.202
-DEAL::81.5441
+DEAL::Testing float
+DEAL:cg::Starting value 416.9891968
+DEAL:cg::Convergence step 11 value 3.993944847e-05
+DEAL::OK
+DEAL::Testing double
+DEAL:cg::Starting value 416.9892085
+DEAL:cg::Convergence step 20 value 9.834484941e-14
+DEAL::OK
DEAL::OK