Commit db2c2ecc authored by incardon's avatar incardon

Working with 4 processors

parent d1b11807
......@@ -74,9 +74,10 @@ pdata-HeapMemory.o: ../../OpenFPM_devices/src/memory/HeapMemory.cpp \
/usr/include/sys/types.h /usr/include/sys/select.h \
/usr/include/bits/select.h /usr/include/bits/sigset.h \
/usr/include/sys/sysmacros.h /usr/include/alloca.h \
/usr/include/bits/stdlib-float.h /usr/include/c++/4.9.2/cstdio \
/usr/include/libio.h /usr/include/_G_config.h \
/usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \
/usr/include/bits/stdlib-bsearch.h /usr/include/bits/stdlib-float.h \
/usr/include/c++/4.9.2/cstdio /usr/include/libio.h \
/usr/include/_G_config.h /usr/include/bits/stdio_lim.h \
/usr/include/bits/sys_errlist.h /usr/include/bits/stdio.h \
/usr/include/c++/4.9.2/cerrno /usr/include/errno.h \
/usr/include/bits/errno.h /usr/include/linux/errno.h \
/usr/include/asm/errno.h /usr/include/asm-generic/errno.h \
......@@ -301,6 +302,8 @@ pdata-HeapMemory.o: ../../OpenFPM_devices/src/memory/HeapMemory.cpp \
/usr/include/alloca.h:
/usr/include/bits/stdlib-bsearch.h:
/usr/include/bits/stdlib-float.h:
/usr/include/c++/4.9.2/cstdio:
......@@ -313,6 +316,8 @@ pdata-HeapMemory.o: ../../OpenFPM_devices/src/memory/HeapMemory.cpp \
/usr/include/bits/sys_errlist.h:
/usr/include/bits/stdio.h:
/usr/include/c++/4.9.2/cerrno:
/usr/include/errno.h:
......
......@@ -71,9 +71,10 @@ pdata-Memleak_check.o: ../../OpenFPM_data/src/Memleak_check.cpp \
/usr/include/sys/types.h /usr/include/sys/select.h \
/usr/include/bits/select.h /usr/include/bits/sigset.h \
/usr/include/sys/sysmacros.h /usr/include/alloca.h \
/usr/include/bits/stdlib-float.h /usr/include/c++/4.9.2/cstdio \
/usr/include/libio.h /usr/include/_G_config.h \
/usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \
/usr/include/bits/stdlib-bsearch.h /usr/include/bits/stdlib-float.h \
/usr/include/c++/4.9.2/cstdio /usr/include/libio.h \
/usr/include/_G_config.h /usr/include/bits/stdio_lim.h \
/usr/include/bits/sys_errlist.h /usr/include/bits/stdio.h \
/usr/include/c++/4.9.2/cerrno /usr/include/errno.h \
/usr/include/bits/errno.h /usr/include/linux/errno.h \
/usr/include/asm/errno.h /usr/include/asm-generic/errno.h \
......@@ -302,6 +303,8 @@ pdata-Memleak_check.o: ../../OpenFPM_data/src/Memleak_check.cpp \
/usr/include/alloca.h:
/usr/include/bits/stdlib-bsearch.h:
/usr/include/bits/stdlib-float.h:
/usr/include/c++/4.9.2/cstdio:
......@@ -314,6 +317,8 @@ pdata-Memleak_check.o: ../../OpenFPM_data/src/Memleak_check.cpp \
/usr/include/bits/sys_errlist.h:
/usr/include/bits/stdio.h:
/usr/include/c++/4.9.2/cerrno:
/usr/include/errno.h:
......
......@@ -78,9 +78,10 @@ pdata-VCluster.o: ../../OpenFPM_vcluster/src/VCluster.cpp \
/usr/include/sys/types.h /usr/include/sys/select.h \
/usr/include/bits/select.h /usr/include/bits/sigset.h \
/usr/include/sys/sysmacros.h /usr/include/alloca.h \
/usr/include/bits/stdlib-float.h /usr/include/c++/4.9.2/cstdio \
/usr/include/libio.h /usr/include/_G_config.h \
/usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \
/usr/include/bits/stdlib-bsearch.h /usr/include/bits/stdlib-float.h \
/usr/include/c++/4.9.2/cstdio /usr/include/libio.h \
/usr/include/_G_config.h /usr/include/bits/stdio_lim.h \
/usr/include/bits/sys_errlist.h /usr/include/bits/stdio.h \
/usr/include/c++/4.9.2/cerrno /usr/include/errno.h \
/usr/include/bits/errno.h /usr/include/linux/errno.h \
/usr/include/asm/errno.h /usr/include/asm-generic/errno.h \
......@@ -789,7 +790,8 @@ pdata-VCluster.o: ../../OpenFPM_vcluster/src/VCluster.cpp \
/usr/include/bits/huge_valf.h /usr/include/bits/huge_vall.h \
/usr/include/bits/inf.h /usr/include/bits/nan.h \
/usr/include/bits/mathdef.h /usr/include/bits/mathcalls.h \
/usr/include/c++/4.9.2/sstream /usr/include/c++/4.9.2/bits/sstream.tcc \
/usr/include/bits/mathinline.h /usr/include/c++/4.9.2/sstream \
/usr/include/c++/4.9.2/bits/sstream.tcc \
/usr/include/boost/type_traits/is_compound.hpp \
/usr/include/boost/type_traits/is_copy_constructible.hpp \
/usr/include/boost/noncopyable.hpp \
......@@ -998,11 +1000,6 @@ pdata-VCluster.o: ../../OpenFPM_vcluster/src/VCluster.cpp \
../../OpenFPM_vcluster/src/MPI_wrapper/MPI_IallreduceW.hpp \
../../OpenFPM_vcluster/src/MPI_wrapper/MPI_IrecvW.hpp \
../../OpenFPM_vcluster/src/MPI_wrapper/MPI_IsendW.hpp \
../../OpenFPM_data/src/util/check_no_pointers.hpp \
../../OpenFPM_data/src/util/common.hpp \
../../OpenFPM_data/src/util/util_debug.hpp \
/usr/include/c++/4.9.2/cxxabi.h \
/usr/include/c++/4.9.2/x86_64-redhat-linux/bits/cxxabi_tweaks.h \
../../OpenFPM_vcluster/src/util/Vcluster_log.hpp \
/usr/include/c++/4.9.2/fstream /usr/include/c++/4.9.2/bits/codecvt.h \
/usr/include/c++/4.9.2/x86_64-redhat-linux/bits/basic_file.h \
......@@ -1226,6 +1223,8 @@ pdata-VCluster.o: ../../OpenFPM_vcluster/src/VCluster.cpp \
/usr/include/alloca.h:
/usr/include/bits/stdlib-bsearch.h:
/usr/include/bits/stdlib-float.h:
/usr/include/c++/4.9.2/cstdio:
......@@ -1238,6 +1237,8 @@ pdata-VCluster.o: ../../OpenFPM_vcluster/src/VCluster.cpp \
/usr/include/bits/sys_errlist.h:
/usr/include/bits/stdio.h:
/usr/include/c++/4.9.2/cerrno:
/usr/include/errno.h:
......@@ -2738,6 +2739,8 @@ pdata-VCluster.o: ../../OpenFPM_vcluster/src/VCluster.cpp \
/usr/include/bits/mathcalls.h:
/usr/include/bits/mathinline.h:
/usr/include/c++/4.9.2/sstream:
/usr/include/c++/4.9.2/bits/sstream.tcc:
......@@ -3184,16 +3187,6 @@ pdata-VCluster.o: ../../OpenFPM_vcluster/src/VCluster.cpp \
../../OpenFPM_vcluster/src/MPI_wrapper/MPI_IsendW.hpp:
../../OpenFPM_data/src/util/check_no_pointers.hpp:
../../OpenFPM_data/src/util/common.hpp:
../../OpenFPM_data/src/util/util_debug.hpp:
/usr/include/c++/4.9.2/cxxabi.h:
/usr/include/c++/4.9.2/x86_64-redhat-linux/bits/cxxabi_tweaks.h:
../../OpenFPM_vcluster/src/util/Vcluster_log.hpp:
/usr/include/c++/4.9.2/fstream:
......
......@@ -70,9 +70,10 @@ pdata-main.o: main.cpp /usr/include/stdc-predef.h \
/usr/include/sys/types.h /usr/include/sys/select.h \
/usr/include/bits/select.h /usr/include/bits/sigset.h \
/usr/include/sys/sysmacros.h /usr/include/alloca.h \
/usr/include/bits/stdlib-float.h /usr/include/c++/4.9.2/cstdio \
/usr/include/libio.h /usr/include/_G_config.h \
/usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \
/usr/include/bits/stdlib-bsearch.h /usr/include/bits/stdlib-float.h \
/usr/include/c++/4.9.2/cstdio /usr/include/libio.h \
/usr/include/_G_config.h /usr/include/bits/stdio_lim.h \
/usr/include/bits/sys_errlist.h /usr/include/bits/stdio.h \
/usr/include/c++/4.9.2/cerrno /usr/include/errno.h \
/usr/include/bits/errno.h /usr/include/linux/errno.h \
/usr/include/asm/errno.h /usr/include/asm-generic/errno.h \
......@@ -737,7 +738,8 @@ pdata-main.o: main.cpp /usr/include/stdc-predef.h \
/usr/include/bits/huge_valf.h /usr/include/bits/huge_vall.h \
/usr/include/bits/inf.h /usr/include/bits/nan.h \
/usr/include/bits/mathdef.h /usr/include/bits/mathcalls.h \
/usr/include/c++/4.9.2/sstream /usr/include/c++/4.9.2/bits/sstream.tcc \
/usr/include/bits/mathinline.h /usr/include/c++/4.9.2/sstream \
/usr/include/c++/4.9.2/bits/sstream.tcc \
/usr/include/boost/type_traits/is_compound.hpp \
/usr/include/boost/type_traits/is_copy_constructible.hpp \
/usr/include/boost/noncopyable.hpp \
......@@ -1111,6 +1113,7 @@ pdata-main.o: main.cpp /usr/include/stdc-predef.h \
/usr/include/boost/math/tools/user.hpp \
/usr/include/boost/detail/fenv.hpp /usr/include/c++/4.9.2/fenv.h \
/usr/include/fenv.h /usr/include/bits/fenv.h \
/usr/include/bits/fenvinline.h \
/usr/include/boost/math/special_functions/math_fwd.hpp \
/usr/include/boost/math/special_functions/detail/round_fwd.hpp \
/usr/include/boost/math/tools/promotion.hpp \
......@@ -1306,11 +1309,6 @@ pdata-main.o: main.cpp /usr/include/stdc-predef.h \
../../OpenFPM_vcluster/src/MPI_wrapper/MPI_IallreduceW.hpp \
../../OpenFPM_vcluster/src/MPI_wrapper/MPI_IrecvW.hpp \
../../OpenFPM_vcluster/src/MPI_wrapper/MPI_IsendW.hpp \
../../OpenFPM_data/src/util/check_no_pointers.hpp \
../../OpenFPM_data/src/util/common.hpp \
../../OpenFPM_data/src/util/util_debug.hpp \
/usr/include/c++/4.9.2/cxxabi.h \
/usr/include/c++/4.9.2/x86_64-redhat-linux/bits/cxxabi_tweaks.h \
../../OpenFPM_vcluster/src/util/Vcluster_log.hpp \
../../OpenFPM_data/src/timer.hpp \
../../OpenFPM_data/src/Space/SpaceBox.hpp \
......@@ -1324,7 +1322,10 @@ pdata-main.o: main.cpp /usr/include/stdc-predef.h \
../../OpenFPM_data/src/util/object_util.hpp \
../../OpenFPM_data/src/util/object_creator.hpp \
../../OpenFPM_data/src/util/util_debug.hpp \
/usr/include/c++/4.9.2/cxxabi.h \
/usr/include/c++/4.9.2/x86_64-redhat-linux/bits/cxxabi_tweaks.h \
../../OpenFPM_data/src/util/check_no_pointers.hpp \
../../OpenFPM_data/src/util/common.hpp \
../../OpenFPM_data/src/util/object_s_di.hpp \
../../OpenFPM_data/src/util/object_si_d.hpp \
../../OpenFPM_devices/src/memory/ExtPreAlloc.hpp \
......@@ -1399,6 +1400,7 @@ pdata-main.o: main.cpp /usr/include/stdc-predef.h \
../../OpenFPM_vcluster/src/Packer.hpp \
../../OpenFPM_data/src/Grid/util.hpp \
../../OpenFPM_data/src/Vector/util.hpp \
../../OpenFPM_data/src/util/util_debug.hpp \
../../OpenFPM_vcluster/src/Pack_stat.hpp \
../../OpenFPM_vcluster/src/Pack_selector.hpp \
../../OpenFPM_vcluster/src/Unpacker.hpp \
......@@ -1418,7 +1420,8 @@ pdata-main.o: main.cpp /usr/include/stdc-predef.h \
../../OpenFPM_data/src/NN/CellList/CellListBal.hpp \
../../OpenFPM_data/src/NN/CellList/CellListMem.hpp \
../../OpenFPM_data/src/Space/Ghost.hpp ../../OpenFPM_IO/src/util.hpp \
unit_test_init_cleanup.hpp Decomposition/ORB_unit_test.hpp \
unit_test_init_cleanup.hpp Decomposition/CartDecomposition_unit_test.hpp \
Decomposition/CartDecomposition.hpp Decomposition/ORB_unit_test.hpp \
Decomposition/ORB.hpp ../../OpenFPM_data/src/data_type/scalar.hpp \
Graph/CartesianGraphFactory_unit_test.hpp \
Graph/CartesianGraphFactory.hpp metis_util_unit_test.hpp metis_util.hpp \
......@@ -1430,9 +1433,7 @@ pdata-main.o: main.cpp /usr/include/stdc-predef.h \
../../OpenFPM_devices/src/memory/PreAllocHeapMemory.hpp \
../../OpenFPM_devices/src/memory/HeapMemory.hpp \
../../OpenFPM_IO/src/CSVWriter.hpp \
../../OpenFPM_IO/src/csv_multiarray.hpp \
Decomposition/CartDecomposition_unit_test.hpp \
Decomposition/CartDecomposition.hpp
../../OpenFPM_IO/src/csv_multiarray.hpp
/usr/include/stdc-predef.h:
......@@ -1628,6 +1629,8 @@ pdata-main.o: main.cpp /usr/include/stdc-predef.h \
/usr/include/alloca.h:
/usr/include/bits/stdlib-bsearch.h:
/usr/include/bits/stdlib-float.h:
/usr/include/c++/4.9.2/cstdio:
......@@ -1640,6 +1643,8 @@ pdata-main.o: main.cpp /usr/include/stdc-predef.h \
/usr/include/bits/sys_errlist.h:
/usr/include/bits/stdio.h:
/usr/include/c++/4.9.2/cerrno:
/usr/include/errno.h:
......@@ -3052,6 +3057,8 @@ Graph/CartesianGraphFactory.hpp:
/usr/include/bits/mathcalls.h:
/usr/include/bits/mathinline.h:
/usr/include/c++/4.9.2/sstream:
/usr/include/c++/4.9.2/bits/sstream.tcc:
......@@ -3884,6 +3891,8 @@ Graph/CartesianGraphFactory.hpp:
/usr/include/bits/fenv.h:
/usr/include/bits/fenvinline.h:
/usr/include/boost/math/special_functions/math_fwd.hpp:
/usr/include/boost/math/special_functions/detail/round_fwd.hpp:
......@@ -4314,16 +4323,6 @@ Grid/grid_dist_id.hpp:
../../OpenFPM_vcluster/src/MPI_wrapper/MPI_IsendW.hpp:
../../OpenFPM_data/src/util/check_no_pointers.hpp:
../../OpenFPM_data/src/util/common.hpp:
../../OpenFPM_data/src/util/util_debug.hpp:
/usr/include/c++/4.9.2/cxxabi.h:
/usr/include/c++/4.9.2/x86_64-redhat-linux/bits/cxxabi_tweaks.h:
../../OpenFPM_vcluster/src/util/Vcluster_log.hpp:
../../OpenFPM_data/src/timer.hpp:
......@@ -4352,8 +4351,14 @@ Grid/grid_dist_key.hpp:
../../OpenFPM_data/src/util/util_debug.hpp:
/usr/include/c++/4.9.2/cxxabi.h:
/usr/include/c++/4.9.2/x86_64-redhat-linux/bits/cxxabi_tweaks.h:
../../OpenFPM_data/src/util/check_no_pointers.hpp:
../../OpenFPM_data/src/util/common.hpp:
../../OpenFPM_data/src/util/object_s_di.hpp:
../../OpenFPM_data/src/util/object_si_d.hpp:
......@@ -4502,6 +4507,8 @@ Grid/grid_dist_key.hpp:
../../OpenFPM_data/src/Vector/util.hpp:
../../OpenFPM_data/src/util/util_debug.hpp:
../../OpenFPM_vcluster/src/Pack_stat.hpp:
../../OpenFPM_vcluster/src/Pack_selector.hpp:
......@@ -4552,6 +4559,10 @@ dec_optimizer.hpp:
unit_test_init_cleanup.hpp:
Decomposition/CartDecomposition_unit_test.hpp:
Decomposition/CartDecomposition.hpp:
Decomposition/ORB_unit_test.hpp:
Decomposition/ORB.hpp:
......@@ -4591,7 +4602,3 @@ Vector/vector_dist_key.hpp:
../../OpenFPM_IO/src/CSVWriter.hpp:
../../OpenFPM_IO/src/csv_multiarray.hpp:
Decomposition/CartDecomposition_unit_test.hpp:
Decomposition/CartDecomposition.hpp:
This diff is collapsed.
......@@ -31,13 +31,13 @@ BOOST_AUTO_TEST_CASE( CartDecomposition_test_use)
for (int i = 0 ; i < 3 ; i++)
{div[i] = openfpm::math::round_big_2(pow(n_sub,1.0/3));}
// Decompose
dec.setParameters(div,box);
Ghost<3,float> g(0.01);
// Decompose
dec.setParameters(div,box,g);
// create a ghost border
dec.calculateGhostBoxes(g);
dec.calculateGhostBoxes();
// For each calculated ghost box
for (size_t i = 0 ; i < dec.getNIGhostBox() ; i++)
......@@ -61,14 +61,16 @@ BOOST_AUTO_TEST_CASE( CartDecomposition_test_use)
if (found == false)
{
int debug = 0;
debug++;
const openfpm::vector<size_t> pr2 = dec.template ghost_processorID<CartDecomposition<3,float>::processor_id>(p);
}
BOOST_REQUIRE_EQUAL(found,true);
}
// Check the consistency
bool val = dec.check_consistency();
BOOST_REQUIRE_EQUAL(val,true);
}
BOOST_AUTO_TEST_SUITE_END()
......
......@@ -267,9 +267,10 @@ class grid_dist_id
if (ib.isValid() == false)
continue;
pib.ibx.add();
pib.ibx.last() = ib;
pib.ibx.last().sub = dec.getLocalIGhostSub(i,j);
pib.bid.add();
pib.bid.last().box = ib;
pib.bid.last().sub = dec.getLocalIGhostSub(i,j);
pib.bid.last().k = dec.getLocalIGhostE(i,j);
}
}
......@@ -300,13 +301,13 @@ class grid_dist_id
::Box<dim,St> ib_dom = dec.getLocalEGhostBox(i,j);
::Box<dim,size_t> ib = cd_sm.convertDomainSpaceIntoGridUnits(ib_dom);
// Check if ib is valid if not it mean that the internal ghost does not contain information so skip it
if (ib.isValid() == false)
continue;
// Warning even if the ib is not a valid in grid unit we are forced to keep it
// otherwise the value returned from dec.getLocalEGhostSub(i,j) will point to an
// invalid or wrong box
pib.ebx.add();
pib.ebx.last() = ib;
pib.ebx.last().sub = dec.getLocalEGhostSub(i,j);
pib.bid.add();
pib.bid.last().box = ib;
pib.bid.last().sub = dec.getLocalEGhostSub(i,j);
}
}
......@@ -326,37 +327,45 @@ class grid_dist_id
//! For all the internal ghost boxes of each sub-domain
for (size_t j = 0 ; j < loc_ig_box.get(i).bid.size() ; j++)
{
Box<dim,size_t> & bx_src = loc_ig_box.get(i).bid.get(j).box;
Box<dim,size_t> bx_src = loc_ig_box.get(i).bid.get(j).box;
// convert into local
bx_src -= gdb_ext.get(i).origin;
// sub domain connected
size_t sub_id = loc_ig_box.get(i).bid.get(j).sub;
// sub domain connected with external box
size_t sub_id_dst = loc_ig_box.get(i).bid.get(j).sub;
// local external ghost box connected
size_t e_box_sub = loc_ig_box.get(i).bid.get(j).e_b;
size_t k = loc_ig_box.get(i).bid.get(j).k;
Box<dim,size_t> & bx_dst = loc_eg_box.get(sub_id).bid.get(e_box_sub).box;
Box<dim,size_t> bx_dst = loc_eg_box.get(sub_id_dst).bid.get(k).box;
// convert into local
bx_dst -= gdb_ext.get(sub_id_dst).origin;
// create 2 sub grid iterator
grid_key_dx_iterator_sub<dim> sub_src(loc_grid.get(i).getGrid(),bx_src.getKP1(),bx_src.getKP2());
grid_key_dx_iterator_sub<dim> sub_dst(loc_grid.get(sub_id).getGrid(),bx_dst.getKP1(),bx_dst.getKP2());
grid_key_dx_iterator_sub<dim> sub_dst(loc_grid.get(sub_id_dst).getGrid(),bx_dst.getKP1(),bx_dst.getKP2());
#ifdef DEBUG
if (loc_eg_box.get(sub_id_dst).bid.get(k).sub != i)
std::cerr << "Error " << __FILE__ << ":" << __LINE__ << " source and destination are not correctly linked" << "\n";
if (sub_src.getVolume() != sub_dst.getVolume())
std::cerr << "Error " << __FILE__ << ":" << __LINE__ << " source and destination does not match in size" << "\n";
#endif
const auto & gs = loc_grid.get(i);
auto & gd = loc_grid.get(sub_id);
auto & gd = loc_grid.get(sub_id_dst);
while (sub_src.isNext())
{
// Option 1
gd.set(sub_src.get(),gs,sub_src.get());
gd.set(sub_dst.get(),gs,sub_src.get());
// Option 2
gd.get_o(sub_src.get()) = gs.get_o(sub_dst.get());
// gd.get_o(sub_dst.get()) = gs.get_o(sub_src.get());
++sub_src;
++sub_dst;
......@@ -434,13 +443,13 @@ public:
{div[i] = openfpm::math::round_big_2(pow(n_sub,1.0/dim));}
// Create the sub-domains
dec.setParameters(div,domain);
dec.setParameters(div,domain,ghost);
// Create local grid
Create();
// Calculate ghost boxes
dec.calculateGhostBoxes(ghost);
dec.calculateGhostBoxes();
}
/*! \brief Get the object that store the decomposition information
......@@ -464,29 +473,15 @@ public:
return cd_sm;
}
/*! \brief Create
*
*
*/
/*! \brief Create the grids on memory
*
*/
void Create()
{
// Box used for rounding error
// Box<dim,St> rnd_box;
// for (size_t i = 0 ; i < dim ; i++) {rnd_box.setHigh(i,0.5); rnd_box.setLow(i,0.5);}
// Box used for rounding in case of ghost
Box<dim,St> g_rnd_box;
for (size_t i = 0 ; i < dim ; i++) {g_rnd_box.setHigh(i,0.5); g_rnd_box.setLow(i,-0.5);}
// ! Create an hyper-cube approximation.
// ! In order to work on grid_dist the decomposition
// ! has to be a set of hyper-cube
dec.hyperCube();
// Get the number of local grid needed
size_t n_grid = dec.getNLocalHyperCube();
......@@ -503,39 +498,25 @@ public:
// Get the local hyper-cube
SpaceBox<dim,St> sp = dec.getLocalHyperCube(i);
SpaceBox<dim,St> sp_g = dec.getSubDomainWithGhost(i);
// Convert from SpaceBox<dim,float> to SpaceBox<dim,long int>
// Convert from SpaceBox<dim,St> to SpaceBox<dim,long int>
SpaceBox<dim,long int> sp_t = cd_sm.convertDomainSpaceIntoGridUnits(sp);
// convert the ghost from space coordinate to grid units
Ghost<dim,St> g_int = ghost;
g_int /= cd_sm.getCellBox().getP2();
// enlarge by 0.5 for rounding
g_int.enlarge(g_rnd_box);
// convert from Ghost<dim,St> to Ghost<dim,long int>
Ghost<dim,long int> g_int_t = g_int;
SpaceBox<dim,long int> sp_tg = cd_sm.convertDomainSpaceIntoGridUnits(sp_g);
//! Save the origin of the local grid
gdb_ext.last().origin = sp_t.getP1();
// Center the local grid to zero
sp_t -= sp_t.getP1();
gdb_ext.last().origin = sp_tg.getP1();
// save information about the local grid: domain box seen inside the domain + ghost box (see GDBoxes for a visual meaning)
// and where the GDBox start, or the origin of the local grid (+ghost) in global coordinate
gdb_ext.last().Dbox = sp_t;
gdb_ext.last().Dbox -= g_int_t.getP1();
// needed because the last key coordinate is size - 1 on each direction
// The origin is the Domain box + ghost, so shift
gdb_ext.last().origin += g_int_t.getP1();
gdb_ext.last().Dbox -= sp_tg.getP1();
// Enlarge sp with the Ghost size
sp_t.enlarge_fix_P1(g_int_t);
// center to zero
sp_tg -= sp_tg.getP1();
// Get the size of the local grid
for (size_t i = 0 ; i < dim ; i++) {l_res[i] = (sp_t.getHigh(i) >= 0)?(sp_t.getHigh(i)+1):0;}
for (size_t i = 0 ; i < dim ; i++) {l_res[i] = (sp_tg.getHigh(i) >= 0)?(sp_tg.getHigh(i)+1):0;}
// Set the dimensions of the local grid
loc_grid.get(i).template resize<Memory>(l_res);
......@@ -637,7 +618,7 @@ public:
size_t sub;
//! external box
size_t e_b;
size_t k;
};
/*! \brief It store the information about the external ghost box
......@@ -752,6 +733,12 @@ public:
// Convert the ghost external boxes into grid unit boxes
create_eg_box();
// Convert the local ghost internal boxes into grid unit boxes
create_local_ig_box();
// Convert the local external ghost boxes into grid unit boxes
create_local_eg_box();
// total number of sending vector
std::vector<size_t> pap_prp;
......
......@@ -122,7 +122,7 @@ class grid_dist_iterator<dim,device_grid,FREE>
*
*/
grid_dist_iterator<dim,device_grid,FREE> operator++()
inline grid_dist_iterator<dim,device_grid,FREE> operator++()
{
++a_it;
......@@ -136,7 +136,7 @@ class grid_dist_iterator<dim,device_grid,FREE>
g_c++;
// When the grid has size 0 potentially all the other informations are garbage
while (gList[g_c].size() == 0 ) g_c++;
while (g_c < gList.size() && (gList[g_c].size() == 0 || gdb_ext.get(g_c).Dbox.isValid() == false ) ) g_c++;
// get the next grid iterator
if (g_c < gList.size())
......@@ -153,7 +153,7 @@ class grid_dist_iterator<dim,device_grid,FREE>
* \return true if there is the next, false otherwise
*
*/
bool isNext()
inline bool isNext()
{
// If there are no other grid stop
......@@ -168,7 +168,7 @@ class grid_dist_iterator<dim,device_grid,FREE>
* \return the actual key
*
*/
grid_dist_key_dx<dim> get()
inline grid_dist_key_dx<dim> get()
{
return grid_dist_key_dx<dim>(g_c,a_it.get());
}
......@@ -239,7 +239,7 @@ class grid_dist_iterator<dim,device_grid,FIXED>
g_c++;
// When the grid has size 0 potentially all the other informations are garbage
while (gList[g_c].size() == 0 ) g_c++;
while (g_c < gList.size() && gList[g_c].size() == 0 ) g_c++;
// get the next grid iterator
if (g_c < gList.size())
......
......@@ -58,6 +58,10 @@ BOOST_AUTO_TEST_CASE( grid_dist_id_domain_grid_unit_converter_test)
// get the decomposition
auto & dec = g_dist.getDecomposition();
// check the consistency of the decomposition
bool val = dec.check_consistency();
BOOST_REQUIRE_EQUAL(val,true);
// for each local volume
// Get the number of local grid needed
size_t n_grid = dec.getNLocalHyperCube();
......@@ -92,6 +96,8 @@ BOOST_AUTO_TEST_CASE( grid_dist_id_iterator_test_use)
for (long int k = 1026 ; k > 1 ; k-= 33)
{
std::cout << "Testing: " << k << "\n";
// grid size
size_t sz[2];
sz[0] = k;
......@@ -103,6 +109,10 @@ BOOST_AUTO_TEST_CASE( grid_dist_id_iterator_test_use)
// Distributed grid with id decomposition
grid_dist_id<2, float, scalar<float>, CartDecomposition<2,float>> g_dist(sz,domain,g);
// check the consistency of the decomposition
bool val = g_dist.getDecomposition().check_consistency();
BOOST_REQUIRE_EQUAL(val,true);
// Grid sm
grid_sm<2,void> info(sz);
......@@ -142,12 +152,6 @@ BOOST_AUTO_TEST_CASE( grid_dist_id_iterator_test_use)
auto key = dom2.get();
auto key_g = g_dist.getGKey(key);
if (key_g.get(0) == 503 && key_g.get(1) == 779)
{
int debug = 0;
debug++;
}
BOOST_REQUIRE_EQUAL(g_dist.template get<0>(key),info.LinId(key_g));
++dom2;
......@@ -168,12 +172,6 @@ BOOST_AUTO_TEST_CASE( grid_dist_id_iterator_test_use)
// In this case the boundary condition are non periodic
if (g_dist.isInside(key_g))
{
if (g_dist.template get<0>(key) != info.LinId(key_g))
{
int debug = 0;
debug++;
}
BOOST_REQUIRE_EQUAL(g_dist.template get<0>(key),info.LinId(key_g));
}
......
......@@ -193,7 +193,7 @@ CUDA_CFLAGS = -I -I -I/usr/local/cuda/include
CUDA_LIBS = -L -L -L/usr/local/cuda/lib64 -lcuda -lcudart
CXX = mpic++
CXXDEPMODE = depmode=gcc3
CXXFLAGS = --std=c++11 -march=native -mtune=native -g3 -Wall -O0