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

change behavior for computation of shared processors, still some bugs to fix

parent 80c75d41
......@@ -26,6 +26,22 @@ if(USE_MPI)
endif()
endif(USE_MPI)
if(USE_PARTITIONER)
if(USE_PARTITIONER_ZOLTAN)
message("linking AdaptiveMesh with Zoltan")
target_link_libraries(AdaptiveMesh ${ZOLTAN_LIBRARIES})
target_link_libraries(AdaptiveMeshCube ${ZOLTAN_LIBRARIES})
target_link_libraries(AdaptiveMeshSphere ${ZOLTAN_LIBRARIES})
endif()
if(USE_PARTITIONER_PARMETIS)
message("linking AdaptiveMesh with ParMETIS")
target_link_libraries(AdaptiveMesh ${PARMETIS_LIBRARIES})
target_link_libraries(AdaptiveMeshCube ${PARMETIS_LIBRARIES})
target_link_libraries(AdaptiveMeshSphere ${PARMETIS_LIBRARIES})
endif()
endif()
set_property(TARGET AdaptiveMeshLib PROPERTY PUBLIC_HEADER "${CMAKE_CURRENT_SOURCE_DIR}/amesh.h")
install(TARGETS AdaptiveMeshLib EXPORT inmost-targets
......
......@@ -878,6 +878,7 @@ namespace INMOST
//return number of refined cells
call_counter++;
ret = m->Integrate(ret);
REPORT_VAL("ret ",ret)
EXIT_FUNC();
return ret != 0;
}
......@@ -894,49 +895,6 @@ namespace INMOST
(void)size;
}
void AdaptiveMesh::SynchronizeIndicated(TagInteger& indicator)
{
if (m->GetProcessorsNumber() == 1) return;
ENTER_FUNC();
int rank = m->GetProcessorRank();
// Check all sets. All elements in sets must be indicated. At first we check indicator in local processor, and second integrate data
TagInteger tag_indicated = m->CreateTag("INDICATED",DATA_INTEGER,ESET,NONE,1);
ENTER_BLOCK();
for(Mesh::iteratorSet it = m->BeginSet(); it != m->EndSet(); ++it)
{
ElementSet set = ElementSet(m,*it);
set.Integer(tag_indicated) = 1;
ElementSet::iterator p = set.Begin();
while(p != set.End())
{
if (indicator[*p] == 0)
{
tag_indicated[set] = 0;
//std::cout << rank << ": Set " << set.GetName() << " not all indicated" << endl;
break;
}
p++;
}
}
EXIT_BLOCK();
m->ReduceData(tag_indicated,ESET,0,OperationMin);
m->ExchangeData(tag_indicated,ESET,0);
ENTER_BLOCK();
for(Mesh::iteratorSet it = m->BeginSet(); it != m->EndSet(); ++it)
if (it->Integer(tag_indicated) == 0)
{
ElementSet::iterator p = it->Begin();
while(p != it->End())
{
p->Integer(indicator) = 0;
p++;
}
}
EXIT_BLOCK();
EXIT_FUNC();
}
bool AdaptiveMesh::Coarse(TagInteger & indicator)
{
......@@ -1552,6 +1510,7 @@ namespace INMOST
call_counter++;
ret = m->Integrate(ret);
REPORT_VAL("ret ",ret)
EXIT_FUNC();
return ret != 0;
}
......
......@@ -19,7 +19,7 @@ namespace INMOST
void CheckParentSet();
void PrepareSet();
//void PrintSetLocal(std::string offset, ElementSet it, std::stringstream& ss);
void SynchronizeIndicated(TagInteger& indicator);
//void SynchronizeIndicated(TagInteger& indicator);
void SetNewOwner(ElementSet set, TagInteger owner);
void SetNewProcs(ElementSet set, TagIntegerArray procs);
void RestoreParent(ElementSet set);
......
......@@ -20,12 +20,12 @@ int main(int argc, char ** argv)
Partitioner p(&m);
if( true )
{
//std::cout << "before on " << m.GetProcessorRank() << " " << m.NumberOfCells() << std::endl;
std::cout << "before on " << m.GetProcessorRank() << " " << m.NumberOfCells() << std::endl;
p.SetMethod(Partitioner::INNER_KMEANS,Partitioner::Partition);
p.Evaluate();
m.Redistribute();
m.ReorderEmpty(CELL|FACE|EDGE|NODE);
//std::cout << "after on " << m.GetProcessorRank() << " " << m.NumberOfCells() << std::endl;
std::cout << "after on " << m.GetProcessorRank() << " " << m.NumberOfCells() << std::endl;
}
#endif
m.ExchangeGhost(2,FACE);
......@@ -93,13 +93,16 @@ int main(int argc, char ** argv)
}
else indicator[*it] = 0;
}
if( m.Integrate(numref) )
numref = m.Integrate(numref);
if( numref )
{
int ncells = m.TotalNumberOf(CELL);
if( m.GetProcessorRank() == 0 )
std::cout << "k " << k << " refcnt " << refcnt << " " << r*k << " < r < " << r*(k+1) << " cells " << ncells << std::endl;
//m.BeginSequentialCode();
//std::cout << m.GetProcessorRank() << " cells " << m.NumberOfCells() << std::endl;
//m.EndSequentialCode();
if (!am.Refine(indicator)) break;
if( false )
......@@ -137,11 +140,15 @@ int main(int argc, char ** argv)
}
else indicator[*it] = 0;
}
if( m.Integrate(numref) )
numref = m.Integrate(numref);
if( numref )
{
int ncells = m.TotalNumberOf(CELL);
if( m.GetProcessorRank() == 0 )
std::cout << ": k " << k << " crscnt " << refcnt << " " << r*k << " < r < " << r*(k+1) << " cells " << ncells << std::endl;
//m.BeginSequentialCode();
//std::cout << m.GetProcessorRank() << " cells " << m.NumberOfCells() << std::endl;
//m.EndSequentialCode();
if( !am.Coarse(indicator) ) break;
......
......@@ -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
......
......@@ -2278,7 +2278,8 @@ namespace INMOST
int parallel_strategy;
int parallel_file_strategy;
private:
void ComputeSharedProcs ();
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 PackTagData (const Tag & tag, const elements_by_type & elements, int destination, ElementType mask, MarkerType select, buffer_type & buffer);
void UnpackTagData (const Tag & tag, const elements_by_type & elements, int source, ElementType mask, MarkerType select, buffer_type & buffer, int & position, ReduceOperation op, proc_elements_by_type * send_elements = NULL);
......@@ -3199,6 +3200,8 @@ namespace INMOST
/// Check that centroids of ghost and shared elements match to each other.
/// Exits if does not match.
void CheckCentroids (std::string file, int line);
/// Check that processors are sorted on every element
void CheckProcsSorted(std::string file, int line);
/// Check that number of ghost and shared elements match to each other.
/// Exits if does not match.
void CheckGhostSharedCount(std::string file, int line, ElementType etype = ESET | CELL | FACE | EDGE | NODE);
......
......@@ -1386,7 +1386,7 @@ namespace INMOST
}
}
ComputeSharedProcs();
//ComputeSharedProcs();
RecomputeParallelStorage(CELL | FACE | EDGE | NODE);
//Share number of Layers
......
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