Commit bc999135 authored by incardon's avatar incardon

Added NO_CHANGE option to debug

parent 500c4c93
......@@ -4,40 +4,76 @@
#include "VCluster.hpp"
/*
* ### WIKI 1 ###
*
* \page VCluster_0_simple Using Vcluster to communicate across processors
*
*
* [TOC]
*
* ## Simple example
*
* This example show several basic functionalities of VCluster
*
* ### WIKI END ###
*
*/
int main(int argc, char* argv[])
{
//
// ### WIKI 2 ###
//
// Initialize the library and several objects
//
/*
*
* \page VCluster_0_simple Using Vcluster to communicate across processors
*
*
* ## Initialization
*
* Before using any functionality the library must be initialized
*
* \snippet Vcluster/0_simple/main.cpp initialization
*
*/
//! \cond [initialization] \endcond
openfpm_init(&argc,&argv);
//
// ### WIKI 3 ###
//
// Get the vcluster object and the number of processor
//
//! \cond [initialization] \endcond
/*
*
* \page VCluster_0_simple Using Vcluster to communicate across processors
*
* ### Initialization of Vcluster
*
* Because in general our program is parallel we have more than one processors. With
* the function getProcessingUnits we can querry how many processors are involved in
* out computation
*
* \snippet Vcluster/0_simple/main.cpp initialization
*
*/
Vcluster & v_cl = create_vcluster();
long int N_prc = v_cl.getProcessingUnits();
//
// ### WIKI 3 ###
//
// We find the maximum of the processors rank, that should be the Number of
// processor minus one, only processor 0 print on terminal
//
/*
*
* \page VCluster_0_simple Using Vcluster to communicate across processors
*
*
* ### min max, sum
*
* with the function getProcessUnitID we can the the id of the processor executing
* the function. This function is equivalent to the MPI rank function.
* Vcluster provide several high and low level functionalities. One is max that
* return the maximum value across processors. There is also the function min
* and sum that return respectively the sum and the minimum across processors.
* All these operations are asynchronous, in order to get the result the function
* execute must be used. In our example the processor 0 print we also print the value
* but can be easily verified that also the other processors has the same value.
*
* \snippet Vcluster/0_simple/main.cpp max calc
*
*/
//! \cond [max calc] \endcond
long int id = v_cl.getProcessUnitID();
......@@ -46,12 +82,21 @@ int main(int argc, char* argv[])
if (v_cl.getProcessUnitID() == 0)
std::cout << "Maximum processor rank: " << id << "\n";
//
// ### WIKI 4 ###
//
// We sum all the processor ranks the maximum, the result should be that should
// be $\frac{(n-1)n}{2}$, only processor 0 print on terminal
//
//! \cond [max calc] \endcond
/*
*
* \page VCluster_0_simple Using Vcluster to communicate across processors
*
* We sum all the processor ranks the result should be that should
* be \$\frac{(n-1)n}{2}\$, only processor 0 print on terminal
*
*
* \snippet Vcluster/0_simple/main.cpp sum calc
*
*/
//! \cond [sum calc] \endcond
size_t id2 = v_cl.getProcessUnitID();
......@@ -60,11 +105,19 @@ int main(int argc, char* argv[])
if (v_cl.getProcessUnitID() == 0)
std::cout << "Sum of all processors rank: " << id2 << "\n";
//
// ### WIKI 5 ###
//
// we can collect information from all processors using the function gather
//
//! \cond [sum calc] \endcond
/*
*
* \page VCluster_0_simple Using Vcluster to communicate across processors
*
* We sum all the processor ranks the result should be that should
* be \$\frac{(n-1)n}{2}\$, only processor 0 print on terminal
*
*
* \snippet Vcluster/0_simple/main.cpp max calc
*
*/
long int id3 = v_cl.getProcessUnitID();
openfpm::vector<long int> v;
......
......@@ -1251,7 +1251,11 @@ public:
/*! \brief Get the domain Cells
*
* \param shift Shifting point
* It performa a linearization of the domain cells using the extension provided in gs
*
*
* \param shift Cell padding
* \param cell_shift where the domain cell start
* \param gs grid extension
*
*/
......
......@@ -390,7 +390,7 @@ public:
Ghost<dim,size_t> g_ext(0);
cell_list.Initialize(cd_sm,pbox,pad);
updateCellList(cell_list);
updateCellListSym(cell_list);
return cell_list;
}
......
......@@ -15,6 +15,7 @@
#define NO_POSITION 1
#define WITH_POSITION 2
#define NO_CHANGE_ELEMENTS 4
#define BIND_DEC_TO_GHOST 1
......@@ -57,7 +58,7 @@ class vector_dist_comm
//! particles that must be communicated to the other processors
openfpm::vector<openfpm::vector<aggregate<size_t,size_t>>> g_opart;
// processor rank list of g_opart
//! processor rank list of g_opart
openfpm::vector<size_t> prc_g_opart;
//! Sending buffer for the ghost particles position
......@@ -76,6 +77,8 @@ class vector_dist_comm
//! It store the size of the elements added for each processor that communicate with us (local processor)
//! from the last ghost get
openfpm::vector<size_t> recv_sz_get;
//! Conversion to byte of recv_sz_get
openfpm::vector<size_t> recv_sz_get_byte;
//! The same as recv_sz_get but for put
openfpm::vector<size_t> recv_sz_put;
......@@ -87,18 +90,21 @@ class vector_dist_comm
//! replicated ghost particles that are local
size_t lg_m;
//! process the particle with properties
//! process the particle without properties
struct proc_without_prp
{
//! process the particle
template<typename T1, typename T2> inline static void proc(size_t lbl, size_t cnt, size_t id, T1 & v_prp, T2 & m_prp)
{
m_prp.get(lbl).set(cnt, v_prp.get(id));
}
};
//! process the particle with properties
template<typename prp_object, int ... prp>
struct proc_with_prp
{
//! process the particle
template<typename T1, typename T2> inline static void proc(size_t lbl, size_t cnt, size_t id, T1 & v_prp, T2 & m_prp)
{
// source object type
......@@ -151,7 +157,7 @@ class vector_dist_comm
/*! \brief Return a valid particle starting from end and tracing back
*
* \param end actual opart particle pointer
* \param actual end particle point
* \param end_id actual end particle point
*
* \return a valid particle
*
......@@ -386,7 +392,6 @@ class vector_dist_comm
*
* \param v_pos vector of particle positions
* \param g_pos_send Send buffer to fill
* \param prAlloc_pos Memory object for the send buffer
*
*/
void fill_send_ghost_pos_buf(openfpm::vector<Point<dim, St>> & v_pos,openfpm::vector<send_pos_vector> & g_pos_send)
......@@ -422,7 +427,6 @@ class vector_dist_comm
*
* \param v_prp vector of particle properties
* \param g_send_prp Send buffer to fill
* \param prAlloc_prp Memory object for the send buffer
* \param g_m ghost marker
*
*/
......@@ -468,7 +472,6 @@ class vector_dist_comm
*
* \param v_prp vector of particle properties
* \param g_send_prp Send buffer to fill
* \param prAlloc_prp Memory object for the send buffer
*
*/
template<typename send_vector, typename prp_object, int ... prp> void fill_send_ghost_prp_buf(openfpm::vector<prop> & v_prp, openfpm::vector<send_vector> & g_send_prp)
......@@ -501,9 +504,9 @@ class vector_dist_comm
*
* \param v_pos vector of particle positions
* \param v_prp vector of particles properties
* \param prc_r List of processor rank involved in the send
* \param prc_sz_r For each processor in the list the size of the message to send
* \param pb send buffer
* \param m_pos sending buffer for position
* \param m_prp sending buffer for properties
*
*/
void fill_send_map_buf(openfpm::vector<Point<dim, St>> & v_pos, openfpm::vector<prop> & v_prp, openfpm::vector<size_t> & prc_sz_r, openfpm::vector<openfpm::vector<Point<dim,St>>> & m_pos, openfpm::vector<openfpm::vector<prop>> & m_prp)
......@@ -542,8 +545,8 @@ class vector_dist_comm
* \param v_pos vector of particle positions
* \param v_prp vector of particle properties
* \param prc_r List of processor rank involved in the send
* \param prc_sz_r For each processor in the list the size of the message to send
* \param pb send buffer
* \param m_pos sending buffer for position
* \param m_prp sending buffer for properties
*
*/
template<typename prp_object,int ... prp> void fill_send_map_buf_list(openfpm::vector<Point<dim, St>> & v_pos, openfpm::vector<prop> & v_prp, openfpm::vector<size_t> & prc_sz_r, openfpm::vector<openfpm::vector<Point<dim,St>>> & m_pos, openfpm::vector<openfpm::vector<prp_object>> & m_prp)
......@@ -871,11 +874,15 @@ public:
{
if (opt & SKIP_LABELLING)
{
op_ssend_gg_recv_merge opm(g_m);
v_cl.SSendRecvP_op<op_ssend_gg_recv_merge,send_vector,decltype(v_prp),prp...>(g_send_prp,v_prp,prc_g_opart,opm,prc_recv_get,recv_sz_get);
size_t opt = NONE;
if (opt & NO_CHANGE_ELEMENTS)
opt = RECEIVE_KNOWN;
op_ssend_gg_recv_merge opm(g_m);
v_cl.SSendRecvP_op<op_ssend_gg_recv_merge,send_vector,decltype(v_prp),prp...>(g_send_prp,v_prp,prc_g_opart,opm,prc_recv_get,recv_sz_get);
}
else
v_cl.SSendRecvP<send_vector,decltype(v_prp),prp...>(g_send_prp,v_prp,prc_g_opart,prc_recv_get,recv_sz_get);
v_cl.SSendRecvP<send_vector,decltype(v_prp),prp...>(g_send_prp,v_prp,prc_g_opart,prc_recv_get,recv_sz_get,recv_sz_get_byte);
}
if (!(opt & NO_POSITION))
......
......@@ -1501,7 +1501,10 @@ BOOST_AUTO_TEST_CASE( vector_dist_ghost_with_ghost_buffering )
++it;
}
vd.ghost_get<0>(SKIP_LABELLING);
if (i % 2 == 0)
vd.ghost_get<0>(SKIP_LABELLING);
else
vd.ghost_get<0>(SKIP_LABELLING | NO_CHANGE_ELEMENTS );
auto it2 = vd.getGhostIterator();
bool ret = true;
......
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