forked from idaholab/moose
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test PerfGraphLivePrint refs idaholab#15444
- Loading branch information
Showing
8 changed files
with
131 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
//* This file is part of the MOOSE framework | ||
//* https://www.mooseframework.org | ||
//* | ||
//* All rights reserved, see COPYRIGHT for full restrictions | ||
//* https://github.com/idaholab/moose/blob/master/COPYRIGHT | ||
//* | ||
//* Licensed under LGPL 2.1, please see LICENSE for details | ||
//* https://www.gnu.org/licenses/lgpl-2.1.html | ||
|
||
#pragma once | ||
|
||
#include "FEProblem.h" | ||
|
||
/** | ||
* FEProblemBase derived class for testing out PerfGraph | ||
*/ | ||
class SlowProblem : public FEProblem | ||
{ | ||
public: | ||
static InputParameters validParams(); | ||
|
||
SlowProblem(const InputParameters & params); | ||
virtual void solve(); | ||
|
||
protected: | ||
unsigned int _seconds_to_sleep; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
//* This file is part of the MOOSE framework | ||
//* https://www.mooseframework.org | ||
//* | ||
//* All rights reserved, see COPYRIGHT for full restrictions | ||
//* https://github.com/idaholab/moose/blob/master/COPYRIGHT | ||
//* | ||
//* Licensed under LGPL 2.1, please see LICENSE for details | ||
//* https://www.gnu.org/licenses/lgpl-2.1.html | ||
|
||
#include "SlowProblem.h" | ||
|
||
#include "MooseApp.h" | ||
|
||
#include <thread> | ||
#include <chrono> | ||
|
||
registerMooseObject("MooseTestApp", SlowProblem); | ||
|
||
InputParameters | ||
SlowProblem::validParams() | ||
{ | ||
InputParameters params = FEProblem::validParams(); | ||
params.addRequiredParam<unsigned int>("seconds_to_sleep", "The number of seconds to sleep"); | ||
return params; | ||
} | ||
|
||
SlowProblem::SlowProblem(const InputParameters & params) | ||
: FEProblem(params), _seconds_to_sleep(getParam<unsigned int>("seconds_to_sleep")) | ||
{ | ||
} | ||
|
||
void | ||
SlowProblem::solve() | ||
{ | ||
{ | ||
TIME_SECTION("slow", 1, "Testing Slowness"); | ||
std::this_thread::sleep_for(std::chrono::seconds(_seconds_to_sleep)); | ||
} | ||
|
||
FEProblem::solve(); | ||
} |
49 changes: 49 additions & 0 deletions
49
test/tests/utils/perf_graph_live_print/perf_graph_live_print.i
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
[Mesh] | ||
type = GeneratedMesh | ||
dim = 2 | ||
nx = 10 | ||
ny = 10 | ||
[] | ||
|
||
[Variables] | ||
[u] | ||
[] | ||
[] | ||
|
||
[Kernels] | ||
[diff] | ||
type = Diffusion | ||
variable = u | ||
[] | ||
[] | ||
|
||
[BCs] | ||
[left] | ||
type = DirichletBC | ||
variable = u | ||
boundary = left | ||
value = 0 | ||
[] | ||
[right] | ||
type = DirichletBC | ||
variable = u | ||
boundary = right | ||
value = 1 | ||
[] | ||
[] | ||
|
||
[Problem] | ||
type = SlowProblem | ||
seconds_to_sleep = 4 | ||
[] | ||
|
||
[Executioner] | ||
type = Steady | ||
solve_type = 'PJFNK' | ||
petsc_options_iname = '-pc_type -pc_hypre_type' | ||
petsc_options_value = 'hypre boomeramg' | ||
[] | ||
|
||
[Outputs] | ||
exodus = true | ||
[] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
[Tests] | ||
[./test] | ||
type = RunApp | ||
input = perf_graph_live_print.i | ||
expect_out = "Testing Slowness" | ||
|
||
issues = '#15444' | ||
design = 'utils/PerfGraph.md' | ||
requirement = 'The system shall allow for timing sections of code and having automated print-outs when they take too long or use too much memory' | ||
[../] | ||
[] |