Skip to content

Commit

Permalink
More perfgraph registrations moving to new method idaholab#15444
Browse files Browse the repository at this point in the history
  • Loading branch information
friedmud committed Jul 1, 2020
1 parent 8d50a2e commit 8f94c94
Show file tree
Hide file tree
Showing 22 changed files with 52 additions and 138 deletions.
3 changes: 0 additions & 3 deletions framework/include/actions/Action.h
Expand Up @@ -243,9 +243,6 @@ class Action : public ConsoleStreamInterface,

/// Convenience reference to a problem this action works on
std::shared_ptr<FEProblemBase> & _problem;

/// Timers
PerfID _act_timer;
};

template <typename T>
Expand Down
4 changes: 0 additions & 4 deletions framework/include/actions/CouplingFunctorCheckAction.h
Expand Up @@ -29,8 +29,4 @@ class CouplingFunctorCheckAction : public Action

protected:
void act() override;

const PerfID _reinitializing_vectors_because_of_algebraic_ghosting_timer;
const PerfID _adding_relationship_managers_timer;
const PerfID _reiniting_nonlinear_system;
};
5 changes: 0 additions & 5 deletions framework/include/actions/SetupMeshAction.h
Expand Up @@ -35,9 +35,4 @@ class SetupMeshAction : public MooseObjectAction
* @return The new type of object that will be built.
*/
std::string modifyParamsForUseSplit(InputParameters & moose_object_params) const;

/// Timers
PerfID _setup_mesh_timer;
PerfID _set_mesh_base_timer;
PerfID _init_mesh_timer;
};
4 changes: 0 additions & 4 deletions framework/include/mesh/FileMesh.h
Expand Up @@ -47,8 +47,4 @@ class FileMesh : public MooseMesh
/// The requested dimension of the mesh. For some file meshes, this is not required may be implied
/// from the element type(s).
const unsigned int _dim;

/// Timers
const PerfID _read_mesh_timer;
};

6 changes: 0 additions & 6 deletions framework/include/multiapps/MultiApp.h
Expand Up @@ -440,12 +440,6 @@ class MultiApp : public MooseObject,

/// The solution from the end of the previous solve, this is cloned from the Nonlinear solution during restore
std::vector<std::unique_ptr<NumericVector<Real>>> _end_solutions;

private:
PerfID _perf_backup;
PerfID _perf_restore;
PerfID _perf_init;
PerfID _perf_reset_app;
};

template <>
Expand Down
Expand Up @@ -95,9 +95,4 @@ class PhysicsBasedPreconditioner : public MoosePreconditioner, public Preconditi
* to keep looking this thing up through it's name.
*/
std::vector<std::vector<SparseMatrix<Number> *>> _off_diag_mats;

/// Timers
PerfID _init_timer;
PerfID _apply_timer;
};

4 changes: 0 additions & 4 deletions framework/include/restart/RestartableDataIO.h
Expand Up @@ -136,10 +136,6 @@ class RestartableDataIO : public PerfGraphInterface
/// A vector of file handles, one per thread
std::vector<std::shared_ptr<std::ifstream>> _in_file_handles;

/// Timers
const PerfID _restart_es_timer;
const PerfID _restart_data_timer;

static constexpr auto RESTARTABLE_DATA_EXT = ".rd";
static constexpr auto ES_BINARY_EXT = ".xdr";
static constexpr auto ES_ASCII_EXT = ".xda";
Expand Down
11 changes: 0 additions & 11 deletions framework/include/samplers/Sampler.h
Expand Up @@ -271,15 +271,4 @@ class Sampler : public MooseObject,

/// Max number of entries for matrix returned by getNextLocalRow
const dof_id_type _limit_get_next_local_row;

///@{
/// PrefGraph timers
const PerfID _perf_get_global_samples;
const PerfID _perf_get_local_samples;
const PerfID _perf_get_next_local_row;
const PerfID _perf_sample_row;
const PerfID _perf_local_sample_matrix;
const PerfID _perf_sample_matrix;
const PerfID _perf_advance_generator;
///@}
};
3 changes: 0 additions & 3 deletions framework/include/systems/NonlinearSystem.h
Expand Up @@ -119,7 +119,4 @@ class NonlinearSystem : public NonlinearSystemBase

