Skip to content

Commit 3a5cabc

Browse files
Setup logging
1 parent 9e31dfb commit 3a5cabc

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

tests/adv_diff_cg_supg.c

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -384,17 +384,20 @@ int main(int argc, char **argv)
384384
SNES snes; /* Nonlinear solver */
385385
Vec u; /* Solutions */
386386
AppCtx options; /* options-defined work context */
387+
PetscLogStage setup, gpu_copy;
387388

388389
PetscFunctionBeginUser;
389390
PetscCall(PetscInitialize(&argc, &argv, NULL, help));
391+
// Register the pflare types
392+
PCRegister_PFLARE();
393+
394+
PetscLogStageRegister("Setup", &setup);
395+
PetscLogStageRegister("GPU copy stage - triggered by a prelim KSPSolve", &gpu_copy);
390396
PetscCall(ProcessOptions(PETSC_COMM_WORLD, &options));
391397

392398
PetscBool second_solve= PETSC_FALSE;
393399
PetscOptionsGetBool(NULL, NULL, "-second_solve", &second_solve, NULL);
394400

395-
// Register the pflare types
396-
PCRegister_PFLARE();
397-
398401
/* Primal system */
399402
PetscCall(SNESCreate(PETSC_COMM_WORLD, &snes));
400403
PetscCall(CreateMesh(PETSC_COMM_WORLD, &options, &dm));
@@ -414,9 +417,15 @@ int main(int argc, char **argv)
414417

415418
// Only solving a linear problem for now
416419
PetscCall(SNESSetType(snes, SNESKSPONLY));
417-
418420
PetscCall(SNESSetFromOptions(snes));
421+
422+
PetscCall(PetscLogStagePush(setup));
423+
PetscCall(SNESSetUp(snes));
424+
PetscCall(PetscLogStagePop());
425+
426+
PetscCall(PetscLogStagePush(gpu_copy));
419427
PetscCall(SNESSolve(snes, NULL, u));
428+
PetscCall(PetscLogStagePop());
420429

421430
// Solve
422431
// We set x to 1 rather than random as the vecrandom doesn't yet have a

0 commit comments

Comments
 (0)