From 7137a3b085a8e7f58064f3ac2ae772093c5ba98b Mon Sep 17 00:00:00 2001 From: Yaroslav <beorn.90@gmail.com> Date: Sat, 18 Jun 2016 02:32:45 +0200 Subject: [PATCH] Finishing performance tests --- src/Vector/vector_dist.hpp | 35 ---------------------------- src/Vector/vector_dist_unit_test.hpp | 34 +++++++++++---------------- 2 files changed, 13 insertions(+), 56 deletions(-) diff --git a/src/Vector/vector_dist.hpp b/src/Vector/vector_dist.hpp index c6a3e67d6..fc29b346a 100644 --- a/src/Vector/vector_dist.hpp +++ b/src/Vector/vector_dist.hpp @@ -1110,37 +1110,6 @@ public: } } - /*template<typename CellL> void celllist_initialize(CellL & cell_list, St r_cut, const Ghost<dim, St> & enlarge) - { - // calculate the parameters of the cell list - - // get the processor bounding box - Box<dim, St> pbox = dec.getProcessorBounds(); - // extend by the ghost - pbox.enlarge(enlarge); - - size_t div[dim]; - - // Calculate the division array and the cell box - for (size_t i = 0; i < dim; i++) - { - div[i] = static_cast<size_t>((pbox.getP2().get(i) - pbox.getP1().get(i)) / r_cut); - div[i]++; - pbox.setHigh(i,pbox.getLow(i) + div[i]*r_cut); - } - - if(is_Hilbert<CellL>::type::value == true) - { - std::cout << "Case 1: " << demangle(typeid(CellL).name()) << std::endl; - cell_list.Initialize(pbox, div, g_m); - } - else - { - std::cout << "Case 2: " << demangle(typeid(CellL).name()) << std::endl; - cell_list.Initialize(pbox, div); - } - }*/ - /*! \brief Construct a cell list starting from the stored particles * * It differ from the get getCellList for an additional parameter, in case the @@ -1168,10 +1137,6 @@ public: updateCellList(cell_list); - std::cout << "V_pos size: " << v_pos.size() << ", V_prp size: " << v_prp.size() << std::endl; - - //std::cout << "Number of padding cells: " << cell_list.getPadding(0)*cell_list.getPadding(1) << /*", Tot_n_cell: " << cell_list.return_n_cell() <<*/ std::endl; - return cell_list; } diff --git a/src/Vector/vector_dist_unit_test.hpp b/src/Vector/vector_dist_unit_test.hpp index 074af1ae2..14b4ba812 100644 --- a/src/Vector/vector_dist_unit_test.hpp +++ b/src/Vector/vector_dist_unit_test.hpp @@ -1256,7 +1256,7 @@ BOOST_AUTO_TEST_CASE( vector_dist_cell_verlet_test ) } } -BOOST_AUTO_TEST_CASE( vector_dist_hilbert_2d_benchmark_test ) +BOOST_AUTO_TEST_CASE( vector_dist_reorder_2d_benchmark_test ) { typedef Point<2,float> s; @@ -1280,8 +1280,6 @@ BOOST_AUTO_TEST_CASE( vector_dist_hilbert_2d_benchmark_test ) { BOOST_TEST_CHECKPOINT( "Testing 2D vector with hilbert curve reordering k=" << k ); - //! [Create a vector of random elements on each processor 2D] - Box<2,float> box({0.0,0.0},{1.0,1.0}); // Boundary conditions @@ -1303,10 +1301,11 @@ BOOST_AUTO_TEST_CASE( vector_dist_hilbert_2d_benchmark_test ) vd.map(); + //Start timer timer t; t.start(); - //! [Create a vector of random elements on each processor 2D] + // Create first cell list auto NN1 = vd.getCellList(0.01); @@ -1316,8 +1315,10 @@ BOOST_AUTO_TEST_CASE( vector_dist_hilbert_2d_benchmark_test ) //Reorder a vector vd.reorder(m); + // Create second cell list auto NN2 = vd.getCellList(0.01); + //Check equality of cell sizes for (size_t i = 0 ; i < NN1.getGrid().size() ; i++) { size_t n1 = NN1.getNelements(i); @@ -1331,7 +1332,7 @@ BOOST_AUTO_TEST_CASE( vector_dist_hilbert_2d_benchmark_test ) } } -BOOST_AUTO_TEST_CASE( vector_dist_cl_hilb_forces_test ) +BOOST_AUTO_TEST_CASE( vector_dist_cl_random_vs_hilb_forces_test ) { ///////// INPUT DATA ////////// @@ -1432,11 +1433,8 @@ BOOST_AUTO_TEST_CASE( vector_dist_cl_hilb_forces_test ) } } -BOOST_AUTO_TEST_CASE( vector_dist_cl_hilb_forces_test_2 ) +BOOST_AUTO_TEST_CASE( vector_dist_cl_random_vs_reorder_forces_test ) { - - - ///////// INPUT DATA ////////// // Dimensionality of the space @@ -1492,27 +1490,20 @@ BOOST_AUTO_TEST_CASE( vector_dist_cl_hilb_forces_test_2 ) vector_dist<dim,float, aggregate<float[dim], float[dim]>, CartDecomposition<dim,float> > vd(k_int,box,bc,Ghost<dim,float>(ghost_part)); - //vector_dist<dim,float, aggregate<float[dim]>, CartDecomposition<dim,float> > vd2(k_int,box,bc,Ghost<dim,float>(ghost_part)); - - // Initialize dist vectors + // Initialize vd vd_initialize<dim,decltype(vd)>(vd, v_cl, k_int); - //Reorder a vd2 - vd.template ghost_get<0>(); - //vd2.template ghost_get<0>(); //Get a cell list auto NN1 = vd.getCellList(r_cut); - //Calculate forces + //Calculate forces '0' calc_forces_2<dim,0>(NN1,vd,r_cut); - //Get a cell list - - //auto NN2 = vd2.getCellList(r_cut); + //Reorder and get a cell list again vd.reorder(4); @@ -1520,9 +1511,10 @@ BOOST_AUTO_TEST_CASE( vector_dist_cl_hilb_forces_test_2 ) auto NN2 = vd.getCellList(r_cut); - //Calculate forces + //Calculate forces '1' calc_forces_2<dim,1>(NN2,vd,r_cut); + //Test for equality of forces auto it_v = vd.getDomainIterator(); while (it_v.isNext()) @@ -1534,7 +1526,7 @@ BOOST_AUTO_TEST_CASE( vector_dist_cl_hilb_forces_test_2 ) { auto a1 = vd.template getProp<0>(key)[i]; auto a2 = vd.template getProp<1>(key)[i]; - //Check that the forces are equal + //Check that the forces are (almost) equal BOOST_REQUIRE_CLOSE(a1,a2,0.001); } -- GitLab