/// The number of scaling groups
std::size_t _num_scaling_groups;

/// Performance Timers
const PerfID _initial_residual_timer;
};
2 changes: 0 additions & 2 deletions framework/include/utils/RankMap.h
Expand Up @@ -56,8 +56,6 @@ class RankMap : ParallelObject, PerfGraphInterface
const std::vector<unsigned int> & rankHardwareIds() const { return _rank_to_hardware_id; }

protected:
const PerfID _construct_timer;

/// Map of hardware_id -> ranks on that node
std::unordered_map<unsigned int, std::vector<processor_id_type>> _hardware_id_to_ranks;

Expand Down
5 changes: 2 additions & 3 deletions framework/src/actions/Action.C
Expand Up @@ -81,15 +81,14 @@ Action::Action(InputParameters parameters)
_current_task(_awh.getCurrentTaskName()),
_mesh(_awh.mesh()),
_displaced_mesh(_awh.displacedMesh()),
_problem(_awh.problemBase()),
_act_timer(registerTimedSection("act", 4))
_problem(_awh.problemBase())
{
}

void
Action::timedAct()
{
TIME_SECTION(_act_timer);
TIME_SECTION("act", 4);
act();
}

Expand Down
14 changes: 7 additions & 7 deletions framework/src/actions/CouplingFunctorCheckAction.C
Expand Up @@ -30,10 +30,7 @@ CouplingFunctorCheckAction::validParams()
}

CouplingFunctorCheckAction::CouplingFunctorCheckAction(InputParameters parameters)
: Action(parameters),
_reinitializing_vectors_because_of_algebraic_ghosting_timer(registerTimedSection("reinitVectorsAlgebraic", 5, "Reiniting Vectors Because of Algebraic Ghosting")),
_adding_relationship_managers_timer(registerTimedSection("addRelationshipManagers", 5, "Adding Relationship Managers")),
_reiniting_nonlinear_system(registerTimedSection("nlSystemReinitCoupling", 5, "Reinitializing Nonlinear System Due To Coupling Functors"))
: Action(parameters)
{
_name = "coupling_functor_check";
}
Expand Down Expand Up @@ -99,7 +96,8 @@ CouplingFunctorCheckAction::act()
// If you didn't do the ghosting with your own actions, you're going to pay the price now.
// We have to reinit all the DofMaps so we can be sure that we've ghosted the necessary
// vector entries
TIME_SECTION(_reinitializing_vectors_because_of_algebraic_ghosting_timer);
TIME_SECTION(
"reinitVectorsAlgebraic", 5, "Reiniting Vectors Because of Algebraic Ghosting");

// Reassign the size because we're going to call addRelationshipManagers again for COUPLING
size = _app.relationshipManagers().size();
Expand All @@ -122,7 +120,7 @@ CouplingFunctorCheckAction::act()
addRelationshipManagers(coupling, RelationshipManager::oneLayerGhosting(coupling));
if (size != _app.relationshipManagers().size())
{
TIME_SECTION(_adding_relationship_managers_timer);
TIME_SECTION("addRelationshipManagers", 5, "Adding Relationship Managers"));

_app.attachRelationshipManagers(coupling);

Expand All @@ -135,7 +133,9 @@ CouplingFunctorCheckAction::act()
// DofMap::reinit, hence we have to call GhostingFunctor::dofmap_reinit ourselves in the
// call above
{
TIME_SECTION(_reiniting_nonlinear_system);
TIME_SECTION("nlSystemReinitCoupling",
5,
"Reinitializing Nonlinear System Due To Coupling Functors");

nl.system().reinit();
}
Expand Down
13 changes: 4 additions & 9 deletions framework/src/actions/SetupMeshAction.C
Expand Up @@ -97,12 +97,7 @@ SetupMeshAction::validParams()
return params;
}

SetupMeshAction::SetupMeshAction(InputParameters params) : MooseObjectAction(params),
_setup_mesh_timer(registerTimedSection("SetupMeshAction::act::setup_mesh", 1, "Setting Up Mesh", true)),
_set_mesh_base_timer(registerTimedSection("SetupMeshAction::act::set_mesh_base", 1, "Setting Mesh", true)),
_init_mesh_timer(registerTimedSection("SetupMeshAction::act::set_mesh_base", 1, "Initializing Mesh", true))

