Commit c75eb406 authored by Kirill Terekhov's avatar Kirill Terekhov

add more timers for parallel adaptation code

parent be438831
This diff is collapsed.
...@@ -833,43 +833,53 @@ namespace INMOST ...@@ -833,43 +833,53 @@ namespace INMOST
} }
else if( i == myconn + 3 ) else if( i == myconn + 3 )
{ {
//~ std::vector<HandleType> tmp;
MarkerType mrk = mesh->CreatePrivateMarker(); MarkerType mrk = mesh->CreatePrivateMarker();
adj_type const & hc = mesh->HighConn(GetHandle()); adj_type const & hc = mesh->HighConn(GetHandle());
for(adj_type::size_type it = 0; it < hc.size(); it++) for(adj_type::size_type it = 0; it < hc.size(); it++)
{ {
adj_type const & ihc = mesh->HighConn(hc[it]); adj_type const & ihc = mesh->HighConn(hc[it]);
for(adj_type::size_type jt = 0; jt < ihc.size(); jt++) for(adj_type::size_type jt = 0; jt < ihc.size(); jt++)
{ //~ if( !mesh->GetPrivateMarker(ihc[jt],mrk) )
adj_type const & jhc = mesh->HighConn(ihc[jt]); {
for(adj_type::size_type kt = 0; kt < jhc.size(); kt++) //~ mesh->SetPrivateMarker(ihc[jt],mrk);
if( !mesh->GetPrivateMarker(jhc[kt],mrk) ) //~ tmp.push_back(ihc[jt]);
{ adj_type const & jhc = mesh->HighConn(ihc[jt]);
result.push_back(jhc[kt]); for(adj_type::size_type kt = 0; kt < jhc.size(); kt++)
mesh->SetPrivateMarker(jhc[kt],mrk); if( !mesh->GetPrivateMarker(jhc[kt],mrk) )
} {
} result.push_back(jhc[kt]);
mesh->SetPrivateMarker(jhc[kt],mrk);
}
}
} }
//~ if(!tmp.empty()) mesh->RemPrivateMarkerArray(&tmp[0],tmp.size(),mrk);
result.RemPrivateMarker(mrk); result.RemPrivateMarker(mrk);
mesh->ReleasePrivateMarker(mrk); mesh->ReleasePrivateMarker(mrk);
} }
else if( i == myconn - 3 ) else if( i == myconn - 3 )
{ {
//~ std::vector<HandleType> tmp;
MarkerType mrk = mesh->CreatePrivateMarker(); MarkerType mrk = mesh->CreatePrivateMarker();
adj_type const & lc = mesh->LowConn(GetHandle()); adj_type const & lc = mesh->LowConn(GetHandle());
for(adj_type::size_type it = 0; it < lc.size(); it++) for(adj_type::size_type it = 0; it < lc.size(); it++)
{ {
adj_type const & ilc = mesh->LowConn(lc[it]); adj_type const & ilc = mesh->LowConn(lc[it]);
for(adj_type::size_type jt = 0; jt < ilc.size(); jt++) for(adj_type::size_type jt = 0; jt < ilc.size(); jt++)
{ //~ if( !mesh->GetPrivateMarker(ilc[jt],mrk) )
adj_type const & jlc = mesh->LowConn(ilc[jt]); {
for(adj_type::size_type kt = 0; kt < jlc.size(); kt++) //~ mesh->SetPrivateMarker(ilc[jt],mrk);
if( !mesh->GetPrivateMarker(jlc[kt],mrk) ) //~ tmp.push_back(ilc[jt]);
{ adj_type const & jlc = mesh->LowConn(ilc[jt]);
result.push_back(jlc[kt]); for(adj_type::size_type kt = 0; kt < jlc.size(); kt++)
mesh->SetPrivateMarker(jlc[kt],mrk); if( !mesh->GetPrivateMarker(jlc[kt],mrk) )
} {
} result.push_back(jlc[kt]);
mesh->SetPrivateMarker(jlc[kt],mrk);
}
}
} }
//~ if(!tmp.empty()) mesh->RemPrivateMarkerArray(&tmp[0],tmp.size(),mrk);
result.RemPrivateMarker(mrk); result.RemPrivateMarker(mrk);
mesh->ReleasePrivateMarker(mrk); mesh->ReleasePrivateMarker(mrk);
} }
...@@ -934,6 +944,7 @@ namespace INMOST ...@@ -934,6 +944,7 @@ namespace INMOST
} }
else if( i == myconn + 3 ) else if( i == myconn + 3 )
{ {
//~ std::vector<HandleType> tmp;
MarkerType mrk = mesh->CreatePrivateMarker(); MarkerType mrk = mesh->CreatePrivateMarker();
adj_type const & hc = mesh->HighConn(GetHandle()); adj_type const & hc = mesh->HighConn(GetHandle());
for(adj_type::size_type it = 0; it < hc.size(); it++) if( !mesh->GetMarker(hc[it],hm) ) for(adj_type::size_type it = 0; it < hc.size(); it++) if( !mesh->GetMarker(hc[it],hm) )
...@@ -941,22 +952,29 @@ namespace INMOST ...@@ -941,22 +952,29 @@ namespace INMOST
adj_type const & ihc = mesh->HighConn(hc[it]); adj_type const & ihc = mesh->HighConn(hc[it]);
for(adj_type::size_type jt = 0; jt < ihc.size(); jt++) if( !mesh->GetMarker(ihc[jt],hm) ) for(adj_type::size_type jt = 0; jt < ihc.size(); jt++) if( !mesh->GetMarker(ihc[jt],hm) )
{ {
adj_type const & jhc = mesh->HighConn(ihc[jt]); //~ if( !mesh->GetPrivateMarker(ihc[jt],mrk) )
for(adj_type::size_type kt = 0; kt < jhc.size(); kt++) if( !mesh->GetMarker(jhc[kt],hm) )
{ {
if( !mesh->GetPrivateMarker(jhc[kt],mrk) ) //~ mesh->SetPrivateMarker(ihc[jt],mrk);
//~ tmp.push_back(ihc[jt]);
adj_type const & jhc = mesh->HighConn(ihc[jt]);
for(adj_type::size_type kt = 0; kt < jhc.size(); kt++) if( !mesh->GetMarker(jhc[kt],hm) )
{ {
result.push_back(jhc[kt]); if( !mesh->GetPrivateMarker(jhc[kt],mrk) )
mesh->SetPrivateMarker(jhc[kt],mrk); {
result.push_back(jhc[kt]);
mesh->SetPrivateMarker(jhc[kt],mrk);
}
} }
} }
} }
} }
//~ if(!tmp.empty()) mesh->RemPrivateMarkerArray(&tmp[0],tmp.size(),mrk);
result.RemPrivateMarker(mrk); result.RemPrivateMarker(mrk);
mesh->ReleasePrivateMarker(mrk); mesh->ReleasePrivateMarker(mrk);
} }
else if( i == myconn - 3 ) else if( i == myconn - 3 )
{ {
//~ std::vector<HandleType> tmp;
MarkerType mrk = mesh->CreatePrivateMarker(); MarkerType mrk = mesh->CreatePrivateMarker();
adj_type const & lc = mesh->LowConn(GetHandle()); adj_type const & lc = mesh->LowConn(GetHandle());
for(adj_type::size_type it = 0; it < lc.size(); it++) if( !mesh->GetMarker(lc[it],hm) ) for(adj_type::size_type it = 0; it < lc.size(); it++) if( !mesh->GetMarker(lc[it],hm) )
...@@ -964,17 +982,23 @@ namespace INMOST ...@@ -964,17 +982,23 @@ namespace INMOST
adj_type const & ilc = mesh->LowConn(lc[it]); adj_type const & ilc = mesh->LowConn(lc[it]);
for(adj_type::size_type jt = 0; jt != ilc.size(); jt++) if( !mesh->GetMarker(ilc[jt],hm) ) for(adj_type::size_type jt = 0; jt != ilc.size(); jt++) if( !mesh->GetMarker(ilc[jt],hm) )
{ {
adj_type const & jlc = mesh->LowConn(ilc[jt]); //~ if( !mesh->GetPrivateMarker(ilc[jt],mrk) )
for(adj_type::size_type kt = 0; kt < jlc.size(); kt++) if( !mesh->GetMarker(jlc[kt],hm) )
{ {
if( !mesh->GetPrivateMarker(jlc[kt],mrk) ) //~ mesh->SetPrivateMarker(ilc[jt],mrk);
//~ tmp.push_back(ilc[jt]);
adj_type const & jlc = mesh->LowConn(ilc[jt]);
for(adj_type::size_type kt = 0; kt < jlc.size(); kt++) if( !mesh->GetMarker(jlc[kt],hm) )
{ {
result.push_back(jlc[kt]); if( !mesh->GetPrivateMarker(jlc[kt],mrk) )
mesh->SetPrivateMarker(jlc[kt],mrk); {
result.push_back(jlc[kt]);
mesh->SetPrivateMarker(jlc[kt],mrk);
}
} }
} }
} }
} }
//~ if(!tmp.empty()) mesh->RemPrivateMarkerArray(&tmp[0],tmp.size(),mrk);
result.RemPrivateMarker(mrk); result.RemPrivateMarker(mrk);
mesh->ReleasePrivateMarker(mrk); mesh->ReleasePrivateMarker(mrk);
} }
......
...@@ -7,10 +7,19 @@ ...@@ -7,10 +7,19 @@
// incident_matrix class should measure for minimal volume, // incident_matrix class should measure for minimal volume,
// possibly check and update from projects/OctreeCutcell/octgrid.cpp // possibly check and update from projects/OctreeCutcell/octgrid.cpp
#if defined(USE_PARALLEL_WRITE_TIME) #if defined(USE_PARALLEL_WRITE_TIME)
__INLINE std::string NameSlash(std::string input)
{
for(size_t l = input.size(); l > 0; --l)
if( input[l-1] == '/' || input[l-1] == '\\' )
return std::string(input.c_str() + l);
return input;
}
#define REPORT_MPI(x) {WriteTab(out_time) << "<MPI><![CDATA[" << #x << "]]></MPI>" << std::endl; x;} #define REPORT_MPI(x) {WriteTab(out_time) << "<MPI><![CDATA[" << #x << "]]></MPI>" << std::endl; x;}
#define REPORT_STR(x) {WriteTab(out_time) << "<TEXT><![CDATA[" << x << "]]></TEXT>" << std::endl;} #define REPORT_STR(x) {WriteTab(out_time) << "<TEXT><![CDATA[" << x << "]]></TEXT>" << std::endl;}
#define REPORT_VAL(str,x) {WriteTab(out_time) << "<VALUE name=\"" << str << "\"> <CONTENT><![CDATA[" << x << "]]></CONTENT> <CODE><![CDATA[" << #x << "]]></CODE></VALUE>" << std::endl;} #define REPORT_VAL(str,x) {WriteTab(out_time) << "<VALUE name=\"" << str << "\"> <CONTENT><![CDATA[" << x << "]]></CONTENT> <CODE><![CDATA[" << #x << "]]></CODE></VALUE>" << std::endl;}
#define ENTER_FUNC() double all_time = Timer(); {WriteTab(out_time) << "<FUNCTION name=\"" << __FUNCTION__ << "\" id=\"func" << func_id++ << "\">" << std::endl; Enter();} #define ENTER_FUNC() double all_time = Timer(); {WriteTab(out_time) << "<FUNCTION name=\"" << __FUNCTION__ << "\" id=\"func" << func_id++ << "\">" << std::endl; Enter();}
#define ENTER_BLOCK() { double btime = Timer(); WriteTab(out_time) << "<FUNCTION name=\"" << __FUNCTION__ << ":" << NameSlash(__FILE__) << ":" << __LINE__ << "\" id=\"func" << GetFuncID()++ << "\">" << std::endl; Enter();
#define EXIT_BLOCK() WriteTab(out_time) << "<TIME>" << Timer() - btime << "</TIME>" << std::endl; Exit(); WriteTab(out_time) << "</FUNCTION>" << std::endl;}
#define EXIT_FUNC() {WriteTab(out_time) << "<TIME>" << Timer() - all_time << "</TIME>" << std::endl; Exit(); WriteTab(out_time) << "</FUNCTION>" << std::endl;} #define EXIT_FUNC() {WriteTab(out_time) << "<TIME>" << Timer() - all_time << "</TIME>" << std::endl; Exit(); WriteTab(out_time) << "</FUNCTION>" << std::endl;}
#define EXIT_FUNC_DIE() {WriteTab(out_time) << "<TIME>" << -1 << "</TIME>" << std::endl; Exit(); WriteTab(out_time) << "</FUNCTION>" << std::endl;} #define EXIT_FUNC_DIE() {WriteTab(out_time) << "<TIME>" << -1 << "</TIME>" << std::endl; Exit(); WriteTab(out_time) << "</FUNCTION>" << std::endl;}
#else #else
...@@ -18,6 +27,8 @@ ...@@ -18,6 +27,8 @@
#define REPORT_STR(x) {} #define REPORT_STR(x) {}
#define REPORT_VAL(str,x) {} #define REPORT_VAL(str,x) {}
#define ENTER_FUNC() {} #define ENTER_FUNC() {}
#define ENTER_BLOCK()
#define EXIT_BLOCK()
#define EXIT_FUNC() {} #define EXIT_FUNC() {}
#define EXIT_FUNC_DIE() {} #define EXIT_FUNC_DIE() {}
#endif #endif
...@@ -1539,6 +1550,7 @@ namespace INMOST ...@@ -1539,6 +1550,7 @@ namespace INMOST
void Mesh::ApplyModification() void Mesh::ApplyModification()
{ {
ENTER_FUNC(); ENTER_FUNC();
ENTER_BLOCK();
for(Mesh::iteratorTag it = BeginTag(); it != EndTag(); ++it) for(Mesh::iteratorTag it = BeginTag(); it != EndTag(); ++it)
{ {
if( it->GetDataType() == DATA_REFERENCE ) if( it->GetDataType() == DATA_REFERENCE )
...@@ -1573,6 +1585,7 @@ namespace INMOST ...@@ -1573,6 +1585,7 @@ namespace INMOST
} }
} }
} }
EXIT_BLOCK();
//need to gather the set of deleted elements //need to gather the set of deleted elements
/*//old approach /*//old approach
ElementSet erase = CreateSet("TEMPORARY_ERASE_SET").first; ElementSet erase = CreateSet("TEMPORARY_ERASE_SET").first;
...@@ -1588,6 +1601,7 @@ namespace INMOST ...@@ -1588,6 +1601,7 @@ namespace INMOST
erase->BulkDF(SetComparatorTag()) = ElementSet::HANDLE_COMPARATOR; erase->BulkDF(SetComparatorTag()) = ElementSet::HANDLE_COMPARATOR;
*/ */
ENTER_BLOCK();
//for(integer jt = 0; jt < LastLocalID(ESET); ++jt) if( isValidElementSet(jt) ) //for(integer jt = 0; jt < LastLocalID(ESET); ++jt) if( isValidElementSet(jt) )
for(Mesh::iteratorSet it = BeginSet(); it != EndSet(); it++) for(Mesh::iteratorSet it = BeginSet(); it != EndSet(); it++)
{ {
...@@ -1618,6 +1632,8 @@ namespace INMOST ...@@ -1618,6 +1632,8 @@ namespace INMOST
hide_element = temp_hide_element; hide_element = temp_hide_element;
//it->Subtract(erase); //old approach //it->Subtract(erase); //old approach
} }
EXIT_BLOCK();
ENTER_BLOCK();
#if defined(USE_PARALLEL_STORAGE) #if defined(USE_PARALLEL_STORAGE)
for(parallel_storage::iterator it = shared_elements.begin(); it != shared_elements.end(); it++) for(parallel_storage::iterator it = shared_elements.begin(); it != shared_elements.end(); it++)
for(int i = 0; i < 5; i++) for(int i = 0; i < 5; i++)
...@@ -1642,6 +1658,7 @@ namespace INMOST ...@@ -1642,6 +1658,7 @@ namespace INMOST
it->second[i].resize(k); it->second[i].resize(k);
} }
#endif #endif
EXIT_BLOCK();
//Destroy(erase);//old approach //Destroy(erase);//old approach
EXIT_FUNC(); EXIT_FUNC();
} }
...@@ -1663,12 +1680,13 @@ namespace INMOST ...@@ -1663,12 +1680,13 @@ namespace INMOST
} }
std::cout << GetProcessorRank() << " before resolve shared new " << n << " hidden " << h << " both " << hn << std::endl; std::cout << GetProcessorRank() << " before resolve shared new " << n << " hidden " << h << " both " << hn << std::endl;
*/ */
ENTER_BLOCK();
CheckSetLinks(__FILE__,__LINE__); CheckSetLinks(__FILE__,__LINE__);
ResolveSets(); ResolveSets();
CheckSetLinks(__FILE__,__LINE__); CheckSetLinks(__FILE__,__LINE__);
ResolveShared(true); ResolveShared(true);
CheckSetLinks(__FILE__,__LINE__); CheckSetLinks(__FILE__,__LINE__);
EXIT_BLOCK();
//ReportParallelStorage(); //ReportParallelStorage();
//CheckCentroids(__FILE__,__LINE__); //CheckCentroids(__FILE__,__LINE__);
/* /*
...@@ -1684,8 +1702,10 @@ namespace INMOST ...@@ -1684,8 +1702,10 @@ namespace INMOST
std::cout << GetProcessorRank() << " before exchange ghost new " << n << " hidden " << h << " both " << hn << std::endl; std::cout << GetProcessorRank() << " before exchange ghost new " << n << " hidden " << h << " both " << hn << std::endl;
*/ */
//std::cout << "layers " << Integer(GetHandle(),tag_layers) << " bridge " << ElementTypeName(ElementType(Integer(GetHandle(),tag_bridge))) << std::endl; //std::cout << "layers " << Integer(GetHandle(),tag_layers) << " bridge " << ElementTypeName(ElementType(Integer(GetHandle(),tag_bridge))) << std::endl;
ENTER_BLOCK();
if( Integer(GetHandle(),tag_layers) ) if( Integer(GetHandle(),tag_layers) )
ExchangeGhost(Integer(GetHandle(),tag_layers),Integer(GetHandle(),tag_bridge));//,NewMarker()); //TODO!!!! ExchangeGhost(Integer(GetHandle(),tag_layers),Integer(GetHandle(),tag_bridge));//,NewMarker()); //TODO!!!!
EXIT_BLOCK();
//ReportParallelStorage(); //ReportParallelStorage();
//CheckCentroids(__FILE__,__LINE__); //CheckCentroids(__FILE__,__LINE__);
...@@ -1728,6 +1748,7 @@ namespace INMOST ...@@ -1728,6 +1748,7 @@ namespace INMOST
} }
*/ */
MarkerType nm = new_element; MarkerType nm = new_element;
ENTER_BLOCK();
new_element = 0; new_element = 0;
for(ElementType etype = ESET; etype >= NODE; etype = PrevElementType(etype)) for(ElementType etype = ESET; etype >= NODE; etype = PrevElementType(etype))
{ {
...@@ -1740,6 +1761,7 @@ namespace INMOST ...@@ -1740,6 +1761,7 @@ namespace INMOST
} }
} }
new_element = nm; new_element = nm;
EXIT_BLOCK();
/* /*
for(ElementType etype = FACE; etype >= NODE; etype = PrevElementType(etype)) for(ElementType etype = FACE; etype >= NODE; etype = PrevElementType(etype))
{ {
...@@ -1760,11 +1782,13 @@ namespace INMOST ...@@ -1760,11 +1782,13 @@ namespace INMOST
new_element = 0; new_element = 0;
//This should be done in ResolveModification //This should be done in ResolveModification
ElementType have_global_id = NONE; ElementType have_global_id = NONE;
ENTER_BLOCK();
if( GlobalIDTag().isValid() ) if( GlobalIDTag().isValid() )
{ {
for(ElementType etype = NODE; etype <= MESH; etype = NextElementType(etype)) for(ElementType etype = NODE; etype <= MESH; etype = NextElementType(etype))
if( GlobalIDTag().isDefined(etype) ) have_global_id |= etype; if( GlobalIDTag().isDefined(etype) ) have_global_id |= etype;
} }
EXIT_BLOCK();
if( have_global_id ) AssignGlobalID(have_global_id); if( have_global_id ) AssignGlobalID(have_global_id);
EXIT_FUNC(); EXIT_FUNC();
} }
......
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