Commit fdf82a8b authored by incardon's avatar incardon

example fixed

parent be0de719
......@@ -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
......
......@@ -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 ###
......
......@@ -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 * (
......
......@@ -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
......
......@@ -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 ###
......
......@@ -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)
......
......@@ -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;
......
......@@ -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)
......
......@@ -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.
......
......@@ -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)
......
......@@ -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);
......
......@@ -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;
......
......@@ -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;
......
......@@ -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)
{
......
......@@ -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>());
}
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment