Skip to content

Commit a5ad9ad

Browse files
nkoukpaizanpelesh
authored andcommitted
Add benchmark timing for CPU-only evaluation.
1 parent 580192c commit a5ad9ad

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

tests/unit/test_ineqjac_gpu.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,23 @@ int main(int argc, char **argv) {
332332
#endif
333333
}
334334

335+
/* --- PETSc path: CPU compute only --- */
336+
{
337+
auto t0 = std::chrono::high_resolution_clock::now();
338+
339+
for (int iter = 0; iter < niters; iter++) {
340+
ierr = (*opflow->modelops.computeinequalityconstraintjacobian)(
341+
opflow, opflow->X, opflow->Jac_Gi);
342+
}
343+
344+
auto t1 = std::chrono::high_resolution_clock::now();
345+
346+
double petsc_us =
347+
std::chrono::duration<double, std::micro>(t1 - t0).count() / niters;
348+
std::cout << " PETSc path (compute only): " << petsc_us
349+
<< " us/iter" << std::endl;
350+
}
351+
335352
/* --- GPU path: RAJA kernels, no copies --- */
336353
{
337354
double *bench_dev;

0 commit comments

Comments
 (0)