Commit 9c11cea1 authored by Kirill Terekhov's avatar Kirill Terekhov
Browse files

optimization: exchange elements by global id when available

parent f84ececf
......@@ -571,6 +571,8 @@ namespace INMOST
// if( it->getNodes().size() != 2 ) {REPORT_STR("edge " << it->LocalID() << " has " << it->getNodes().size() << " nodes ");}
//EXIT_BLOCK();
m->ExchangeData(hanging_nodes,CELL | FACE,0);
//if( !Element::CheckConnectivity(m) ) std::cout << __FILE__ << ":" << __LINE__ << " broken connectivity" << std::endl;
//m->CheckCentroids(__FILE__,__LINE__);
//6.Refine
......@@ -903,7 +905,9 @@ namespace INMOST
m->EndModification();
EXIT_BLOCK();
//keep links to prevent loss during balancing
m->ExchangeData(parent_set,CELL,0);
m->ExchangeData(hanging_nodes,CELL | FACE,0);
/*
ENTER_BLOCK();
......@@ -1321,6 +1325,7 @@ namespace INMOST
m->ExchangeData(parent_set,CELL,0);
m->ExchangeData(hanging_nodes,CELL | FACE,0);
m->ResolveSets();
/*
......@@ -1349,7 +1354,7 @@ namespace INMOST
*/
//m->Barrier();
//std::cout << m->GetProcessorRank() << " call exchange marked" << std::endl;
m->ExchangeMarked();
//m->ExchangeMarked();
//std::cout << m->GetProcessorRank() << " finish exchange marked" << std::endl;
//m->Barrier();
CheckParentSet(__FILE__,__LINE__);//,indicator);
......@@ -1358,8 +1363,6 @@ namespace INMOST
//for(Mesh::iteratorSet it = m->BeginSet(); it != m->EndSet(); ++it)
// PrintSet(fout,it->self());
//m->Save("unschdind"+std::to_string(fi)+".pvtk");
//std::cout << "Save unschdind"+std::to_string(fi)+".pvtk" << std::endl;
//Make schedule which elements should be refined earlier.
......@@ -1591,7 +1594,10 @@ namespace INMOST
EXIT_BLOCK();
//fout.close();
//restore links to prevent loss during balancing
m->ExchangeData(parent_set,CELL,0);
m->ExchangeData(hanging_nodes,CELL | FACE,0);
/*
ENTER_BLOCK();
for(Storage::integer it = 0; it < m->EsetLastLocalID(); ++it) if( m->isValidElementSet(it) )
......
......@@ -83,6 +83,8 @@ int main(int argc, char ** argv)
r0 = pow(r0,1.0/3.0);
r = r0/8.0;
int ncells, nfaces, nedges, nnodes;
for(int k = 0; k < 64; ++k)
{
......@@ -118,15 +120,26 @@ int main(int argc, char ** argv)
numref = m.Integrate(numref);
if( numref )
{
int ncells = m.TotalNumberOf(CELL);
ncells = m.TotalNumberOf(CELL);
nfaces = m.TotalNumberOf(FACE);
nedges = m.TotalNumberOf(EDGE);
nnodes = m.TotalNumberOf(NODE);
if( m.GetProcessorRank() == 0 )
std::cout << "k " << k << " refcnt " << refcnt << " " << r*k << " < r < " << r*(k+1) << " cells " << ncells << std::endl;
std::cout << "beg k " << k << " refcnt " << refcnt << " cells " << ncells << " faces " << nfaces << " nedges " << nedges << " nnodes " << nnodes << std::endl;
//m.BeginSequentialCode();
//std::cout << m.GetProcessorRank() << " cells " << m.NumberOfCells() << std::endl;
//m.EndSequentialCode();
if (!am.Refine(indicator)) break;
ncells = m.TotalNumberOf(CELL);
nfaces = m.TotalNumberOf(FACE);
nedges = m.TotalNumberOf(EDGE);
nnodes = m.TotalNumberOf(NODE);
if( m.GetProcessorRank() == 0 )
std::cout << "end k " << k << " refcnt " << refcnt << " cells " << ncells << " faces " << nfaces << " nedges " << nedges << " nnodes " << nnodes << std::endl;
if( false )
{
std::stringstream file;
......@@ -166,15 +179,25 @@ int main(int argc, char ** argv)
numref = m.Integrate(numref);
if( numref )
{
int ncells = m.TotalNumberOf(CELL);
ncells = m.TotalNumberOf(CELL);
nfaces = m.TotalNumberOf(FACE);
nedges = m.TotalNumberOf(EDGE);
nnodes = m.TotalNumberOf(NODE);
if( m.GetProcessorRank() == 0 )
std::cout << ": k " << k << " crscnt " << refcnt << " " << r*k << " < r < " << r*(k+1) << " cells " << ncells << std::endl;
std::cout << ":beg k " << k << " crscnt " << refcnt << " cells " << ncells << " faces " << nfaces << " nedges " << nedges << " nnodes " << nnodes << std::endl;
//m.BeginSequentialCode();
//std::cout << m.GetProcessorRank() << " cells " << m.NumberOfCells() << std::endl;
//m.EndSequentialCode();
if( !am.Coarse(indicator) ) break;
ncells = m.TotalNumberOf(CELL);
nfaces = m.TotalNumberOf(FACE);
nedges = m.TotalNumberOf(EDGE);
nnodes = m.TotalNumberOf(NODE);
if( m.GetProcessorRank() == 0 )
std::cout << ":end k " << k << " crscnt " << refcnt << " cells " << ncells << " faces " << nfaces << " nedges " << nedges << " nnodes " << nnodes << std::endl;
if( false )
{
std::stringstream file;
......
......@@ -54,7 +54,7 @@
// output xml files for debugging of parallel algorithms
// search for style.xsl within examples for comfortable
// view of generated xml files
//#define USE_PARALLEL_WRITE_TIME
#define USE_PARALLEL_WRITE_TIME
// this will revert Mesh::PrepareReceiveInner to always
// use MPI point to point functionality disregarding problem type
......
......@@ -2308,12 +2308,12 @@ namespace INMOST
std::vector<int> ComputeSharedProcs (const parallel_storage & from, const parallel_storage & to);
std::vector<int> ComputeSharedProcs (ElementType etype);
proc_elements ComputeSharedSkinSet(ElementType bridge, MarkerType marker = 0);
void GatherPackElements (elements_by_type & selems, const elements_by_type & elements, int destination, ElementType mask, MarkerType select, const tag_set & tag_list, bool force_send, bool send_links_to_owner);
void EnumPackElements (elements_by_type & selems, TagInteger pack_position);
void UnenumPackElements (elements_by_type & selems, TagInteger pack_position);
void PackElementsGather (elements_by_type & selems, const elements_by_type & elements, int destination, ElementType mask, MarkerType select, const tag_set & tag_list, bool force_send, bool send_links_to_owner, bool pack_by_gids);
void PackElementsEnumerate (elements_by_type & selems, TagInteger pack_position);
void PackElementsUnenumerate (elements_by_type & selems, TagInteger pack_position);
void PackTagData (const Tag & tag, const elements_by_type & elements, int destination, ElementType mask, MarkerType select, buffer_type & buffer, TagInteger pack_position);
void UnpackTagData (const Tag & tag, const elements_by_type & elements, int source, ElementType mask, MarkerType select, buffer_type & buffer, int & position, ReduceOperation op, const elements_by_type & unpack_elements);//, proc_elements_by_type * send_elements = NULL);
void PackElementsData (elements_by_type & input, buffer_type & buffer, int destination, const tag_set & tag_list,TagInteger pack_position);
void PackElementsData (elements_by_type & input, buffer_type & buffer, int destination, const tag_set & tag_list,TagInteger pack_position, bool pack_gids);
void UnpackElementsData (elements_by_type & output, buffer_type & buffer, int source, int & position, tag_set & tag_list);
void PrepareReceiveInner(Prepare todo, exch_buffer_type & send_bufs, exch_buffer_type & recv_bufs);
void ExchangeDataInnerBegin(const tag_set & tag, const parallel_storage & from, const parallel_storage & to, ElementType mask, MarkerType select, exchange_data & storage);
......@@ -2325,7 +2325,7 @@ namespace INMOST
void GatherParallelStorage(parallel_storage & ghost, parallel_storage & shared, ElementType mask);
void InformElementsOwners(proc_elements_by_type & send_elements, exchange_data & storage);
public:
//bool FindSharedGhost(int global_id, INMOST_DATA_INTEGER_TYPE el_type_num, HandleType& res);
HandleType FindSharedGhost(ElementType etype, Storage::integer global_id, int source_proc, int owner_proc);
#if defined(USE_PARALLEL_WRITE_TIME)
//this part is needed to test parallel performance
void Enter ();
......
This diff is collapsed.
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