diff --git a/Makefile b/Makefile index 9716f8149..e1b93d814 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ export CC = gcc export CXX = g++ export MPICXX = mpicxx export LDFLAGS= -Lrabit/lib -pthread -lm -export CFLAGS = -Wall -O3 -msse2 -Wno-unknown-pragmas -fPIC -Irabit/include +export CFLAGS = -Wall -O3 -msse2 -Wno-unknown-pragmas -fPIC ifeq ($(no_omp),1) CFLAGS += -DDISABLE_OPENMP @@ -23,47 +23,49 @@ OBJ = updater.o gbm.o io.o main.o MPIBIN = xgboost.mpi SLIB = wrapper/libxgboostwrapper.so -.PHONY: clean all mpi python Rpack librabit librabit_mpi +.PHONY: clean all mpi python Rpack all: $(BIN) $(OBJ) $(SLIB) $(MOCKBIN) mpi: $(MPIBIN) -# rules to get rabit library -librabit: - if [ ! -d rabit ]; then git clone https://github.com/tqchen/rabit.git; fi - cd rabit;make lib/librabit.a lib/librabit_mock.a; cd - -librabit_mpi: - if [ ! -d rabit ]; then git clone https://github.com/tqchen/rabit.git; fi - cd rabit;make lib/librabit_mpi.a; cd - - python: wrapper/libxgboostwrapper.so # now the wrapper takes in two files. io and wrapper part updater.o: src/tree/updater.cpp src/tree/*.hpp src/*.h src/tree/*.h src/utils/*.h gbm.o: src/gbm/gbm.cpp src/gbm/*.hpp src/gbm/*.h io.o: src/io/io.cpp src/io/*.hpp src/utils/*.h src/learner/dmatrix.h src/*.h main.o: src/xgboost_main.cpp src/utils/*.h src/*.h src/learner/*.hpp src/learner/*.h -xgboost.mpi: updater.o gbm.o io.o main.o librabit_mpi -xgboost.mock: updater.o gbm.o io.o main.o librabit -xgboost: updater.o gbm.o io.o main.o librabit -wrapper/libxgboostwrapper.so: wrapper/xgboost_wrapper.cpp src/utils/*.h src/*.h src/learner/*.hpp src/learner/*.h updater.o gbm.o io.o librabit +xgboost.mpi: updater.o gbm.o io.o main.o subtree/rabit/lib/librabit_mpi.a +xgboost.mock: updater.o gbm.o io.o main.o subtree/rabit/lib/librabit_mock.a +xgboost: updater.o gbm.o io.o main.o subtree/rabit/lib/librabit.a +wrapper/libxgboostwrapper.so: wrapper/xgboost_wrapper.cpp src/utils/*.h src/*.h src/learner/*.hpp src/learner/*.h updater.o gbm.o io.o subtree/rabit/lib/librabit.a + +# dependency on rabit +subtree/rabit/lib/librabit.a: subtree/rabit/src/engine.cc + cd subtree/rabit;make lib/librabit.a; cd - +subtree/rabit/lib/librabit_empty.a: subtree/rabit/src/engine_empty.cc + cd subtree/rabit;make lib/librabit_empty.a; cd - +subtree/rabit/lib/librabit_mock.a: subtree/rabit/src/engine_mock.cc + cd subtree/rabit;make lib/librabit_mock.a; cd - +subtree/rabit/lib/librabit_mpi.a: subtree/rabit/src/engine_mpi.cc + cd subtree/rabit;make lib/librabit_mpi.a; cd - $(BIN) : - $(CXX) $(CFLAGS) -o $@ $(filter %.cpp %.o %.c, $^) $(LDFLAGS) -lrabit + $(CXX) $(CFLAGS) -o $@ $(filter %.cpp %.o %.c %.cc %.a, $^) $(LDFLAGS) $(MOCKBIN) : - $(CXX) $(CFLAGS) -o $@ $(filter %.cpp %.o %.c, $^) $(LDFLAGS) -lrabit_mock + $(CXX) $(CFLAGS) -o $@ $(filter %.cpp %.o %.c %.cc %.a, $^) $(LDFLAGS) $(SLIB) : - $(CXX) $(CFLAGS) -fPIC -shared -o $@ $(filter %.cpp %.o %.c, $^) $(LDFLAGS) -lrabit + $(CXX) $(CFLAGS) -fPIC -shared -o $@ $(filter %.cpp %.o %.c %.a %.cc, $^) $(LDFLAGS) $(OBJ) : - $(CXX) -c $(CFLAGS) -o $@ $(firstword $(filter %.cpp %.c, $^) ) + $(CXX) -c $(CFLAGS) -o $@ $(firstword $(filter %.cpp %.c %.cc, $^) ) $(MPIOBJ) : $(MPICXX) -c $(CFLAGS) -o $@ $(firstword $(filter %.cpp %.c, $^) ) $(MPIBIN) : - $(MPICXX) $(CFLAGS) -o $@ $(filter %.cpp %.o %.c, $^) $(LDFLAGS) -lrabit_mpi + $(MPICXX) $(CFLAGS) -o $@ $(filter %.cpp %.o %.c %.cc %.a, $^) $(LDFLAGS) install: cp -f -r $(BIN) $(INSTALL_PATH) @@ -91,3 +93,4 @@ Rpack: clean: $(RM) $(OBJ) $(BIN) $(MPIBIN) $(MPIOBJ) $(SLIB) *.o */*.o */*/*.o *~ */*~ */*/*~ + cd subtree/rabit; make clean; cd - diff --git a/src/learner/evaluation-inl.hpp b/src/learner/evaluation-inl.hpp index 7334ad689..b45e5fd85 100644 --- a/src/learner/evaluation-inl.hpp +++ b/src/learner/evaluation-inl.hpp @@ -11,8 +11,7 @@ #include #include #include -// rabit library for synchronization -#include +#include "../sync/sync.h" #include "./evaluation.h" #include "./helper_utils.h" diff --git a/src/learner/learner-inl.hpp b/src/learner/learner-inl.hpp index 5e3622e4d..82a56e1fc 100644 --- a/src/learner/learner-inl.hpp +++ b/src/learner/learner-inl.hpp @@ -10,8 +10,7 @@ #include #include #include -// rabit library for synchronization -#include +#include "../sync/sync.h" #include "../utils/io.h" #include "../utils/base64.h" #include "./objective.h" diff --git a/src/sync/sync.h b/src/sync/sync.h new file mode 100644 index 000000000..aec5e2abd --- /dev/null +++ b/src/sync/sync.h @@ -0,0 +1,12 @@ +#ifndef XGBOOST_SYNC_H_ +#define XGBOOST_SYNC_H_ +/*! + * \file sync.h + * \brief the synchronization module of rabit + * redirects to subtree rabit header + * \author Tianqi Chen + */ +#include "../../subtree/rabit/include/rabit.h" +#endif // XGBOOST_SYNC_H_ + + diff --git a/src/tree/updater_basemaker-inl.hpp b/src/tree/updater_basemaker-inl.hpp index 851811eae..f8816dd6e 100644 --- a/src/tree/updater_basemaker-inl.hpp +++ b/src/tree/updater_basemaker-inl.hpp @@ -8,7 +8,7 @@ #include #include #include -#include +#include "../sync/sync.h" #include "../utils/random.h" #include "../utils/quantile.h" diff --git a/src/tree/updater_distcol-inl.hpp b/src/tree/updater_distcol-inl.hpp index 658fbe2b1..fe872971b 100644 --- a/src/tree/updater_distcol-inl.hpp +++ b/src/tree/updater_distcol-inl.hpp @@ -6,7 +6,7 @@ * and construct a tree * \author Tianqi Chen */ -#include +#include "../sync/sync.h" #include "../utils/bitmap.h" #include "../utils/io.h" #include "./updater_colmaker-inl.hpp" diff --git a/src/tree/updater_histmaker-inl.hpp b/src/tree/updater_histmaker-inl.hpp index 9f35d5731..b519f3480 100644 --- a/src/tree/updater_histmaker-inl.hpp +++ b/src/tree/updater_histmaker-inl.hpp @@ -7,7 +7,7 @@ */ #include #include -#include +#include "../sync/sync.h" #include "../utils/quantile.h" #include "../utils/group_data.h" #include "./updater_basemaker-inl.hpp" diff --git a/src/tree/updater_refresh-inl.hpp b/src/tree/updater_refresh-inl.hpp index 0285f0771..75ee3aadf 100644 --- a/src/tree/updater_refresh-inl.hpp +++ b/src/tree/updater_refresh-inl.hpp @@ -7,7 +7,7 @@ */ #include #include -#include +#include "../sync/sync.h" #include "./param.h" #include "./updater.h" #include "../utils/omp.h" diff --git a/src/tree/updater_sync-inl.hpp b/src/tree/updater_sync-inl.hpp index 0cbbb4eed..2aa534aa8 100644 --- a/src/tree/updater_sync-inl.hpp +++ b/src/tree/updater_sync-inl.hpp @@ -7,7 +7,7 @@ */ #include #include -#include +#include "../sync/sync.h" #include "./updater.h" namespace xgboost { diff --git a/src/xgboost_main.cpp b/src/xgboost_main.cpp index 94e6d6bc1..eae5347cd 100644 --- a/src/xgboost_main.cpp +++ b/src/xgboost_main.cpp @@ -4,7 +4,7 @@ #include #include #include -#include +#include "./sync/sync.h" #include "io/io.h" #include "utils/utils.h" #include "utils/config.h"