Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Kirill Terekhov
INMOST
Commits
e994644b
Commit
e994644b
authored
Apr 27, 2021
by
Kirill Terekhov
Browse files
merge
parent
f25cff8c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Source/Solver/solver_inner/solver_mlmptiluc/solver_mlmtiluc2.cpp
View file @
e994644b
...
...
@@ -1325,7 +1325,7 @@ const double apert = 1.0e-8;
interval
<
INMOST_DATA_ENUM_TYPE
,
INMOST_DATA_ENUM_TYPE
>
&
localQ
,
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
;
ColumnInterval
(
wbeg
,
wend
,
Address
,
Entries
,
cbeg
,
cend
);
...
...
@@ -1336,18 +1336,18 @@ const double apert = 1.0e-8;
// std::cout << __FUNCTION__ << " row " << wbeg << ":" << wend << " col " << cbeg << ":" << cend << std::endl;
//~ timer = Timer();
timer
=
Timer
();
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
);
// std::cout << "prepare tG time " << Timer() - timer << std::endl;
//~ timer = Timer();
std
::
cout
<<
"prepare tG time "
<<
Timer
()
-
timer
<<
std
::
endl
;
timer
=
Timer
();
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
);
std
::
cout
<<
"greedy dissection "
<<
Timer
()
-
timer
<<
std
::
endl
;
blks
=
sep
=
0
;
for
(
INMOST_DATA_ENUM_TYPE
k
=
0
;
k
<
blocks
.
size
();
++
k
)
{
...
...
@@ -1359,7 +1359,7 @@ const double apert = 1.0e-8;
//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
,
INMOST_DATA_ENUM_TYPE
wend
,
...
...
@@ -1369,7 +1369,7 @@ const double apert = 1.0e-8;
interval
<
INMOST_DATA_ENUM_TYPE
,
INMOST_DATA_ENUM_TYPE
>&
localQ
,
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
;
ColumnInterval
(
wbeg
,
wend
,
Address
,
Entries
,
cbeg
,
cend
);
...
...
@@ -1379,24 +1379,25 @@ const double apert = 1.0e-8;
// std::cout << __FUNCTION__ << " row " << wbeg << ":" << wend << " col " << cbeg << ":" << cend << std::endl;
//~
timer = Timer();
PrepareGraph
(
wbeg
,
wend
,
Address
,
Entries
,
G_Address
,
G_Entries
)
;
PrepareGraphTranspose
(
wbeg
,
wend
,
G_Address
,
G_Entries
,
tG_Address
,
tG_Entries
);
// std::cout << "prepare tG time " << Timer() - timer << std::endl
;
//~
timer = Timer();
PrepareGraphProduct
(
wbeg
,
wend
,
G_Address
,
G_Entries
,
tG_Address
,
tG_Entries
,
pG_Address
,
pG_Entries
);
//
std::cout << "prepare pG time " << Timer() - timer << std::endl;
timer
=
Timer
();
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
)
;
std
::
cout
<<
"prepare tG time "
<<
Timer
()
-
timer
<<
std
::
endl
;
timer
=
Timer
();
PrepareGraphProduct
(
wbeg
,
wend
,
G_Address
,
G_Entries
,
tG_Address
,
tG_Entries
,
pG_Address
,
pG_Entries
);
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
);
std
::
cout
<<
"greedy dissection "
<<
Timer
()
-
timer
<<
std
::
endl
;
blks
=
sep
=
0
;
for
(
INMOST_DATA_ENUM_TYPE
k
=
0
;
k
<
blocks
.
size
();
++
k
)
{
if
(
blocks
[
k
].
separator
)
sep
+=
blocks
[
k
].
RowSize
();
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;
//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
,
...
...
@@ -1430,7 +1431,7 @@ const double apert = 1.0e-8;
bool
kway
=
(
kway_parts
>
1
);
// const int kway_parts = 4;
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;
...
...
@@ -4269,11 +4270,19 @@ const double apert = 1.0e-8;
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"
);
std
::
ofstream
file
(
"blocks_snd"
+
to_string
(
level_size
.
size
())
+
".txt"
);
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
.
close
();
blocks
.
pop_back
();
}
if
(
verbosity
>
1
)
...
...
Tests/solver_test002/main.cpp
View file @
e994644b
...
...
@@ -140,8 +140,8 @@ int main(int argc, char ** argv)
s
.
SetParameter
(
"pivot_condition"
,
"5"
);
s
.
SetParameter
(
"ddpq_tolerance"
,
"0.7"
);
mat
.
Save
(
"A.mtx"
);
b
.
Save
(
"b.mtx"
);
//
mat.Save("A.mtx");
//
b.Save("b.mtx");
t
=
Timer
();
s
.
SetMatrix
(
mat
);
// Compute the preconditioner for the original matrix
...
...
@@ -150,7 +150,7 @@ int main(int argc, char ** argv)
t
=
Timer
();
success
=
s
.
Solve
(
b
,
x
);
// Solve the linear system with the previously computted preconditioner
x
.
Save
(
"x.mtx"
);
//
x.Save("x.mtx");
BARRIER
if
(
!
rank
)
std
::
cout
<<
"solver: "
<<
Timer
()
-
t
<<
std
::
endl
;
iters
=
s
.
Iterations
();
// Get the number of iterations performed
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment