Skip to content

Commit 4bf5ddc

Browse files
Add GDof/s counter to output of cgpoisson test (#167)
* Add timer for CG iterations * Adjust text --------- Co-authored-by: Chris Richardson <[email protected]>
1 parent 01a5c7b commit 4bf5ddc

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/cgpoisson_problem.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,17 @@ cgpoisson::problem(std::shared_ptr<mesh::Mesh<double>> mesh, int order,
233233
sct.scatter_fwd_end<T>(remote_buffer, remote_data, unpack_fn, request);
234234
};
235235

236+
common::Timer tcg;
236237
int num_it = linalg::cg(*u.x(), b, action, 100, 1e-6);
238+
tcg.stop();
239+
tcg.flush();
240+
double time = std::chrono::duration<double>(tcg.elapsed()).count();
241+
double ndofs_global
242+
= static_cast<double>(V->dofmap()->index_map->size_global());
243+
double gdofs = (num_it * ndofs_global) / time / 1e9;
244+
245+
std::cout << "CG matrix-free action processed: " << gdofs << " Gdof/s\n";
246+
237247
return num_it;
238248
};
239249

0 commit comments

Comments
 (0)