ESyS-Particle
4.0.1
|
#include <CheckPointController.h>
Public Member Functions | |
CheckPointController () | |
CheckPointController (const std::string &fileNamePrefix, int beginTime, int endTime, int timeInterval, bool writeThroughMaster=false) | |
virtual void | performCheckPoint (int currentTime) |
virtual void | performSnapShot (int currentTime) |
virtual void | issueCheckPointCmd (int currentTime) |
virtual void | issueCheckPointCmdWTM (int currentTime) |
virtual void | issueSnapShotCmd (int currentTime) |
virtual void | issueCheckPointLoadingCmd (const std::string &) |
bool | isCheckPoint (int time) |
void | setCheckPointParams (const std::string &fileNamePrefix, int beginTime, int endTime, int timeInterval, bool writeThroughMaster=false) |
std::string | getLatticeDataFileName (const std::string &fileNamePrefix, int timeStep, int rank) |
esys::lsm::StringVector | getLatticeDataFiles (int timeStep, int size) |
esys::lsm::StringVector | getLatticeDataFiles (int timeStep) |
void | set_is2d (bool do2d) |
void | setLsmGeoVersion (float version) |
void | setPeriodicDimensions (esys::lsm::BoolVector periodicDimensions) |
void | setGeometryInfo (const esys::lsm::GeometryInfo &geoInfo) |
void | setSpatialDomain (const esys::lsm::BoundingBox &bBox) |
esys::lsm::GeometryInfo | getGeometryInfo () const |
int | getNumTimeSteps () const |
void | setNumTimeSteps (int numTimeSteps) |
double | getTimeStepSize () const |
void | setTimeStepSize (double timeStepSize) |
bool | spatialDomainHasBeenSet () const |
MPI_Comm | getMpiComm () const |
void | setMpiComm (MPI_Comm mpiComm) |
Protected Attributes | |
MPI_Comm | m_mpiComm |
std::string | m_fileNamePrefix |
int | m_beginTime |
int | m_endTime |
int | m_timeInterval |
esys::lsm::GeometryInfo | m_geoInfo |
int | m_numTimeSteps |
double | m_timeStepSize |
bool | m_spatialDomainHasBeenSet |
bool | m_writeThroughMaster |
Controls the issue of check-pointing commands to slave processes.
CheckPointController::CheckPointController | ( | ) |
Default constructor.
Default parameters cause isCheckPoint to return false.
default constructor
CheckPointController::CheckPointController | ( | const std::string & | fileNamePrefix, |
int | beginTime, | ||
int | endTime, | ||
int | timeInterval, | ||
bool | writeThroughMaster = false |
||
) |
Instantiates and sets the parameters which determine when a check-point should occur.
esys::lsm::GeometryInfo CheckPointController::getGeometryInfo | ( | ) | const |
Returns geometry info.
Referenced by issueCheckPointCmd(), issueCheckPointCmdWTM(), and issueSnapShotCmd().
std::string CheckPointController::getLatticeDataFileName | ( | const std::string & | fileNamePrefix, |
int | timeStep, | ||
int | rank | ||
) |
Generate the filename for the checkpoint file to be written by a given worker
fileNamePrefix | global filename prefix |
timeStep | current time step |
rank | the MPI rank of the worker |
References CheckPointParams::getFileName().
Referenced by getLatticeDataFiles().
esys::lsm::StringVector CheckPointController::getLatticeDataFiles | ( | int | timeStep, |
int | size | ||
) |
Generate the filenames for the checkpoint files to be written by all workers
timeStep | current time step |
size | number of workers |
References getLatticeDataFileName(), and m_fileNamePrefix.
Referenced by getLatticeDataFiles(), issueCheckPointCmd(), issueCheckPointCmdWTM(), and issueSnapShotCmd().
esys::lsm::StringVector CheckPointController::getLatticeDataFiles | ( | int | timeStep | ) |
Generate the filenames for the checkpoint files to be written by all workers
timeStep | current time step |
References getLatticeDataFiles().
double CheckPointController::getTimeStepSize | ( | ) | const |
get time step size
Referenced by issueCheckPointCmd(), issueCheckPointCmdWTM(), and issueSnapShotCmd().
bool CheckPointController::isCheckPoint | ( | int | time | ) |
Returns whether specified time is a check-point time.
time | This value is checked against the checkpoint parameters. |
Referenced by performCheckPoint(), and performSnapShot().
|
virtual |
Issues the check-point command to slave processes.
currentTime | The check-point time. |
Broadcast checkpointing command to workers and write info file (*_0.txt)
currentTime | the current time step |
References CMPILCmdBuffer::broadcast(), CVarMPIBuffer::broadcast(), CheckPointParams::getFileName(), getGeometryInfo(), getLatticeDataFiles(), getTimeStepSize(), m_fileNamePrefix, and CMPIBarrier::wait().
Referenced by performCheckPoint().
|
virtual |
checkpointing with writing through master
currentTime | the current time step |
References CMPILCmdBuffer::broadcast(), CVarMPIBuffer::broadcast(), BasicCon::Debug(), TML_Comm::gather(), CheckPointParams::getFileName(), getGeometryInfo(), getLatticeDataFiles(), getTimeStepSize(), m_fileNamePrefix, and CMPIBarrier::wait().
Referenced by performCheckPoint().
|
virtual |
read meta-data and issue checkpoint loading command to worker processes
metafile_name | the name of the file with the meta-data |
References CMPILCmdBuffer::broadcast(), CVarMPIBuffer::broadcast(), BasicCon::Debug(), and CMPIBarrier::wait().
|
virtual |
save meta-data and issue snapshot command to worker processes
currentTime | The current time step. |
References CMPILCmdBuffer::broadcast(), CVarMPIBuffer::broadcast(), CheckPointParams::getFileName(), getGeometryInfo(), getLatticeDataFiles(), getTimeStepSize(), m_fileNamePrefix, and CMPIBarrier::wait().
Referenced by performSnapShot().
|
virtual |
Determines whether specified argument is a check-point time (see isCheckPoint). If currentTime is a check-point, issues commands to slave processes to perform check-point.
currentTime | Parameter used to determine whether a check point should occur. |
Issue checkpointing command, i.e. broadcast command via MPI to worker processes, if currentTime is a time at which a checkpoint needs to be taken
currentTime | the current time step |
References isCheckPoint(), issueCheckPointCmd(), issueCheckPointCmdWTM(), and m_writeThroughMaster.
|
virtual |
Issue snapshot command, i.e. broadcast command via MPI to worker processes, if currentTime is a time at which a snapshot needs to be taken
currentTime | the current time step |
References isCheckPoint(), and issueSnapShotCmd().
void CheckPointController::set_is2d | ( | bool | do2d | ) |
Set 2-D information to true if the particle data are two-dimensional; otherwise set to false.
References esys::lsm::GeometryInfo::set_is2d().
void CheckPointController::setCheckPointParams | ( | const std::string & | fileNamePrefix, |
int | beginTime, | ||
int | endTime, | ||
int | timeInterval, | ||
bool | writeThroughMaster = false |
||
) |
Sets the parameters which determine when a check-point should occur.
References m_fileNamePrefix, and m_writeThroughMaster.
void CheckPointController::setGeometryInfo | ( | const esys::lsm::GeometryInfo & | geoInfo | ) |
Sets the spatial extent in which particles are tracked.
void CheckPointController::setLsmGeoVersion | ( | float | version | ) |
Set the LSMGeometry version for use in geometry files.
References esys::lsm::GeometryInfo::setLsmGeoVersion().
void CheckPointController::setNumTimeSteps | ( | int | numTimeSteps | ) |
Sets the number of time steps.
void CheckPointController::setPeriodicDimensions | ( | esys::lsm::BoolVector | periodicDimensions | ) |
Set the periodicity of the x, y and z dimensions.
References esys::lsm::GeometryInfo::setPeriodicDimensions().
void CheckPointController::setSpatialDomain | ( | const esys::lsm::BoundingBox & | bBox | ) |
Sets geometry info.
References esys::lsm::GeometryInfo::setBBox().
void CheckPointController::setTimeStepSize | ( | double | timeStepSize | ) |
Sets the time step size.
bool CheckPointController::spatialDomainHasBeenSet | ( | ) | const |
return true if the spatial domain has been set, false otherwise
|
protected |
Prefix of check-point files.
Referenced by getLatticeDataFiles(), issueCheckPointCmd(), issueCheckPointCmdWTM(), issueSnapShotCmd(), and setCheckPointParams().
|
protected |
If set, pipe all write operations through master process. Useful on installations where only proc. 0 can write to files
Referenced by performCheckPoint(), and setCheckPointParams().