From 03ab49f8587f2d363e46be0e432660c13df50253 Mon Sep 17 00:00:00 2001 From: Pietro Incardona Date: Tue, 21 Feb 2017 15:05:26 +0100 Subject: [PATCH] Release_0.8.0 candidate --- CHANGELOG.md | 5 ++ example/Vector/0_simple/main.cpp | 6 ++- example/Vector/7_SPH_dlb/main.cpp | 33 +++++++++--- openfpm_data | 2 +- openfpm_devices | 2 +- openfpm_io | 2 +- openfpm_numerics | 2 +- src/DLB/LB_Model.hpp | 4 +- src/Decomposition/CartDecomposition.hpp | 4 +- .../Distribution/ParMetisDistribution.hpp | 9 ++-- .../Distribution/parmetis_util.hpp | 12 +++-- src/Vector/vector_dist.hpp | 54 ++++++++++--------- src/main.cpp | 1 + 13 files changed, 85 insertions(+), 51 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fefca28..80330b4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,11 +9,16 @@ All notable changes to this project will be documented in this file. - Added procedure for update ./install --update (From 0.8.0 version will be supported for bug fixing, version 0.X.0 will be supported untill 0.X+2.0 will be out) +- Added video lessons for Dynamic load balancing (openfpm.mpi-cbg.de) - Added for debugging the options PRINT_STACKTRACE, CHECKFOR_POSNAN, CHECKFOR_POSINF, CHECKFOR_PROPINF, CHECKFOR_PROPNAN, SE_CLASS3 for debugging. Additional example added (7_sph_dlb_safe) +- Added the possibility to write binary VTK files using VTK_WRITER_BINARY 0_simple_vector + example + ### Changed - BOOST updated to 1.63 - Eigen updated to 3.3.7 +- Option CSV_WRITER changed to CSV_WRITER_ASCII ## [0.7.0] 15 December 2016 diff --git a/example/Vector/0_simple/main.cpp b/example/Vector/0_simple/main.cpp index d32e2be..0439d95 100644 --- a/example/Vector/0_simple/main.cpp +++ b/example/Vector/0_simple/main.cpp @@ -327,7 +327,10 @@ int main(int argc, char* argv[]) * With this function we output the particle position in VTK format. A VTK file * contain information about particle position and properties. Such file can be visualizaed * with program like paraview. In case this program run on several processor Each processor - * generate a VTK file + * generate a VTK file. VTK has two format one is the ASCII that is human readable but produce + * bigger file the other is the binary that produce not-human readable files, but smaller + * and more efficent files to read for Paraview. In order to create a Binary VTK file use the + * option VTK_ * * \snippet Vector/0_simple/main.cpp vtk * @@ -344,6 +347,7 @@ int main(int argc, char* argv[]) //! \cond [vtk] \endcond vd.write("particles"); + vd.write("particles",VTK_WRITE_BINARY); //! \cond [vtk] \endcond diff --git a/example/Vector/7_SPH_dlb/main.cpp b/example/Vector/7_SPH_dlb/main.cpp index 44b9fa1..535912b 100644 --- a/example/Vector/7_SPH_dlb/main.cpp +++ b/example/Vector/7_SPH_dlb/main.cpp @@ -13,15 +13,21 @@ * decomposition to keep all the processor load and reduce idle time. * * \htmlonly - * Video 1 + * Simulation video 1
* - * Video 2 + * Simulation video 2
* + * Simulation dynamic load balancing video 1
+ * + * Simulation dynamic load balancing video 2
+ * * \endhtmlonly * @@ -1196,6 +1202,21 @@ int main(int argc, char* argv[]) * balanced configuration does not correspond to the evenly distributed particles to know * more about that please follow the video tutorials * + * \htmlonly + * Dynamic load balancing the theory part1 + * + * Dynamic load balancing the theory part2 + * + * Dynamic load balancing practice part1 + * + * \endhtmlonly + * * \snippet Vector/7_SPH_dlb/main.cpp load balancing * * \htmlonly diff --git a/openfpm_data b/openfpm_data index 63bfcfa..8104e4b 160000 --- a/openfpm_data +++ b/openfpm_data @@ -1 +1 @@ -Subproject commit 63bfcfa657c6d9cd66eae064a115a08e4eaeb400 +Subproject commit 8104e4b491b20b7b7c74b17ec733729fa3cb5dc3 diff --git a/openfpm_devices b/openfpm_devices index b96708b..9d5f962 160000 --- a/openfpm_devices +++ b/openfpm_devices @@ -1 +1 @@ -Subproject commit b96708b8c2ca93ef4a8754e58a28bbad506df932 +Subproject commit 9d5f962e451893510d39b9d3233087f54a510bb7 diff --git a/openfpm_io b/openfpm_io index 5dfcba9..fd80414 160000 --- a/openfpm_io +++ b/openfpm_io @@ -1 +1 @@ -Subproject commit 5dfcba90e49c58fa569f02475635938e285142b1 +Subproject commit fd804149e48a4d8d5d6f0632d4368e7e76d61183 diff --git a/openfpm_numerics b/openfpm_numerics index bc9efd0..5e30463 160000 --- a/openfpm_numerics +++ b/openfpm_numerics @@ -1 +1 @@ -Subproject commit bc9efd0e62982ec86bd6d53e43fb4db1b041a82c +Subproject commit 5e304636549cf27fd266aaf3e459d4861d4ff096 diff --git a/src/DLB/LB_Model.hpp b/src/DLB/LB_Model.hpp index 22ef21f..d8f65aa 100644 --- a/src/DLB/LB_Model.hpp +++ b/src/DLB/LB_Model.hpp @@ -33,7 +33,7 @@ struct ModelLin dec.setSubSubDomainComputationCost(v, dec.getSubSubDomainComputationCost(v)); } - double setDistributionTol(size_t i) + double distributionTol() { return 1.01; } @@ -58,7 +58,7 @@ struct ModelSquare dec.setSubSubDomainComputationCost(v, dec.getSubSubDomainComputationCost(v) * dec.getSubSubDomainComputationCost(v)); } - double setDistributionTol(size_t i) + double distributionTol() { return 1.01; } diff --git a/src/Decomposition/CartDecomposition.hpp b/src/Decomposition/CartDecomposition.hpp index bf04201..cf3c91a 100755 --- a/src/Decomposition/CartDecomposition.hpp +++ b/src/Decomposition/CartDecomposition.hpp @@ -393,7 +393,7 @@ public: } - /*! It calculate the internal ghost boxes + /*! \brief It calculate the internal ghost boxes * * Example: Processor 10 calculate * B8_0 B9_0 B9_1 and B5_0 @@ -1275,7 +1275,7 @@ public: /*! \brief Get the domain Cells * - * It performa a linearization of the domain cells using the extension provided in gs + * It perform a linearization of the domain cells using the extension provided in gs * * * \param shift Cell padding diff --git a/src/Decomposition/Distribution/ParMetisDistribution.hpp b/src/Decomposition/Distribution/ParMetisDistribution.hpp index 3bed97f..1c61eeb 100644 --- a/src/Decomposition/Distribution/ParMetisDistribution.hpp +++ b/src/Decomposition/Distribution/ParMetisDistribution.hpp @@ -615,15 +615,14 @@ public: return parmetis_graph.get_ndec(); } - /*! \brief Set the tollerance for each partition + /*! \brief Set the tolerance for each partition * - * \param i partition - * \param tol tollerance + * \param tol tolerance * */ - void setDistTol(size_t i, double tol) + void setDistTol(double tol) { - parmetis_graph.setDistTol(i,tol); + parmetis_graph.setDistTol(tol); } }; diff --git a/src/Decomposition/Distribution/parmetis_util.hpp b/src/Decomposition/Distribution/parmetis_util.hpp index 11e543a..9167e07 100755 --- a/src/Decomposition/Distribution/parmetis_util.hpp +++ b/src/Decomposition/Distribution/parmetis_util.hpp @@ -125,6 +125,9 @@ class Parmetis //! indicate how many time decompose/refine/re-decompose has been called size_t n_dec; + //! Distribution tolerance + real_t dist_tol = 1.05; + /*! \brief Construct Adjacency list * * \param g Global graph @@ -482,7 +485,7 @@ public: for (size_t s = 0; s < (size_t) Mg.nparts[0]; s++) { Mg.tpwgts[s] = 1.0 / Mg.nparts[0]; - Mg.ubvec[s] = 1.05; + Mg.ubvec[s] = dist_tol; } Mg.edgecut = new idx_t[1]; @@ -547,13 +550,12 @@ public: /*! \brief Distribution tolerance * - * \param i partition id - * \param tol tollerance + * \param tol tolerance * */ - const void setDistTol(size_t i, real_t tol) + const void setDistTol(real_t tol) { - Mg.ubvec[i] = tol; + dist_tol = tol; } }; diff --git a/src/Vector/vector_dist.hpp b/src/Vector/vector_dist.hpp index a27da7c..b0af222 100644 --- a/src/Vector/vector_dist.hpp +++ b/src/Vector/vector_dist.hpp @@ -183,7 +183,7 @@ private: g_m = p_np; } - /*! \brief Checl if the parameters describe a valid vector. In case it does not report an error + /*! \brief Check if the parameters describe a valid vector. In case it does not report an error * * \param box Box to check * @@ -199,6 +199,11 @@ private: } + /*! \brief It check that the r_cut is not bugger than the ghost + * + * \param r_cut cut-off radius + * + */ void check_ghost_compatible_rcut(St r_cut) { for (size_t i = 0 ; i < dim ; i++) @@ -329,8 +334,7 @@ public: * \param box domain where the vector of elements live * \param bc boundary conditions * \param g Ghost margins - * \param opt additional options. - * * BIND_DEC_TO_GHOST Bind the decomposition to be multiple of the + * \param opt additional options. BIND_DEC_TO_GHOST Bind the decomposition to be multiple of the * ghost size. This is required if we want to use symmetric to eliminate * ghost communications. * @@ -1056,14 +1060,8 @@ public: } } - /*! \brief for each particle get the verlet list - * - * \param verlet output verlet list for each particle - * \param r_cut cut-off radius - * - * \deprecated - * - */ +#if 0 + /* void getVerletDeprecated(openfpm::vector> & verlet, St r_cut) { // resize verlet to store the number of particles @@ -1115,14 +1113,14 @@ public: } }*/ +#endif + /*! \brief Construct a cell list starting from the stored particles and reorder a vector according to the Hilberts curve * * \tparam CellL CellList type to construct * * \param m an order of a hilbert curve * - * - * */ template > > void reorder (int32_t m) { @@ -1540,13 +1538,7 @@ public: for (size_t i = 0 ; i < dec.getDistribution().getNSubSubDomains(); i++) md.applyModel(dec,i); - // set the ubvec - size_t n_part = v_cl.getProcessingUnits(); - - for (size_t i = 0 ; i < n_part ; i++) - { - dec.getDistribution().setDistTol(i,md.distributionTol(i)); - } + dec.getDistribution().setDistTol(md.distributionTol()); } /*! \brief Output particle position and properties @@ -1557,10 +1549,10 @@ public: * \return true if the file has been written without error * */ - inline bool write(std::string out, int opt = NO_GHOST | VTK_WRITER ) + inline bool write(std::string out, int opt = VTK_WRITER) { - if ((opt & 0xFFFF0000) == CSV_WRITER) + if ((opt & 0x0FFF0000) == CSV_WRITER) { // CSVWriter test CSVWriter>, openfpm::vector > csv_writer; @@ -1570,8 +1562,13 @@ public: // Write the CSV return csv_writer.write(output,v_pos,v_prp); } - else if ((opt & 0xFFFF0000) == VTK_WRITER) + else { + file_type ft = file_type::ASCII; + + if (opt & FORMAT_BINARY) + ft = file_type::BINARY; + // VTKWriter for a set of points VTKWriter>, openfpm::vector>, VECTOR_POINTS> vtk_writer; vtk_writer.add(v_pos,v_prp,g_m); @@ -1579,7 +1576,7 @@ public: std::string output = std::to_string(out + "_" + std::to_string(v_cl.getProcessUnitID()) + std::to_string(".vtk")); // Write the VTK file - return vtk_writer.write(output); + return vtk_writer.write(output,"particles",ft); } return false; @@ -1623,7 +1620,7 @@ public: */ inline bool write(std::string out, size_t iteration, int opt = NO_GHOST) { - if ((opt & 0xFFFF0000) == CSV_WRITER) + if ((opt & 0x0FFF0000) == CSV_WRITER) { // CSVWriter test CSVWriter>, openfpm::vector > csv_writer; @@ -1635,6 +1632,11 @@ public: } else { + file_type ft = file_type::ASCII; + + if (opt & FORMAT_BINARY) + ft = file_type::BINARY; + // VTKWriter for a set of points VTKWriter>, openfpm::vector>, VECTOR_POINTS> vtk_writer; vtk_writer.add(v_pos,v_prp,g_m); @@ -1642,7 +1644,7 @@ public: std::string output = std::to_string(out + "_" + std::to_string(v_cl.getProcessUnitID()) + "_" + std::to_string(iteration) + std::to_string(".vtk")); // Write the VTK file - return vtk_writer.write(output); + return vtk_writer.write(output,"particles",ft); } } diff --git a/src/main.cpp b/src/main.cpp index bc6009a..f33bd63 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -55,4 +55,5 @@ int main(int argc, char* argv[]) #include "Grid/staggered_grid_dist_unit_test.hpp" #include "Vector/vector_dist_MP_unit_tests.hpp" #include "Vector/se_class3_vector_unit_tests.hpp" +#include "Vector/vector_dist_dlb_test.hpp" //#include "antoniol_test_isolation.hpp" -- GitLab