forked from sstsimulator/sst-core
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add serialization for TimeVortex and several action types
Add CheckpointAction to trigger checkpoints
- Loading branch information
1 parent
2eba1c4
commit 796079e
Showing
40 changed files
with
800 additions
and
53 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
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,69 @@ | ||
// Copyright 2009-2023 NTESS. Under the terms | ||
// of Contract DE-NA0003525 with NTESS, the U.S. | ||
// Government retains certain rights in this software. | ||
// | ||
// Copyright (c) 2009-2023, NTESS | ||
// All rights reserved. | ||
// | ||
// This file is part of the SST software package. For license | ||
// information, see the LICENSE file in the top level directory of the | ||
// distribution. | ||
|
||
#include "sst_config.h" | ||
|
||
#include "sst/core/checkpointAction.h" | ||
|
||
#include "sst/core/component.h" | ||
#include "sst/core/mempoolAccessor.h" | ||
#include "sst/core/simulation_impl.h" | ||
#include "sst/core/stringize.h" | ||
#include "sst/core/timeConverter.h" | ||
#include "sst/core/warnmacros.h" | ||
|
||
#ifdef SST_CONFIG_HAVE_MPI | ||
DISABLE_WARN_MISSING_OVERRIDE | ||
#include <mpi.h> | ||
REENABLE_WARNING | ||
#endif | ||
|
||
namespace SST { | ||
|
||
CheckpointAction::CheckpointAction(Config* UNUSED(cfg), int this_rank, Simulation_impl* sim, TimeConverter* period) : | ||
Action(), | ||
rank(this_rank), | ||
m_period(period) | ||
{ | ||
sim->insertActivity(period->getFactor(), this); | ||
if ( (0 == this_rank) ) { lastTime = sst_get_cpu_time(); } | ||
// if( (0 == this_rank) ) { | ||
// sim->insertActivity( period->getFactor(), this ); | ||
// lastTime = sst_get_cpu_time(); | ||
// } | ||
} | ||
|
||
CheckpointAction::~CheckpointAction() {} | ||
|
||
void | ||
CheckpointAction::execute(void) | ||
{ | ||
Simulation_impl* sim = Simulation_impl::getSimulation(); | ||
const double now = sst_get_cpu_time(); | ||
|
||
Output& sim_output = sim->getSimulationOutput(); | ||
if ( 0 == rank ) { | ||
sim->getSimulationOutput().output( | ||
"# Simulation Checkpoint: Simulated Time %s (Real CPU time since last checkpoint %.5f seconds)\n", | ||
sim->getElapsedSimTime().toStringBestSI().c_str(), (now - lastTime)); | ||
|
||
lastTime = now; | ||
} | ||
|
||
sim->checkpoint(); | ||
|
||
SimTime_t next = sim->getCurrentSimCycle() + m_period->getFactor(); | ||
sim->insertActivity(next, this); | ||
|
||
// Print some resource usage | ||
} | ||
|
||
} // namespace SST |
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,55 @@ | ||
// Copyright 2009-2023 NTESS. Under the terms | ||
// of Contract DE-NA0003525 with NTESS, the U.S. | ||
// Government retains certain rights in this software. | ||
// | ||
// Copyright (c) 2009-2023, NTESS | ||
// All rights reserved. | ||
// | ||
// This file is part of the SST software package. For license | ||
// information, see the LICENSE file in the top level directory of the | ||
// distribution. | ||
|
||
#ifndef SST_CORE_CHECKPOINT_ACTION_H | ||
#define SST_CORE_CHECKPOINT_ACTION_H | ||
|
||
#include "sst/core/action.h" | ||
#include "sst/core/config.h" | ||
#include "sst/core/cputimer.h" | ||
#include "sst/core/output.h" | ||
#include "sst/core/sst_types.h" | ||
|
||
#include <set> | ||
|
||
namespace SST { | ||
|
||
class Simulation_impl; | ||
class TimeConverter; | ||
|
||
/** | ||
\class CheckpointAction | ||
A recurring event to trigger checkpoint generation | ||
*/ | ||
class CheckpointAction : public Action | ||
{ | ||
public: | ||
/** | ||
Create a new checkpoint object for the simulation core to initiate checkpoints | ||
*/ | ||
CheckpointAction(Config* cfg, int this_rank, Simulation_impl* sim, TimeConverter* period); | ||
~CheckpointAction(); | ||
|
||
NotSerializable(SST::CheckpointAction) // Going to have to fix this | ||
|
||
private : CheckpointAction() {}; | ||
CheckpointAction(const CheckpointAction&); | ||
|
||
void operator=(CheckpointAction const&); | ||
void execute(void) override; | ||
int rank; | ||
TimeConverter* m_period; | ||
double lastTime; | ||
}; | ||
|
||
} // namespace SST | ||
|
||
#endif // SST_CORE_CHECKPOINT_ACTION_H |
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
Oops, something went wrong.