@@ -384,17 +384,20 @@ int main(int argc, char **argv)
384
384
SNES snes ; /* Nonlinear solver */
385
385
Vec u ; /* Solutions */
386
386
AppCtx options ; /* options-defined work context */
387
+ PetscLogStage setup , gpu_copy ;
387
388
388
389
PetscFunctionBeginUser ;
389
390
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 );
390
396
PetscCall (ProcessOptions (PETSC_COMM_WORLD , & options ));
391
397
392
398
PetscBool second_solve = PETSC_FALSE ;
393
399
PetscOptionsGetBool (NULL , NULL , "-second_solve" , & second_solve , NULL );
394
400
395
- // Register the pflare types
396
- PCRegister_PFLARE ();
397
-
398
401
/* Primal system */
399
402
PetscCall (SNESCreate (PETSC_COMM_WORLD , & snes ));
400
403
PetscCall (CreateMesh (PETSC_COMM_WORLD , & options , & dm ));
@@ -414,9 +417,15 @@ int main(int argc, char **argv)
414
417
415
418
// Only solving a linear problem for now
416
419
PetscCall (SNESSetType (snes , SNESKSPONLY ));
417
-
418
420
PetscCall (SNESSetFromOptions (snes ));
421
+
422
+ PetscCall (PetscLogStagePush (setup ));
423
+ PetscCall (SNESSetUp (snes ));
424
+ PetscCall (PetscLogStagePop ());
425
+
426
+ PetscCall (PetscLogStagePush (gpu_copy ));
419
427
PetscCall (SNESSolve (snes , NULL , u ));
428
+ PetscCall (PetscLogStagePop ());
420
429
421
430
// Solve
422
431
// We set x to 1 rather than random as the vecrandom doesn't yet have a
0 commit comments