normal state running ok
This commit is contained in:
@@ -26,12 +26,12 @@ void AllreduceRobust::Shutdown(void) {
|
||||
// need to sync the exec before we shutdown, do a pesudo check point
|
||||
// execute checkpoint, note: when checkpoint existing, load will not happen
|
||||
utils::Assert(RecoverExec(NULL, 0, ActionSummary::kCheckPoint, ActionSummary::kSpecialOp),
|
||||
"check point must return true");
|
||||
"Shutdown: check point must return true");
|
||||
// reset result buffer
|
||||
resbuf.Clear(); seq_counter = 0;
|
||||
// execute check ack step, load happens here
|
||||
utils::Assert(RecoverExec(NULL, 0, ActionSummary::kCheckAck, ActionSummary::kSpecialOp),
|
||||
"check ack must return true");
|
||||
"Shutdown: check ack must return true");
|
||||
AllreduceBase::Shutdown();
|
||||
}
|
||||
/*!
|
||||
@@ -201,9 +201,8 @@ void AllreduceRobust::CheckPoint(const utils::ISerializable *global_model,
|
||||
if (CheckAndRecover(TryCheckinLocalState(&local_rptr[new_version],
|
||||
&local_chkpt[new_version]))) break;
|
||||
}
|
||||
// run the ack phase
|
||||
utils::Assert(RecoverExec(NULL, 0, 0, ActionSummary::kLocalCheckAck),
|
||||
"check point must return true");
|
||||
// run the ack phase, can be true or false
|
||||
RecoverExec(NULL, 0, 0, ActionSummary::kLocalCheckAck);
|
||||
// switch pointer to new version
|
||||
local_chkpt_version = !local_chkpt_version;
|
||||
}
|
||||
@@ -678,7 +677,7 @@ AllreduceRobust::ReturnType
|
||||
AllreduceRobust::TryGetResult(void *sendrecvbuf, size_t size, int seqno, bool requester) {
|
||||
// if minimum sequence requested is local check point ack,
|
||||
// this means all nodes have finished local check point, directly return
|
||||
if (seqno == ActionSummary::kLocalCheckAck) return kSuccess;
|
||||
if (seqno == ActionSummary::kLocalCheckAck) return kSuccess;
|
||||
if (seqno == ActionSummary::kLocalCheckPoint) {
|
||||
// new version of local model
|
||||
int new_version = !local_chkpt_version;
|
||||
@@ -972,8 +971,8 @@ AllreduceRobust::TryCheckinLocalState(std::vector<size_t> *p_local_rptr,
|
||||
ring_prev, ring_next);
|
||||
if (succ != kSuccess) return succ;
|
||||
// update rptr
|
||||
rptr.resize(n + 1);
|
||||
for (int i = 1; i < n; ++i) {
|
||||
rptr.resize(n + 2);
|
||||
for (int i = 1; i <= n; ++i) {
|
||||
rptr[i + 1] = rptr[i] + sizes[i];
|
||||
}
|
||||
chkpt.resize(rptr.back());
|
||||
@@ -1013,7 +1012,7 @@ AllreduceRobust::RingPassing(void *sendrecvbuf_,
|
||||
LinkRecord *read_link,
|
||||
LinkRecord *write_link) {
|
||||
if (read_link == NULL || write_link == NULL || read_end == 0) return kSuccess;
|
||||
utils::Assert(write_end <= read_end, "RingPassing: boundary check1");
|
||||
utils::Assert(write_end <= read_end, "RingPassing: boundary check1, write_end=%lu, read_end=%lu", write_end, read_end);
|
||||
utils::Assert(read_ptr <= read_end, "RingPassing: boundary check2");
|
||||
utils::Assert(write_ptr <= write_end, "RingPassing: boundary check3");
|
||||
// take reference
|
||||
|
||||
12
src/mock.h
12
src/mock.h
@@ -30,14 +30,16 @@ public:
|
||||
rabit::Allreduce<OP>(sendrecvbuf, count);
|
||||
}
|
||||
|
||||
inline bool LoadCheckPoint(utils::ISerializable *p_model) {
|
||||
inline int LoadCheckPoint(utils::ISerializable *global_model,
|
||||
utils::ISerializable *local_model) {
|
||||
utils::Assert(verify(loadCheckpoint), "[%d] error when loading checkpoint", rank);
|
||||
return rabit::LoadCheckPoint(p_model);
|
||||
return rabit::LoadCheckPoint(global_model, local_model);
|
||||
}
|
||||
|
||||
inline void CheckPoint(const utils::ISerializable &model) {
|
||||
|
||||
inline void CheckPoint(const utils::ISerializable *global_model,
|
||||
const utils::ISerializable *local_model) {
|
||||
utils::Assert(verify(checkpoint), "[%d] error when checkpointing", rank);
|
||||
rabit::CheckPoint(model);
|
||||
rabit::CheckPoint(global_model, local_model);
|
||||
}
|
||||
|
||||
inline void Broadcast(std::string *sendrecv_data, int root) {
|
||||
|
||||
@@ -124,12 +124,14 @@ inline void Allreduce(DType *sendrecvbuf, size_t count) {
|
||||
engine::mpi::GetType<DType>(), OP::kType);
|
||||
}
|
||||
// load latest check point
|
||||
inline int LoadCheckPoint(utils::ISerializable *p_model) {
|
||||
return engine::GetEngine()->LoadCheckPoint(p_model);
|
||||
inline int LoadCheckPoint(utils::ISerializable *global_model,
|
||||
utils::ISerializable *local_model) {
|
||||
return engine::GetEngine()->LoadCheckPoint(global_model, local_model);
|
||||
}
|
||||
// checkpoint the model, meaning we finished a stage of execution
|
||||
inline void CheckPoint(const utils::ISerializable &model) {
|
||||
engine::GetEngine()->CheckPoint(&model);
|
||||
inline void CheckPoint(const utils::ISerializable *global_model,
|
||||
const utils::ISerializable *local_model) {
|
||||
engine::GetEngine()->CheckPoint(global_model, local_model);
|
||||
}
|
||||
// return the version number of currently stored model
|
||||
inline int VersionNumber(void) {
|
||||
|
||||
26
src/rabit.h
26
src/rabit.h
@@ -84,7 +84,12 @@ template<typename OP, typename DType>
|
||||
inline void Allreduce(DType *sendrecvbuf, size_t count);
|
||||
/*!
|
||||
* \brief load latest check point
|
||||
* \param p_model pointer to the model
|
||||
* \param global_model pointer to the globally shared model/state
|
||||
* when calling this function, the caller need to gauranttees that global_model
|
||||
* is the same in all nodes
|
||||
* \param local_model pointer to local model, that is specific to current node/rank
|
||||
* this can be NULL when no local model is needed
|
||||
*
|
||||
* \return the version number of check point loaded
|
||||
* if returned version == 0, this means no model has been CheckPointed
|
||||
* the p_model is not touched, user should do necessary initialization by themselves
|
||||
@@ -99,15 +104,24 @@ inline void Allreduce(DType *sendrecvbuf, size_t count);
|
||||
*
|
||||
* \sa CheckPoint, VersionNumber
|
||||
*/
|
||||
inline int LoadCheckPoint(utils::ISerializable *p_model);
|
||||
inline int LoadCheckPoint(utils::ISerializable *global_model,
|
||||
utils::ISerializable *local_model = NULL);
|
||||
/*!
|
||||
* \brief checkpoint the model, meaning we finished a stage of execution
|
||||
* every time we call check point, there is a version number which will increase by one
|
||||
*
|
||||
* \param p_model pointer to the model
|
||||
* \sa LoadCheckPoint, VersionNumber
|
||||
*/
|
||||
inline void CheckPoint(const utils::ISerializable &model);
|
||||
* \param global_model pointer to the globally shared model/state
|
||||
* when calling this function, the caller need to gauranttees that global_model
|
||||
* is the same in all nodes
|
||||
* \param local_model pointer to local model, that is specific to current node/rank
|
||||
* this can be NULL when no local state is needed
|
||||
* NOTE: local_model requires explicit replication of the model for fault-tolerance, which will
|
||||
* bring replication cost in CheckPoint function. global_model do not need explicit replication.
|
||||
* So only CheckPoint with global_model if possible
|
||||
* \sa LoadCheckPoint, VersionNumber
|
||||
*/
|
||||
inline void CheckPoint(const utils::ISerializable *global_model,
|
||||
const utils::ISerializable *local_model = NULL);
|
||||
/*!
|
||||
* \return version number of current stored model,
|
||||
* which means how many calls to CheckPoint we made so far
|
||||
|
||||
Reference in New Issue
Block a user