change in interface, seems resetlink is still bad

This commit is contained in:
tqchen
2014-12-01 21:39:51 -08:00
parent b76cd5858c
commit 255218a2f3
8 changed files with 128 additions and 40 deletions

View File

@@ -11,7 +11,7 @@ else
endif
# specify tensor path
BIN = test_allreduce test_recover
BIN = test_allreduce test_recover test_model_recover
OBJ = engine_base.o engine_robust.o engine.o
.PHONY: clean all
@@ -23,6 +23,7 @@ engine.o: ../src/engine.cc ../src/*.h
engine_robust.o: ../src/engine_robust.cc ../src/*.h
test_allreduce: test_allreduce.cpp ../src/*.h $(OBJ)
test_recover: test_recover.cpp ../src/*.h $(OBJ)
test_model_recover: test_model_recover.cpp ../src/*.h $(OBJ)
$(BIN) :
$(CXX) $(CFLAGS) $(LDFLAGS) -o $@ $(filter %.cpp %.o %.c %.cc, $^)

View File

@@ -70,18 +70,16 @@ inline void TestBcast(test::Mock &mock, size_t n, int root, int ntrial) {
// dummy model
class Model : public rabit::utils::ISerializable {
public:
// iterations
int iter;
// load from stream
virtual void Load(rabit::utils::IStream &fi) {
fi.Read(&iter, sizeof(iter));
// do nothing
}
/*! \brief save the model to the stream */
virtual void Save(rabit::utils::IStream &fo) const {
fo.Write(&iter, sizeof(iter));
// do nothing
}
virtual void InitModel(void) {
iter = 0;
// do nothing
}
};
@@ -101,7 +99,7 @@ int main(int argc, char *argv[]) {
int ntrial = 0;
while (true) {
try {
if (!rabit::LoadCheckPoint(&model)) {
if (rabit::LoadCheckPoint(&model) == 0) {
model.InitModel();
}
utils::LogPrintf("[%d/%d] start at %s\n", rank, ntrial, name.c_str());