Commit 95bc0f71 authored by incardon's avatar incardon

Comiling version

parent 01063412
......@@ -25,6 +25,7 @@
*.log
*.sql
*.sqlite
*.xml
# OS generated files #
######################
......@@ -74,4 +75,35 @@ install_dir
**/*.vtk
!**/test_data/*.vtk
*.csv
*.h5
*.json
*.html
cl_part_norm_hilbert_dev_2_ref
cl_part_norm_hilbert_dev_3_ref
cl_part_norm_hilbert_mean_2_ref
cl_part_norm_hilbert_mean_3_ref
cl_part_reorder_hilbert_dev_2_ref
cl_part_reorder_hilbert_dev_3_ref
cl_part_reorder_hilbert_mean_2_ref
cl_part_reorder_hilbert_mean_3_ref
cuda_include
cuda_lib
cuda_options
cuda_suppress_wr
error_code
Makefile
grid_dist_id.h51
grid_dist_id.h52
grid_dist_id.h53
grid_iterator_dev_3_ref
grid_iterator_mean_3_ref
grid_m2p_dev_3_ref
grid_m2p_mean_3_ref
mpi_include
mpi_libs
out
perf.data
perf.data.old
projectId.sh
/build
/Default/
......@@ -153,8 +153,8 @@ inline void mirror(vector_dist<1,double, aggregate<double,double> > & vd, vect_d
//
vd.getLastPos()[0] = 2.0 * box.getHigh(0) - vd.getPos(key)[0];
// Prolongate the initial condition
vd.template getLastProp<0>() = f_xex2(vd.getLastPos()[0]);
// no flow boundary condition
vd.template getLastProp<0>() = vd.template getProp<0>(key);
}
}
......
openfpm_data @ 5056c725
Subproject commit 57433749597405b0f70b9735c149285d5af059fa
Subproject commit 5056c72513114e2491a8fc1b4ddd4899ecd3e242
......@@ -13,6 +13,10 @@
#include "Grid/grid_dist_id.hpp"
#include "Amr/grid_dist_amr_key_iterator.hpp"
#ifdef __NVCC__
#include "SparseGridGpu/SparseGridGpu.hpp"
#endif
#define AMR_IMPL_TRIVIAL 1
#define AMR_IMPL_PATCHES 2
#define AMR_IMPL_OPENVDB 3
......@@ -99,7 +103,13 @@ public:
}
};
template<unsigned int dim, typename St, typename T, unsigned int impl=AMR_IMPL_TRIVIAL ,typename Decomposition = CartDecomposition<dim,St>,typename Memory=HeapMemory , typename device_grid=grid_cpu<dim,T> >
template<unsigned int dim,
typename St,
typename T,
unsigned int impl=AMR_IMPL_TRIVIAL ,
typename Decomposition = CartDecomposition<dim,St>,
typename Memory=HeapMemory ,
typename device_grid=grid_cpu<dim,T> >
class grid_dist_amr
{
......@@ -126,7 +136,12 @@ struct offset_mv
* \tparam Decomposition type of decomposition
*
*/
template<unsigned int dim, typename St, typename T,typename Decomposition,typename Memory, typename device_grid >
template<unsigned int dim,
typename St,
typename T,
typename Decomposition,
typename Memory,
typename device_grid >
class grid_dist_amr<dim,St,T,AMR_IMPL_TRIVIAL,Decomposition,Memory,device_grid>
{
//! Simulation domain
......@@ -894,4 +909,11 @@ public:
template<unsigned int dim, typename St, typename T>
using sgrid_dist_amr = grid_dist_amr<dim,St,T,AMR_IMPL_TRIVIAL,CartDecomposition<dim,St>,HeapMemory,sgrid_cpu<dim,T,HeapMemory>>;
#ifdef __NVCC__
template<unsigned int dim, typename St, typename T, unsigned int blockEdgeSize = 8>
using sgrid_dist_amr_gpu = grid_dist_amr<dim,St,T,AMR_IMPL_TRIVIAL,CartDecomposition<dim,St,CudaMemory,memory_traits_inte>,CudaMemory,SparseGridGpu<dim,T,blockEdgeSize>>;
#endif
#endif /* AMR_GRID_AMR_DIST_HPP_ */
/*
* amr_base_gpu_unit_tests.cu
*
* Created on: Aug 28, 2019
* Author: i-bird
*/
/*
* amr_base_unit_test.cpp
*
* Created on: Oct 5, 2017
* Author: i-bird
*/
#define BOOST_TEST_DYN_LINK
#include <boost/test/unit_test.hpp>
#include "Amr/grid_dist_amr.hpp"
#include "Point_test.hpp"
#include "Grid/tests/grid_dist_id_util_tests.hpp"
BOOST_AUTO_TEST_SUITE( amr_grid_dist_id_test )
BOOST_AUTO_TEST_CASE( grid_dist_id_amr_gpu )
{
// Domain
Box<3,float> domain3({0.0,0.0,0.0},{1.0,1.0,1.0});
Ghost<3,float> g(0.05);
sgrid_dist_amr_gpu<3,float,aggregate<float>> amr_g(domain3,g);
size_t g_sz[3] = {4,4,4};
size_t n_lvl = 10;
// amr_g.initLevels(n_lvl,g_sz);
/* for (size_t i = 0 ; i < amr_g.getNLvl() ; i++)
{
// Fill the AMR with something
size_t count = 0;
auto it = amr_g.getGridIterator(i);
while (it.isNext())
{
auto key = it.get_dist();
auto akey = amr_g.getAMRKey(i,key);
amr_g.template insert<0>(akey) = 3.0;
count++;
++it;
}
}
// Iterate across all the levels initialized
auto it = amr_g.getDomainIterator();
size_t count = 0;
while (it.isNext())
{
count++;
++it;
}
Vcluster<> & v_cl = create_vcluster();
v_cl.sum(count);
v_cl.execute();
BOOST_REQUIRE_EQUAL(count,correct_result);
auto itc = amr_g.getDomainIteratorCells();
size_t count_c = 0;
while (itc.isNext())
{
count_c++;
++itc;
}
v_cl.sum(count_c);
v_cl.execute();
auto it_level = amr_g.getDomainIteratorCells(3);
while (it_level.isNext())
{
auto key = it_level.get();
amr_g.template get<0>(3,key);
++it_level;
}
BOOST_REQUIRE_EQUAL(count_c,correct_result_cell);*/
}
BOOST_AUTO_TEST_SUITE_END()
......@@ -11,7 +11,8 @@ if(CUDA_FOUND)
Decomposition/cuda/decomposition_cuda_tests.cu
Vector/cuda/vector_dist_gpu_unit_tests.cu
../openfpm_devices/src/memory/CudaMemory.cu
Decomposition/cuda/Domain_icells_cart_unit_test.cu)
Decomposition/cuda/Domain_icells_cart_unit_test.cu
Amr/tests/amr_base_gpu_unit_tests.cu)
else()
set(CUDA_SOURCES)
endif()
......
......@@ -555,7 +555,7 @@ class grid_dist_id : public grid_dist_id_comm<dim,St,T,Decomposition,Memory,devi
tmp.Dbox.setLow(s,0);
tmp.Dbox.setHigh(s,-1);
}
tmp.k = -1;
tmp.k = (size_t)-1;
gdb_ext.add(tmp);
// create the local grid
......@@ -2659,7 +2659,7 @@ public:
size_t i = it.getGridId();
auto ite = loc_grid.get(i).getGridGPUIterator(b.getKP1(),b.getKP2());
auto ite = loc_grid.get(i).getGridGPUIterator(b.getKP1int(),b.getKP2int());
loc_grid.get(i).setGPUInsertBuffer(ite.nblocks(),gpu_insert_pool_size);
loc_grid.get(i).initializeGPUInsertBuffer();
......
......@@ -92,12 +92,12 @@ template<unsigned int dim> void cell_list_getCellList_calc_force_benchmark(size_
size_t bc[dim];
for (size_t i = 0; i < dim; i++)
bc[i] = PERIODIC;
{bc[i] = PERIODIC;}
vector_dist<dim,float, aggregate<float[dim]> > vd(k_int,box,bc,Ghost<dim,float>(r_cut));
// Initialize a dist vector
vd_initialize<dim>(vd, v_cl, k_int);
vd_initialize<dim>(vd, v_cl);
vd.template ghost_get<0>();
......@@ -200,7 +200,7 @@ template<unsigned int dim> void cell_list_getCellList_hilb_calc_force_benchmark(
vector_dist<dim,float, aggregate<float[dim]> > vd(k_int,box,bc,Ghost<dim,float>(r_cut));
// Initialize a dist vector
vd_initialize<dim>(vd, v_cl, k_int);
vd_initialize<dim>(vd, v_cl);
vd.template ghost_get<0>();
......
......@@ -102,7 +102,7 @@ template<unsigned int dim> void cell_list_part_reorder_random_benchmark(size_t c
vector_dist<dim,float, aggregate<float[dim]> > vd(k_int,box,bc,Ghost<dim,float>(r_cut));
// Initialize a dist vector
vd_initialize<dim>(vd, v_cl, k_int);
vd_initialize<dim>(vd, v_cl);
vd.template ghost_get<0>();
......@@ -194,15 +194,14 @@ template<unsigned int dim> void cell_list_part_reorder_hilbert_benchmark(size_t
vector_dist<dim,float, aggregate<float[dim]> > vd(k_int,box,bc,Ghost<dim,float>(r_cut));
// Initialize a dist vector
vd_initialize<dim>(vd, v_cl, k_int);
vd_initialize<dim>(vd, v_cl);
//Reorder a vector
double sum_reorder_mean = 0;
double sum_reorder_dev = 0;
openfpm::vector<double> measures;
for (size_t h = 0 ; h < N_STAT_TEST; h++)
{measures.add(benchmark_reorder(vd,m));}
standard_deviation(measures,sum_reorder_mean,sum_reorder_dev);
......
#ifndef VECTOR_DIST_GG_MAP_PERFORMANCE_HPP_
#include "Vector/vector_dist.hpp"
#include "data_type/aggregate.hpp"
#include "Plot/GoogleChart.hpp"
#include <functional>
// Property tree
struct report_vector_gg_map_tests
{
boost::property_tree::ptree graphs;
};
report_vector_gg_map_tests report_ggm;
///////////////////// INPUT DATA //////////////////////
// The starting amount of particles (remember that this number is multiplied by number of processors you use for testing)
size_t k_start = 100000;
// The minimal amount of particles
size_t k_min = 15000;
///////////////////////////////////////////////////////
BOOST_AUTO_TEST_SUITE( vector_gg_map_performance_test )
// Numbers of particles vector
openfpm::vector<size_t> n_particles;
template<unsigned int dim>
double benchmark_map(size_t k_int, Vcluster<HeapMemory> & v_cl)
{
Box<dim,float> box;
for (size_t i = 0; i < dim; i++)
{
box.setLow(i,0.0);
box.setHigh(i,1.0);
}
// Boundary conditions
size_t bc[dim];
for (size_t i = 0; i < dim; i++)
{bc[i] = PERIODIC;}
vector_dist<dim,float, aggregate<float[dim]> > vd(k_int,box,bc,Ghost<dim,float>(0.1));
auto & dec = vd.getDecomposition();
for (size_t i = 0 ; i < v_cl.size() ; i++)
{
if (i == v_cl.rank())
{continue;}
auto & nn_box = dec.getNearSubdomains(i);
if (nn_box.size() != 0)
{
// generate all particles in the near processor
vd_initialize_box_nomap<dim>(vd,nn_box.get(0),v_cl,k_int);
}
}
//Timer
timer t;
t.start();
// benckmark map
vd.map();
t.stop();
return t.getwct();
}
/*! \brief Function for cell list test without an Hilbert curve reordering (unordered positioning)
*
*/
template<unsigned int dim>
void vector_gg_map_benchmark(size_t cl_k_start,
size_t cl_k_min,
openfpm::vector<size_t> & cl_n_particles)
{
std::string str("Testing " + std::to_string(dim) + "D vector, no-order, map ghost_get");
print_test_v(str,0);
{
Vcluster<> & v_cl = create_vcluster();
if (v_cl.size() != 3)
{return;}
//Number of particles
size_t k = cl_k_start * v_cl.getProcessingUnits();
//Counter number for amounts of particles
size_t k_count = 1 + log2(k/cl_k_min);
int c = 0;
//For different number of particles
for (size_t k_int = k ; k_int >= cl_k_min ; k_int/=2 )
{
BOOST_TEST_CHECKPOINT( "Testing " << dim << "D vector without an Hilbert curve reordering k=" << k_int );
report_ggm.graphs.put("performance.map_" + std::to_string(dim) + "D.npart(" + std::to_string(c) + ").n",k_int);
if (cl_n_particles.size() < k_count)
{cl_n_particles.add(k_int);}
openfpm::vector<double> measures;
double sum_map_mean = 0.0;
double sum_map_dev = 0.0;
for (size_t h = 0 ; h < N_STAT_TEST; h++)
{measures.add(benchmark_map<dim>(k_int,v_cl));}
standard_deviation(measures,sum_map_mean,sum_map_dev);
report_ggm.graphs.put("performance.map_" + std::to_string(dim) + "D.npart(" + std::to_string(c) + ").mean",sum_map_mean);
report_ggm.graphs.put("performance.map_" + std::to_string(dim) + "D.npart(" + std::to_string(c) + ").dev",sum_map_dev);
c++;
}
}
}
BOOST_AUTO_TEST_CASE( vector_dist_map_test )
{
//Benchmark test for 2D and 3D
vector_gg_map_benchmark<3>(k_start,k_min,n_particles);
vector_gg_map_benchmark<2>(k_start,k_min,n_particles);
}
BOOST_AUTO_TEST_CASE(vector_dist_gg_map_performance_write_report)
{
// Create a graphs
report_ggm.graphs.put("graphs.graph.type","line");
report_ggm.graphs.add("graphs.graph.title","Map performance");
report_ggm.graphs.add("graphs.graph.x.title","number of particles");
report_ggm.graphs.add("graphs.graph.y.title","Time seconds");
report_ggm.graphs.add("graphs.graph.y.data(0).source","performance.map_3D.npart(#).mean");
report_ggm.graphs.add("graphs.graph.x.data(0).source","performance.map_3D.npart(#).n");
report_ggm.graphs.add("graphs.graph.y.data(0).title","Map function");
report_ggm.graphs.add("graphs.graph.options.log_y","true");
}
BOOST_AUTO_TEST_SUITE_END()
#endif
......@@ -133,10 +133,9 @@ template<unsigned int dim, unsigned int prp, typename T, typename V> void cross_
/*! \brief Initialize a distributed vector
*
* \param vd Distributed vector
* \param v_cl Global vcluster
* \param k_int Number of particles
*/
template<unsigned int dim, typename v_dist> void vd_initialize(v_dist & vd, Vcluster<> & v_cl, size_t k_int)
template<unsigned int dim, typename v_dist>
void vd_initialize(v_dist & vd, Vcluster<HeapMemory> & v_cl)
{
// The random generator engine
std::default_random_engine eg(v_cl.getProcessUnitID()*4313);
......@@ -151,7 +150,7 @@ template<unsigned int dim, typename v_dist> void vd_initialize(v_dist & vd, Vclu
auto key = it.get();
for (size_t i = 0; i < dim; i++)
vd.getPos(key)[i] = ud(eg);
{vd.getPos(key)[i] = ud(eg);}
++it;
}
......@@ -159,6 +158,36 @@ template<unsigned int dim, typename v_dist> void vd_initialize(v_dist & vd, Vclu
vd.map();
}
/*! \brief Initialize a distributed vector
*
* \param vd Distributed vector
* \param box where to initialize
* \param npart number of particles to add
*
*/
template<unsigned int dim, typename v_dist>
void vd_initialize_box_nomap(v_dist & vd, const Box<dim,typename v_dist::stype> & box, Vcluster<HeapMemory> & v_cl, int npart)
{
// The random generator engine
std::default_random_engine eg(v_cl.getProcessUnitID()*4313);
std::uniform_real_distribution<float> ud(0.0f, 1.0f);
size_t n = vd.size_local();
size_t n_stop = n + npart;
auto it = vd.getIterator(n,n_stop);
while (it.isNext())
{
auto key = it.get();
for (size_t i = 0; i < dim; i++)
{vd.getPos(key)[i] = (box.getHigh(i) - box.getLow(i))*ud(eg) + box.getLow(i);}
++it;
}
}
/*! \brief Initialize 2 distributed vectors with equally positioned particles
*
......
......@@ -104,7 +104,7 @@ template<unsigned int dim> void vd_verlet_random_benchmark(size_t k_start,
vector_dist<dim,float, aggregate<float[dim]> > vd(k_int,box,bc,Ghost<dim,float>(r_cut));
// Initialize a dist vector
vd_initialize<dim>(vd, v_cl, k_int);
vd_initialize<dim>(vd, v_cl);
vd.template ghost_get<0>();
......
......@@ -362,7 +362,7 @@ BOOST_AUTO_TEST_CASE( vector_dist_cl_random_vs_reorder_forces_test )
vector_dist<dim,float, aggregate<float[dim], float[dim]> > vd(k_int,box,bc,Ghost<dim,float>(ghost_part));
// Initialize vd
vd_initialize<dim,decltype(vd)>(vd, v_cl, k_int);
vd_initialize<dim,decltype(vd)>(vd, v_cl);
vd.ghost_get<0>();
......
......@@ -1895,6 +1895,22 @@ public:
return vector_dist_iterator(0, v_pos.size());
}
/*! \brief Get an iterator that traverse domain and ghost particles
*
* \param start particle
* \param stop particle
*
* \return an iterator
*
*/
vector_dist_iterator getIterator(size_t start, size_t stop)
{
#ifdef SE_CLASS3
se3.getIterator();
#endif
return vector_dist_iterator(start, stop);
}
/*! /brief Get a grid Iterator
*
* Usefull function to place particles on a grid or grid-like (grid + noise)
......
......@@ -41,7 +41,7 @@ BOOST_AUTO_TEST_SUITE( performance )
#include "Vector/performance/verlet_performance_tests.hpp"
#include "Vector/performance/cell_list_part_reorder.hpp"
#include "Vector/performance/cell_list_comp_reorder.hpp"
#include "Vector/performance/vector_dist_gg_map_performance.hpp"
#include "Grid/performance/grid_dist_performance.hpp"
BOOST_AUTO_TEST_SUITE_END()
......
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