From e40047f9c207bedda38d5750bf8cfc36ba7a0ba4 Mon Sep 17 00:00:00 2001 From: tqchen Date: Sat, 20 Dec 2014 18:38:54 -0800 Subject: [PATCH] new mock test --- test/Makefile | 2 +- test/keepalive.sh | 4 ++-- test/test.mk | 3 ++- test/test_model_recover.cpp | 4 +++- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/test/Makefile b/test/Makefile index 3b5729b11..55e80d988 100644 --- a/test/Makefile +++ b/test/Makefile @@ -25,7 +25,7 @@ test_model_recover: test_model_recover.o $(RABIT_OBJ) test_local_recover: test_local_recover.o $(RABIT_OBJ) $(BIN) : - $(CXX) $(CFLAGS) -o $@ $(filter %.cpp %.o %.c %.cc, $^) $(LDFLAGS) -lrabit + $(CXX) $(CFLAGS) -o $@ $(filter %.cpp %.o %.c %.cc, $^) $(LDFLAGS) -lrabit_mock $(OBJ) : $(CXX) -c $(CFLAGS) -o $@ $(firstword $(filter %.cpp %.c %.cc, $^) ) diff --git a/test/keepalive.sh b/test/keepalive.sh index 854de0c33..c4df061a9 100755 --- a/test/keepalive.sh +++ b/test/keepalive.sh @@ -7,8 +7,8 @@ then fi nrep=0 echo ./$@ rabit_task_id=$OMPI_COMM_WORLD_RANK -until ./$@ rabit_task_id=$OMPI_COMM_WORLD_RANK repeat=$nrep; do +until ./$@ rabit_task_id=$OMPI_COMM_WORLD_RANK rabit_num_trial=$nrep; do sleep 1 nrep=$((nrep+1)) - echo ./$@ rabit_task_id=$OMPI_COMM_WORLD_RANK repeat=$nrep + echo ./$@ rabit_task_id=$OMPI_COMM_WORLD_RANK rabit_num_trial=$nrep done diff --git a/test/test.mk b/test/test.mk index a7b6ceb51..947e64d42 100644 --- a/test/test.mk +++ b/test/test.mk @@ -17,4 +17,5 @@ local_recover_10_10k: # this experiment test recovery with actually process exit, use keepalive to keep program alive model_recover_10_10k: - ../tracker/rabit_mpi.py 10 local keepalive.sh test_model_recover 10000 + ../tracker/rabit_mpi.py 10 local keepalive.sh test_model_recover 10000 mock=0,0,1,0 mock=1,1,1,0 + diff --git a/test/test_model_recover.cpp b/test/test_model_recover.cpp index f3693fa24..86c0faa75 100644 --- a/test/test_model_recover.cpp +++ b/test/test_model_recover.cpp @@ -11,6 +11,7 @@ using namespace rabit; namespace rabit { namespace test { inline void CallBegin(const char *fun, int ntrial, int iter) { + return; int rank = rabit::GetRank(); if (!strcmp(fun, "Allreduce::Sum")) { if (ntrial == iter && rank == 0) exit(-1); @@ -20,6 +21,7 @@ inline void CallBegin(const char *fun, int ntrial, int iter) { } } inline void CallEnd(const char *fun, int ntrial, int iter) { + return; int rank = rabit::GetRank(); if (!strcmp(fun, "Allreduce::Bcast")) { if (ntrial == iter && rand() % 10 == rank) exit(-1); @@ -129,7 +131,7 @@ int main(int argc, char *argv[]) { int ntrial = 0; for (int i = 1; i < argc; ++i) { int n; - if (sscanf(argv[i], "repeat=%d", &n) == 1) ntrial = n; + if (sscanf(argv[i], "rabit_num_trial=%d", &n) == 1) ntrial = n; } while (true) { try {