Skip to content

Commit fde7daa

Browse files
authored
Fix missing useful time for CG if the algorithm did not succeed (#218)
This MR makes it so that the useful time for CG is reported, even if the algorithm failed (e.g., did not converge). It also includes a minor code style fix, and corresponds to the reported issue #166 on GitHub.
1 parent 136005d commit fde7daa

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

tests/smoke/conjugate_gradient.cpp

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -86,13 +86,12 @@ void grbProgram( const struct input &data_in, struct output &out ) {
8686

8787
// create local parser
8888
grb::utils::MatrixFileReader< ScalarType,
89-
std::conditional<
90-
(
91-
sizeof( grb::config::RowIndexType ) > sizeof( grb::config::ColIndexType )
92-
),
93-
grb::config::RowIndexType,
94-
grb::config::ColIndexType >::type
95-
> parser( data_in.filename, data_in.direct );
89+
std::conditional<
90+
(sizeof( grb::config::RowIndexType ) > sizeof( grb::config::ColIndexType )),
91+
grb::config::RowIndexType,
92+
grb::config::ColIndexType
93+
>::type
94+
> parser( data_in.filename, data_in.direct );
9695
assert( parser.m() == parser.n() );
9796
const size_t n = parser.n();
9897
out.times.io = timer.time();
@@ -193,9 +192,7 @@ void grbProgram( const struct input &data_in, struct output &out ) {
193192
}
194193
}
195194
const double time_taken = timer.time();
196-
if( rc == SUCCESS ) {
197-
out.times.useful = time_taken / static_cast< double >( out.rep );
198-
}
195+
out.times.useful = time_taken / static_cast< double >( out.rep );
199196
// print timing at root process
200197
if( grb::spmd<>::pid() == 0 ) {
201198
std::cout << "Time taken for a " << out.rep << " "

0 commit comments

Comments
 (0)