diff --git a/CHANGELOG.md b/CHANGELOG.md index f180e5017d7f0a3f3f01befaa5ce309fbb3f5326..781548f86d9e45eff06e752fb7a35889596526cf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,9 +9,9 @@ All notable changes to this project will be documented in this file. - Increaded performance for grid ghost get - Introduced forms to increase the performance of the grid iterator in case of stencil code (see example 5_GrayScott) - EMatrix wrapped eigen matrices compatibles with vector_dist_id -- General tuning for high dimension vector_dist_id (up to 50 dimensions) +- General tuning for high dimension vector_dist_id (up to 50 dimensions) + PS_CMA_ES (Particle-Swarm Covariant Matrix Adaptation Evolution Strategy) example in Numerics - Added Discrete element Method example (8_DEM) -- Introduced map(LOCAL) for fast communication in case we have small moovement +- Introduced map(LOCAL) for fast communication in case we have small movement ### Fixed diff --git a/example/Debugging/1_classes/main.cpp b/example/Debugging/1_classes/main.cpp index 1662be01ff903459bb8100469d7f235a90320e1e..bb95b45cc544852f66838dfa2efa26dd0f294a43 100644 --- a/example/Debugging/1_classes/main.cpp +++ b/example/Debugging/1_classes/main.cpp @@ -17,7 +17,6 @@ #define SE_CLASS3 #define THROW_ON_ERROR #include "Memleak_check.hpp" -#include "data_type/scalar.hpp" #include "Grid/grid_dist_id.hpp" #include "Decomposition/CartDecomposition.hpp" #include "Point_test.hpp" @@ -72,7 +71,7 @@ int main(int argc, char* argv[]) // * g: ghost extension // // - grid_dist_id<3, float, scalar<float[3]>, CartDecomposition<3,float>> * g_dist = new grid_dist_id<3, float, scalar<float[3]>, CartDecomposition<3,float>>(sz,domain,g); + grid_dist_id<3, float, aggregate<float[3]>, CartDecomposition<3,float>> * g_dist = new grid_dist_id<3, float, aggregate<float[3]> >(sz,domain,g); // // ### WIKI 6 ### diff --git a/example/Grid/3_gray_scott_3d/main.cpp b/example/Grid/3_gray_scott_3d/main.cpp index 7c7e8f4f2b842b709bd80b4413273f0d3943881e..474a6d3d3c728293858d0b0363f7603e34eb0138 100644 --- a/example/Grid/3_gray_scott_3d/main.cpp +++ b/example/Grid/3_gray_scott_3d/main.cpp @@ -166,7 +166,7 @@ int main(int argc, char* argv[]) for (size_t i = 0; i < timeSteps; ++i) { if (i % 300 == 0) - std::cout << "STEP: " << i << std::endl; + {std::cout << "STEP: " << i << std::endl;} //! \cond [stencil get and use] \endcond @@ -175,15 +175,15 @@ int main(int argc, char* argv[]) while (it.isNext()) { // center point - auto Cp = it.getStencilGrid<0>(); + auto Cp = it.getStencil<0>(); // plus,minus X,Y,Z - auto mx = it.getStencilGrid<1>(); - auto px = it.getStencilGrid<2>(); - auto my = it.getStencilGrid<3>(); - auto py = it.getStencilGrid<4>(); - auto mz = it.getStencilGrid<5>(); - auto pz = it.getStencilGrid<6>(); + auto mx = it.getStencil<1>(); + auto px = it.getStencil<2>(); + auto my = it.getStencil<3>(); + auto py = it.getStencil<4>(); + auto mz = it.getStencil<5>(); + auto pz = it.getStencil<6>(); // update based on Eq 2 New.get<U>(Cp) = Old.get<U>(Cp) + uFactor * ( diff --git a/example/Grid/3_gray_scott_3d_vectorization/main.cpp b/example/Grid/3_gray_scott_3d_vectorization/main.cpp index f153be0dcdf63e7403b9570a72f96d68317c532c..8b7596cffe157894ab7dccc9b33362e3690636d2 100644 --- a/example/Grid/3_gray_scott_3d_vectorization/main.cpp +++ b/example/Grid/3_gray_scott_3d_vectorization/main.cpp @@ -167,7 +167,7 @@ void step(grid_dist_id<3, double, aggregate<double>> & OldU, out1.store(&U_new.get<0>(Cp),Vc::Unaligned); out2.store(&V_new.get<0>(Cp),Vc::Unaligned); - END_LOOP_M + END_LOOP_M(Vc::double_v::Size) //! \cond [cpp_update] \endcond diff --git a/example/Numerics/PSE/0_Derivative_approx_1D/main.cpp b/example/Numerics/PSE/0_Derivative_approx_1D/main.cpp index 06007039d8860f61d54912c662815fb656aa36f6..5471efad4c8963a296b3ed24bf8792d610c8404c 100644 --- a/example/Numerics/PSE/0_Derivative_approx_1D/main.cpp +++ b/example/Numerics/PSE/0_Derivative_approx_1D/main.cpp @@ -100,7 +100,7 @@ int main(int argc, char* argv[]) // we create a set of N+1 particles to have a fully covered domain of particles between 0.0 and 4.0 // Suppose we have a spacing given by 1.0 you need 4 +1 particles to cover your domain // - vector_dist<1,double, aggregate<double>, CartDecomposition<1,double> > vd(Npart+1,box,bc,g); + vector_dist<1,double, aggregate<double> > vd(Npart+1,box,bc,g); // // ### WIKI 4 ### diff --git a/example/Vector/1_HDF5_save_load/Makefile b/example/Vector/1_HDF5_save_load/Makefile index 32fc2c54f1dde03bc1aadc0cb2b04aa58b4900d9..703912dfbb69414b088bbaa7fa532977f2ba03c5 100644 --- a/example/Vector/1_HDF5_save_load/Makefile +++ b/example/Vector/1_HDF5_save_load/Makefile @@ -11,7 +11,7 @@ all: hdf5 %.o: %.cpp - $(CC) -O0 $(OPT) -g -c --std=c++11 -o $@ $< $(INCLUDE_PATH) + $(CC) -O3 $(OPT) -g -c --std=c++11 -o $@ $< $(INCLUDE_PATH) hdf5: $(OBJ) $(CC) -o $@ $^ $(CFLAGS) $(LIBS_PATH) $(LIBS) diff --git a/example/Vector/3_molecular_dynamic/main_vl.cpp b/example/Vector/3_molecular_dynamic/main_vl.cpp index c039c99101b4756e658cd9bb5ef3ed420353102f..a3db62571ca7667081e2df2baa104019ae2ca4f8 100644 --- a/example/Vector/3_molecular_dynamic/main_vl.cpp +++ b/example/Vector/3_molecular_dynamic/main_vl.cpp @@ -62,7 +62,7 @@ constexpr int force = 1; //! \cond [arg diff] \endcond -void calc_forces(vector_dist<3,double, aggregate<double[3],double[3]> > & vd, VerletList<3, double, FAST, shift<3, double> > & NN, double sigma12, double sigma6, double r_cut) +void calc_forces(vector_dist<3,double, aggregate<double[3],double[3]> > & vd, VerletList<3, double, Mem_fast<>, shift<3, double> > & NN, double sigma12, double sigma6, double r_cut) { //! \cond [arg diff] \endcond @@ -150,7 +150,7 @@ void calc_forces(vector_dist<3,double, aggregate<double[3],double[3]> > & vd, Ve //! \cond [calc energy vl] \endcond -double calc_energy(vector_dist<3,double, aggregate<double[3],double[3]> > & vd, VerletList<3, double, FAST, shift<3, double> > & NN, double sigma12, double sigma6, double r_cut) +double calc_energy(vector_dist<3,double, aggregate<double[3],double[3]> > & vd, VerletList<3, double, Mem_fast<>, shift<3, double> > & NN, double sigma12, double sigma6, double r_cut) { double E = 0.0; diff --git a/example/Vector/4_complex_prop/Makefile b/example/Vector/4_complex_prop/Makefile index 2de12f95f6b02c804e5fa5a0b835d5c78fa9337d..32a3dea52036fc6b22b652d19f8295628403a96b 100644 --- a/example/Vector/4_complex_prop/Makefile +++ b/example/Vector/4_complex_prop/Makefile @@ -10,7 +10,7 @@ OBJ_SER = main_ser.o all: vect_cp vect_ser %.o: %.cpp - $(CC) -O3 -c --std=c++11 -o $@ $< $(INCLUDE_PATH) + $(CC) -O0 -c --std=c++11 -o $@ $< $(INCLUDE_PATH) vect_cp: $(OBJ) $(CC) -o $@ $^ $(CFLAGS) $(LIBS_PATH) $(LIBS) diff --git a/example/Vector/4_complex_prop/main_ser.cpp b/example/Vector/4_complex_prop/main_ser.cpp index 94868acbff09b911f891187763fecea8b2270ca2..0089bbc5a051b608ebbeee59ccd471f69bae43a2 100644 --- a/example/Vector/4_complex_prop/main_ser.cpp +++ b/example/Vector/4_complex_prop/main_ser.cpp @@ -112,6 +112,15 @@ public: //! \cond [pack request] \endcond + //! \cond [noPointers] \endcond + + static bool noPointers() + { + return false; + } + + //! \cond [noPointers] \endcond + //! \cond [pack serialize] \endcond //! Serialize the data structure @@ -210,11 +219,12 @@ public: * * \page Vector_4_complex_prop_ser Vector 4 property serialization * - * In order to make my_struct serializable we need 3 methods + * In order to make my_struct serializable we need 4 methods * * * **packRequest** This method indicate how many byte are needed to serialize this structure * * **pack** This method serialize the data-structure * * **unpack** This method de-serialize the data structure + * * **noPointers()** a static method that inform the OpenFPM sub-system that the structure has no pointers inside * * ### packRequest ### * @@ -294,6 +304,12 @@ public: * * \snippet Vector/4_complex_prop/main_ser.cpp unpacker ser other * + * ### noPointers ### + * + * This method inform the sub-system that the custom structure does not have pointers + * + * \snippet Vector/4_complex_prop/main_ser.cpp noPointers + * * ### Constructor and destructor and operator= ### * * Constructor and destructor are not releated to serialization and de-serialization concept. diff --git a/example/Vector/4_multiphase_celllist_verlet/Makefile b/example/Vector/4_multiphase_celllist_verlet/Makefile index e14eedbb41b3cc4cd79451b34eebcc209de98f2a..4c82311a73a2e94c68ef932450eb8ff5a78e70e6 100644 --- a/example/Vector/4_multiphase_celllist_verlet/Makefile +++ b/example/Vector/4_multiphase_celllist_verlet/Makefile @@ -7,7 +7,7 @@ LDIR = OBJ = main.o %.o: %.cpp - $(CC) -O3 -g -c --std=c++11 -o $@ $< $(INCLUDE_PATH) + $(CC) -O0 -g -c --std=c++11 -o $@ $< $(INCLUDE_PATH) multip: $(OBJ) $(CC) -o $@ $^ $(CFLAGS) $(LIBS_PATH) $(LIBS) diff --git a/example/Vector/4_multiphase_celllist_verlet/main.cpp b/example/Vector/4_multiphase_celllist_verlet/main.cpp index cfa51c3139d674de2c9820ab4708c868fd06460f..0f2fcc794741711e7428eeafef7c22de6d8f11e9 100644 --- a/example/Vector/4_multiphase_celllist_verlet/main.cpp +++ b/example/Vector/4_multiphase_celllist_verlet/main.cpp @@ -237,7 +237,11 @@ int main(int argc, char* argv[]) //! \cond [create multi-phase multi verlet] \endcond // This function create an "Empty" Multiphase Cell List from all the phases - auto CL_all = createCellListM<2>(phases,r_cut); + + // We just create a cell list with slightly bigget r_cut to avoid error in Verlet creation + // because of round off errors + float r_cut2 = r_cut*1.00001; + auto CL_all = createCellListM<2>(phases,r_cut2); // This create a Verlet-list between phase0 and all the other phases auto NNver0_all = createVerletM<2>(0,phases.get(0),phases,CL_all,r_cut); diff --git a/example/Vector/5_molecular_dynamic_sym/main.cpp b/example/Vector/5_molecular_dynamic_sym/main.cpp index 4225ae303452449bcd9ef0ac42731b6fcfc52137..0d35dba8718ed677cfc627e1b2beaa147356aaee 100644 --- a/example/Vector/5_molecular_dynamic_sym/main.cpp +++ b/example/Vector/5_molecular_dynamic_sym/main.cpp @@ -76,7 +76,8 @@ constexpr int force = 1; //! \cond [calc forces vl] \endcond -void calc_forces(vector_dist<3,double, aggregate<double[3],double[3]> > & vd, VerletList<3, double, FAST, shift<3, double> > & NN, double sigma12, double sigma6, double r_cut) +template<typename VerletList> +void calc_forces(vector_dist<3,double, aggregate<double[3],double[3]> > & vd, VerletList & NN, double sigma12, double sigma6, double r_cut) { // Reset force on the ghost @@ -186,7 +187,8 @@ void calc_forces(vector_dist<3,double, aggregate<double[3],double[3]> > & vd, Ve //! \cond [calc energy vl] \endcond -double calc_energy(vector_dist<3,double, aggregate<double[3],double[3]> > & vd, VerletList<3, double, FAST, shift<3, double> > & NN, double sigma12, double sigma6, double r_cut) +template<typename VerletList> +double calc_energy(vector_dist<3,double, aggregate<double[3],double[3]> > & vd, VerletList & NN, double sigma12, double sigma6, double r_cut) { double E = 0.0; diff --git a/example/Vector/5_molecular_dynamic_sym_crs/main.cpp b/example/Vector/5_molecular_dynamic_sym_crs/main.cpp index 7983316c41b6b09c1869fb84a6c9134e49c8b1c0..8697222cbee0ae9eb108e972ef4cdb6ae6fe6eea 100644 --- a/example/Vector/5_molecular_dynamic_sym_crs/main.cpp +++ b/example/Vector/5_molecular_dynamic_sym_crs/main.cpp @@ -127,7 +127,8 @@ constexpr int force = 1; //! \cond [calc forces vl] \endcond -void calc_forces(vector_dist<3,double, aggregate<double[3],double[3]> > & vd, VerletList<3, double, FAST, shift<3, double> > & NN, double sigma12, double sigma6, double r_cut) +template<typename VerletList> +void calc_forces(vector_dist<3,double, aggregate<double[3],double[3]> > & vd, VerletList & NN, double sigma12, double sigma6, double r_cut) { // Reset force on the ghost @@ -163,7 +164,7 @@ void calc_forces(vector_dist<3,double, aggregate<double[3],double[3]> > & vd, Ve // Get an iterator over the neighborhood particles of p // Note that in case of symmetric - auto Np = NN.getNNIterator<NO_CHECK>(p); + auto Np = NN.template getNNIterator<NO_CHECK>(p); // For each neighborhood particle ... while (Np.isNext()) @@ -242,7 +243,8 @@ void calc_forces(vector_dist<3,double, aggregate<double[3],double[3]> > & vd, Ve //! \cond [calc energy vl] \endcond -double calc_energy(vector_dist<3,double, aggregate<double[3],double[3]> > & vd, VerletList<3, double, FAST, shift<3, double> > & NN, double sigma12, double sigma6, double r_cut) +template<typename VerletList> +double calc_energy(vector_dist<3,double, aggregate<double[3],double[3]> > & vd, VerletList & NN, double sigma12, double sigma6, double r_cut) { double E = 0.0; @@ -262,7 +264,7 @@ double calc_energy(vector_dist<3,double, aggregate<double[3],double[3]> > & vd, Point<3,double> xp = vd.getPos(p); // Get an iterator over the neighborhood particles of p - auto Np = NN.getNNIterator<NO_CHECK>(p); + auto Np = NN.template getNNIterator<NO_CHECK>(p); double Ep = E; diff --git a/src/Decomposition/Distribution/parmetis_util.hpp b/src/Decomposition/Distribution/parmetis_util.hpp index c34bc34a5e65797b548e1b2cd22073deecf6ee36..68fbf891ba157bc7caf3ed00f1bc5ead72957e5a 100755 --- a/src/Decomposition/Distribution/parmetis_util.hpp +++ b/src/Decomposition/Distribution/parmetis_util.hpp @@ -14,7 +14,7 @@ #include "VCluster/VCluster.hpp" #include "Graph/ids.hpp" -#define PARMETSI_ERROR_OBJECT std::runtime_error("Runtime Parmetis error"); +#define PARMETIS_ERROR_OBJECT std::runtime_error("Runtime Parmetis error"); /*! \brief Metis graph structure @@ -213,6 +213,16 @@ public: Parmetis(Vcluster & v_cl, size_t nc) :v_cl(v_cl), nc(nc),n_dec(0) { +#ifdef SE_CLASS1 + + if (sizeof(idx_t) != 8) + { + std::cerr << __FILE__ << ":" << __LINE__ << " Error detected invalid installation of Parmetis. OpenFPM support Parmetis/Metis version with 64 bit idx_t" << std::endl; + ACTION_ON_ERROR(PARMETIS_ERROR_OBJECT); + } + +#endif + // TODO Move into VCluster MPI_Comm_dup(MPI_COMM_WORLD, &comm); @@ -246,16 +256,6 @@ public: */ ~Parmetis() { -#ifdef SE_CLASS1 - - if (sizeof(idx_t) != 8) - { - std::cerr << __FILE__ << ":" << __LINE__ << " Error detected invalid installation of Parmetis. OpenFPM support Parmetis/Metis version with 64 bit idx_t" << std::endl; - ACTION_ON_ERROR(PARMETIS_ERROR_OBJECT); - } - -#endif - // Deallocate the Mg structure if (Mg.nvtxs != NULL) { diff --git a/src/Grid/Iterators/grid_dist_id_iterator.hpp b/src/Grid/Iterators/grid_dist_id_iterator.hpp index 60cb2e0c4d3573cc86a0ce95b8995a09225b93c8..7c3ca85e995bbb7f815164e1a2eed97838bdaf41 100644 --- a/src/Grid/Iterators/grid_dist_id_iterator.hpp +++ b/src/Grid/Iterators/grid_dist_id_iterator.hpp @@ -59,9 +59,6 @@ class grid_dist_iterator<dim,device_grid,FREE,stencil> //! stop point (is the grid size) grid_key_dx<dim> stop; - // device grid pointer - device_grid * dg; - /*! \brief from g_c increment g_c until you find a valid grid * */ @@ -244,18 +241,6 @@ class grid_dist_iterator<dim,device_grid,FREE,stencil> { return grid_dist_lin_dx(g_c,a_it.template getStencil<id>()); } - - /*! \brief Return the stencil point offset - * - * \tparam id - * - * \return linearized distributed key - * - */ - template<unsigned int id> inline grid_dist_g_dx<device_grid> getStencilGrid() - { - return grid_dist_g_dx<device_grid>(dg,a_it.template getStencil<id>()); - } };