Commit e994644b authored by Kirill Terekhov's avatar Kirill Terekhov
Browse files

merge

parent f25cff8c
...@@ -1325,7 +1325,7 @@ const double apert = 1.0e-8; ...@@ -1325,7 +1325,7 @@ const double apert = 1.0e-8;
interval<INMOST_DATA_ENUM_TYPE, INMOST_DATA_ENUM_TYPE> & localQ, interval<INMOST_DATA_ENUM_TYPE, INMOST_DATA_ENUM_TYPE> & localQ,
std::vector<Block> & blocks, int parts) std::vector<Block> & blocks, int parts)
{ {
double /*timer = Timer(),*/ total_time = Timer(); double timer = Timer(), total_time = Timer();
INMOST_DATA_ENUM_TYPE cbeg, cend, sep, blks; INMOST_DATA_ENUM_TYPE cbeg, cend, sep, blks;
ColumnInterval(wbeg,wend,Address,Entries,cbeg,cend); ColumnInterval(wbeg,wend,Address,Entries,cbeg,cend);
...@@ -1336,18 +1336,18 @@ const double apert = 1.0e-8; ...@@ -1336,18 +1336,18 @@ const double apert = 1.0e-8;
// std::cout << __FUNCTION__ << " row " << wbeg << ":" << wend << " col " << cbeg << ":" << cend << std::endl; // std::cout << __FUNCTION__ << " row " << wbeg << ":" << wend << " col " << cbeg << ":" << cend << std::endl;
//~ timer = Timer(); timer = Timer();
PrepareGraph(wbeg,wend,Address,Entries,G_Address,G_Entries); PrepareGraph(wbeg,wend,Address,Entries,G_Address,G_Entries);
std::cout << "prepare G time " << Timer() - timer << std::endl;
timer = Timer();
PrepareGraphTranspose(wbeg,wend,G_Address,G_Entries,tG_Address,tG_Entries); PrepareGraphTranspose(wbeg,wend,G_Address,G_Entries,tG_Address,tG_Entries);
// std::cout << "prepare tG time " << Timer() - timer << std::endl; std::cout << "prepare tG time " << Timer() - timer << std::endl;
timer = Timer();
//~ timer = Timer();
PrepareGraphProduct(wbeg,wend,G_Address,G_Entries,tG_Address,tG_Entries,pG_Address,pG_Entries); PrepareGraphProduct(wbeg,wend,G_Address,G_Entries,tG_Address,tG_Entries,pG_Address,pG_Entries);
// std::cout << "prepare pG time " << Timer() - timer << std::endl; std::cout << "prepare pG time " << Timer() - timer << std::endl;
timer = Timer();
GreedyDissection(Block(wbeg,wend,cbeg,cend),G_Address,G_Entries,tG_Address,tG_Entries,pG_Address,pG_Entries,localP,localQ,blocks,parts); GreedyDissection(Block(wbeg,wend,cbeg,cend),G_Address,G_Entries,tG_Address,tG_Entries,pG_Address,pG_Entries,localP,localQ,blocks,parts);
std::cout << "greedy dissection " << Timer() - timer << std::endl;
blks = sep = 0; blks = sep = 0;
for(INMOST_DATA_ENUM_TYPE k = 0; k < blocks.size(); ++k) for(INMOST_DATA_ENUM_TYPE k = 0; k < blocks.size(); ++k)
{ {
...@@ -1359,7 +1359,7 @@ const double apert = 1.0e-8; ...@@ -1359,7 +1359,7 @@ const double apert = 1.0e-8;
//std::cout << "total separator " << sep << " blocks " << blks << std::endl; //std::cout << "total separator " << sep << " blocks " << blks << std::endl;
//std::cout << __FUNCTION__ << " time " << Timer() - total_time << std::endl; std::cout << __FUNCTION__ << " time " << Timer() - total_time << std::endl;
} }
void MLMTILUC_preconditioner::KwaySymmetricDissection(INMOST_DATA_ENUM_TYPE wbeg, void MLMTILUC_preconditioner::KwaySymmetricDissection(INMOST_DATA_ENUM_TYPE wbeg,
INMOST_DATA_ENUM_TYPE wend, INMOST_DATA_ENUM_TYPE wend,
...@@ -1369,7 +1369,7 @@ const double apert = 1.0e-8; ...@@ -1369,7 +1369,7 @@ const double apert = 1.0e-8;
interval<INMOST_DATA_ENUM_TYPE, INMOST_DATA_ENUM_TYPE>& localQ, interval<INMOST_DATA_ENUM_TYPE, INMOST_DATA_ENUM_TYPE>& localQ,
std::vector<Block>& blocks, int parts) std::vector<Block>& blocks, int parts)
{ {
double /*timer = Timer(),*/ total_time = Timer(); double timer = Timer(), total_time = Timer();
INMOST_DATA_ENUM_TYPE cbeg, cend, sep, blks; INMOST_DATA_ENUM_TYPE cbeg, cend, sep, blks;
ColumnInterval(wbeg, wend, Address, Entries, cbeg, cend); ColumnInterval(wbeg, wend, Address, Entries, cbeg, cend);
...@@ -1379,24 +1379,25 @@ const double apert = 1.0e-8; ...@@ -1379,24 +1379,25 @@ const double apert = 1.0e-8;
// std::cout << __FUNCTION__ << " row " << wbeg << ":" << wend << " col " << cbeg << ":" << cend << std::endl; // std::cout << __FUNCTION__ << " row " << wbeg << ":" << wend << " col " << cbeg << ":" << cend << std::endl;
//~ timer = Timer(); timer = Timer();
PrepareGraph(wbeg, wend, Address, Entries, G_Address, G_Entries);
PrepareGraph(wbeg, wend, Address, Entries, G_Address,G_Entries); std::cout << "prepare G time " << Timer() - timer << std::endl;
PrepareGraphTranspose(wbeg, wend, G_Address,G_Entries, tG_Address,tG_Entries); timer = Timer();
// std::cout << "prepare tG time " << Timer() - timer << std::endl; PrepareGraphTranspose(wbeg, wend, G_Address, G_Entries, tG_Address, tG_Entries);
std::cout << "prepare tG time " << Timer() - timer << std::endl;
//~ timer = Timer(); timer = Timer();
PrepareGraphProduct(wbeg, wend, G_Address,G_Entries, tG_Address,tG_Entries, pG_Address, pG_Entries); PrepareGraphProduct(wbeg, wend, G_Address, G_Entries, tG_Address, tG_Entries, pG_Address, pG_Entries);
// std::cout << "prepare pG time " << Timer() - timer << std::endl; std::cout << "prepare pG time " << Timer() - timer << std::endl;
timer = Timer();
GreedyDissection(Block(wbeg, wend, cbeg, cend), G_Address, G_Entries, tG_Address, tG_Entries, pG_Address, pG_Entries, localP, localQ, blocks, parts); GreedyDissection(Block(wbeg, wend, cbeg, cend), G_Address, G_Entries, tG_Address, tG_Entries, pG_Address, pG_Entries, localP, localQ, blocks, parts);
std::cout << "greedy dissection " << Timer() - timer << std::endl;
blks = sep = 0; blks = sep = 0;
for (INMOST_DATA_ENUM_TYPE k = 0; k < blocks.size(); ++k) for (INMOST_DATA_ENUM_TYPE k = 0; k < blocks.size(); ++k)
{ {
if (blocks[k].separator) sep += blocks[k].RowSize(); if (blocks[k].separator) sep += blocks[k].RowSize();
else blks++; else blks++;
//std::cout << (blocks[k].separator?"separator":"block") << "[" << k << "] rows " << blocks[k].row_start << ":" << blocks[k].row_end << "(" << blocks[k].RowSize() << ") cols " << blocks[k].col_start << ":" << blocks[k].col_end << "(" << blocks[k].ColSize() << ")" << std::endl; std::cout << (blocks[k].separator?"separator":"block") << "[" << k << "] rows " << blocks[k].row_start << ":" << blocks[k].row_end << "(" << blocks[k].RowSize() << ") cols " << blocks[k].col_start << ":" << blocks[k].col_end << "(" << blocks[k].ColSize() << ")" << std::endl;
} }
...@@ -1410,7 +1411,7 @@ const double apert = 1.0e-8; ...@@ -1410,7 +1411,7 @@ const double apert = 1.0e-8;
//std::cout << "total separator " << sep << " blocks " << blks << std::endl; //std::cout << "total separator " << sep << " blocks " << blks << std::endl;
//std::cout << __FUNCTION__ << " time " << Timer() - total_time << std::endl; std::cout << __FUNCTION__ << " time " << Timer() - total_time << std::endl;
} }
void MLMTILUC_preconditioner::GreedyDissection(const Block & b, void MLMTILUC_preconditioner::GreedyDissection(const Block & b,
...@@ -1430,7 +1431,7 @@ const double apert = 1.0e-8; ...@@ -1430,7 +1431,7 @@ const double apert = 1.0e-8;
bool kway = (kway_parts > 1); bool kway = (kway_parts > 1);
// const int kway_parts = 4; // const int kway_parts = 4;
const int upd_sep = 1, upd_blk = 1; const int upd_sep = 1, upd_blk = 1;
const int wgt_sep = 1, wgt_blk = 1; const int wgt_sep = 0, wgt_blk = 1;
// std::cout << __FUNCTION__ << " wgt sep " << wgt_sep << " blk " << wgt_blk << " kway " << kway << std::endl; // std::cout << __FUNCTION__ << " wgt sep " << wgt_sep << " blk " << wgt_blk << " kway " << kway << std::endl;
...@@ -4269,11 +4270,19 @@ const double apert = 1.0e-8; ...@@ -4269,11 +4270,19 @@ const double apert = 1.0e-8;
if (false) if (false)
{ {
for (size_t q = 0; q < blocks.size(); ++q) if (blocks[q].separator)
{
blocks.push_back(Block(blocks[q].col_start, blocks[q].col_end, blocks[q].row_start, blocks[q].row_end, true));
break;
}
DumpMatrix(A_Address, A_Entries, wbeg, wend, "A_snd" + to_string(level_size.size()) + ".mtx"); DumpMatrix(A_Address, A_Entries, wbeg, wend, "A_snd" + to_string(level_size.size()) + ".mtx");
std::ofstream file("blocks_snd" + to_string(level_size.size()) + ".txt"); std::ofstream file("blocks_snd" + to_string(level_size.size()) + ".txt");
for (INMOST_DATA_ENUM_TYPE k = 0; k < blocks.size(); ++k) for (INMOST_DATA_ENUM_TYPE k = 0; k < blocks.size(); ++k)
file << blocks[k].row_start - wbeg << " " << blocks[k].row_end - wbeg << " " << blocks[k].col_start - wbeg << " " << blocks[k].col_end - wbeg << std::endl; file << blocks[k].row_start - wbeg << " " << blocks[k].row_end - wbeg << " " << blocks[k].col_start - wbeg << " " << blocks[k].col_end - wbeg << std::endl;
file.close(); file.close();
blocks.pop_back();
} }
if (verbosity > 1) if (verbosity > 1)
......
...@@ -140,8 +140,8 @@ int main(int argc, char ** argv) ...@@ -140,8 +140,8 @@ int main(int argc, char ** argv)
s.SetParameter("pivot_condition", "5"); s.SetParameter("pivot_condition", "5");
s.SetParameter("ddpq_tolerance", "0.7"); s.SetParameter("ddpq_tolerance", "0.7");
mat.Save("A.mtx"); //mat.Save("A.mtx");
b.Save("b.mtx"); //b.Save("b.mtx");
t = Timer(); t = Timer();
s.SetMatrix(mat); // Compute the preconditioner for the original matrix s.SetMatrix(mat); // Compute the preconditioner for the original matrix
...@@ -150,7 +150,7 @@ int main(int argc, char ** argv) ...@@ -150,7 +150,7 @@ int main(int argc, char ** argv)
t = Timer(); t = Timer();
success = s.Solve(b,x); // Solve the linear system with the previously computted preconditioner success = s.Solve(b,x); // Solve the linear system with the previously computted preconditioner
x.Save("x.mtx"); //x.Save("x.mtx");
BARRIER BARRIER
if( !rank ) std::cout << "solver: " << Timer() - t << std::endl; if( !rank ) std::cout << "solver: " << Timer() - t << std::endl;
iters = s.Iterations(); // Get the number of iterations performed iters = s.Iterations(); // Get the number of iterations performed
......
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