{}
SetupMeshAction::SetupMeshAction(InputParameters params) : MooseObjectAction(params) {}

void
SetupMeshAction::setupMesh(MooseMesh * mesh)
Expand Down Expand Up @@ -231,7 +226,7 @@ SetupMeshAction::act()
// Create the mesh object and tell it to build itself
if (_current_task == "setup_mesh")
{
TIME_SECTION(_setup_mesh_timer);
TIME_SECTION("SetupMeshAction::act::setup_mesh", 1, "Setting Up Mesh", true);

if (_app.masterMesh())
_mesh = _app.masterMesh()->safeClone();
Expand Down Expand Up @@ -284,7 +279,7 @@ SetupMeshAction::act()

else if (_current_task == "set_mesh_base")
{
TIME_SECTION(_set_mesh_base_timer);
TIME_SECTION("SetupMeshAction::act::set_mesh_base", 1, "Setting Mesh", true);

if (!_app.masterMesh() && !_mesh->hasMeshBase())
{
Expand All @@ -303,7 +298,7 @@ SetupMeshAction::act()

else if (_current_task == "init_mesh")
{
TIME_SECTION(_init_mesh_timer);
TIME_SECTION("SetupMeshAction::act::set_mesh_base", 1, "Initializing Mesh", true);

if (_app.masterMesh())
{
Expand Down
11 changes: 6 additions & 5 deletions framework/src/actions/SetupMeshCompleteAction.C
Expand Up @@ -35,10 +35,7 @@ SetupMeshCompleteAction::validParams()
return params;
}

SetupMeshCompleteAction::SetupMeshCompleteAction(InputParameters params)
: Action(params), _uniform_refine_timer(registerTimedSection("uniformRefine", 2, "Uniformly Refining"))
{
}
SetupMeshCompleteAction::SetupMeshCompleteAction(InputParameters params) : Action(params) {}

bool
SetupMeshCompleteAction::completeSetup(MooseMesh * mesh)
Expand Down Expand Up @@ -88,7 +85,7 @@ SetupMeshCompleteAction::act()
*/
if (_app.setFileRestart() == false && _app.isRecovering() == false)
{
TIME_SECTION(_uniform_refine_timer);
TIME_SECTION("uniformRefine", 2, "Uniformly Refining");

if (_mesh->uniformRefineLevel())
{
Expand All @@ -109,6 +106,8 @@ SetupMeshCompleteAction::act()
}
else if (_current_task == "delete_remote_elements_post_equation_systems_init")
{
TIME_SECTION("deleteRemoteElems", 2, "Deleting Remote Elements");

// We currently only trigger the needsRemoteDeletion flag if somebody has requested a late
// geometric ghosting functor and/or we have a displaced mesh. In other words, we almost never
// trigger this.
Expand All @@ -121,6 +120,8 @@ SetupMeshCompleteAction::act()
}
else
{
TIME_SECTION("completeSetup", 2, "Completing Mesh Setup");

// Prepare the mesh (may occur multiple times)
completeSetup(_mesh.get());

Expand Down
10 changes: 3 additions & 7 deletions framework/src/mesh/FileMesh.C
Expand Up @@ -33,16 +33,12 @@ FileMesh::validParams()
FileMesh::FileMesh(const InputParameters & parameters)
: MooseMesh(parameters),
_file_name(getParam<MeshFileName>("file")),
_dim(getParam<MooseEnum>("dim")),
_read_mesh_timer(registerTimedSection("readMesh", 2))
_dim(getParam<MooseEnum>("dim"))
{
}

FileMesh::FileMesh(const FileMesh & other_mesh)
: MooseMesh(other_mesh),
_file_name(other_mesh._file_name),
_dim(other_mesh._dim),
_read_mesh_timer(other_mesh._read_mesh_timer)
: MooseMesh(other_mesh), _file_name(other_mesh._file_name), _dim(other_mesh._dim)
{
}

Expand All @@ -57,7 +53,7 @@ FileMesh::safeClone() const
void
FileMesh::buildMesh()
{
TIME_SECTION(_read_mesh_timer);
TIME_SECTION("buildMesh", 2, "Reading Mesh");

getMesh().set_mesh_dimension(getParam<MooseEnum>("dim"));

Expand Down
19 changes: 5 additions & 14 deletions framework/src/multiapps/MultiApp.C
Expand Up @@ -213,18 +213,14 @@ MultiApp::MultiApp(const InputParameters & parameters)
_has_an_app(true),
_backups(declareRestartableDataWithContext<SubAppBackups>("backups", this)),
_cli_args(getParam<std::vector<std::string>>("cli_args")),
_keep_solution_during_restore(getParam<bool>("keep_solution_during_restore")),
_perf_backup(registerTimedSection("backup", 3)),
_perf_restore(registerTimedSection("restore", 3)),
_perf_init(registerTimedSection("init", 3)),
_perf_reset_app(registerTimedSection("resetApp", 3))
_keep_solution_during_restore(getParam<bool>("keep_solution_during_restore"))
{
}

void
MultiApp::init(unsigned int num)
{
TIME_SECTION(_perf_init);
TIME_SECTION("init", 3, "Initializing MultiApp");

_total_num_apps = num;
buildComm();
Expand Down Expand Up @@ -423,18 +419,15 @@ MultiApp::postExecute()
void
MultiApp::backup()
{
TIME_SECTION(_perf_backup);

_console << "Beginning backing up MultiApp " << name() << std::endl;
TIME_SECTION("backup", 3, "Backing Up MultiApp");
for (unsigned int i = 0; i < _my_num_apps; i++)
_backups[i] = _apps[i]->backup();
_console << "Finished backing up MultiApp " << name() << std::endl;
}

void
MultiApp::restore()
{
TIME_SECTION(_perf_restore);
TIME_SECTION("restore", 3, "Restoring MultiApp");

// Must be restarting / recovering so hold off on restoring
// Instead - the restore will happen in createApp()
Expand All @@ -461,10 +454,8 @@ MultiApp::restore()
}
}

_console << "Begining restoring MultiApp " << name() << std::endl;
for (unsigned int i = 0; i < _my_num_apps; i++)
_apps[i]->restore(_backups[i]);
_console << "Finished restoring MultiApp " << name() << std::endl;

// Now copy the latest solutions back for each subapp
if (_keep_solution_during_restore)
Expand Down Expand Up @@ -623,7 +614,7 @@ MultiApp::localApp(unsigned int local_app)
void
MultiApp::resetApp(unsigned int global_app, Real time)
{
TIME_SECTION(_perf_reset_app);
TIME_SECTION("resetApp", 3, "Resetting MultiApp");

Moose::ScopedCommSwapper swapper(_my_comm);

Expand Down
8 changes: 3 additions & 5 deletions framework/src/preconditioners/PhysicsBasedPreconditioner.C
Expand Up @@ -59,9 +59,7 @@ PhysicsBasedPreconditioner::validParams()
PhysicsBasedPreconditioner::PhysicsBasedPreconditioner(const InputParameters & params)
: MoosePreconditioner(params),
Preconditioner<Number>(MoosePreconditioner::_communicator),
_nl(_fe_problem.getNonlinearSystemBase()),
_init_timer(registerTimedSection("init", 2)),
_apply_timer(registerTimedSection("apply", 1))
_nl(_fe_problem.getNonlinearSystemBase())
{
unsigned int num_systems = _nl.system().n_vars();
_systems.resize(num_systems);
Expand Down Expand Up @@ -176,7 +174,7 @@ PhysicsBasedPreconditioner::addSystem(unsigned int var,
void
PhysicsBasedPreconditioner::init()
{
TIME_SECTION(_init_timer);
TIME_SECTION("init", 2, "Initializing PhysicsBasedPreconditioner");

// Tell libMesh that this is initialized!
_is_initialized = true;
Expand Down Expand Up @@ -248,7 +246,7 @@ PhysicsBasedPreconditioner::setup()
void
PhysicsBasedPreconditioner::apply(const NumericVector<Number> & x, NumericVector<Number> & y)
{
TIME_SECTION(_apply_timer);
TIME_SECTION("apply", 1, "Applying PhysicsBasedPreconditioner");

const unsigned int num_systems = _systems.size();

Expand Down

0 comments on commit 8f94c94

Please sign in to comment.