diff --git a/rabit-learn/kmeans/Makefile b/rabit-learn/kmeans/Makefile index 244d9afdf..bf8aaa84e 100644 --- a/rabit-learn/kmeans/Makefile +++ b/rabit-learn/kmeans/Makefile @@ -6,7 +6,7 @@ MPIBIN = kmeans.mpi OBJ = kmeans.o # common build script for programs -include ../common.mk +include ../make/common.mk # dependenies here kmeans.rabit: kmeans.o lib diff --git a/rabit-learn/linear/Makefile b/rabit-learn/linear/Makefile index 88f0a2c1a..a7427916b 100644 --- a/rabit-learn/linear/Makefile +++ b/rabit-learn/linear/Makefile @@ -6,7 +6,7 @@ MPIBIN = OBJ = linear.o # common build script for programs -include ../common.mk +include ../make/common.mk CFLAGS+=-fopenmp linear.o: linear.cc ../../src/*.h linear.h ../solver/*.h # dependenies here diff --git a/rabit-learn/common.mk b/rabit-learn/make/common.mk similarity index 78% rename from rabit-learn/common.mk rename to rabit-learn/make/common.mk index 349e74872..cc54dc7c2 100644 --- a/rabit-learn/common.mk +++ b/rabit-learn/make/common.mk @@ -1,13 +1,21 @@ # this is the common build script for rabit programs -# you do not have to use it -export CC = gcc -export CXX = g++ -export MPICXX = mpicxx +# you do not have to use it export LDFLAGS= -pthread -lm -L../../lib -lrt -export CFLAGS = -Wall -msse2 -Wno-unknown-pragmas -fPIC -I../../include +export CFLAGS = -Wall -msse2 -Wno-unknown-pragmas -fPIC -I../../include + +# setup opencv +ifeq ($(USE_HDFS),1) + CFLAGS+= -DRABIT_USE_HDFS=1 -I$(HDFS_HOME)/include + LDFLAGS+= -L$(HDFS_HOME)/lib/native -lhdfs +else + CFLAGS+= -DRABIT_USE_HDFS=0 +endif + .PHONY: clean all lib mpi + all: $(BIN) $(MOCKBIN) + mpi: $(MPIBIN) lib: @@ -15,6 +23,7 @@ lib: libmpi: cd ../..;make lib/librabit_mpi.a;cd - + $(BIN) : $(CXX) $(CFLAGS) -o $@ $(filter %.cpp %.o %.c %.cc, $^) -lrabit $(LDFLAGS) diff --git a/rabit-learn/make/config.mk b/rabit-learn/make/config.mk new file mode 100644 index 000000000..9324ca438 --- /dev/null +++ b/rabit-learn/make/config.mk @@ -0,0 +1,21 @@ +#----------------------------------------------------- +# rabit-learn: the configuration compile script +# +# This is the default configuration setup for rabit-learn +# If you want to change configuration, do the following steps: +# +# - copy this file to the root of rabit-learn folder +# - modify the configuration you want +# - type make or make -j n for parallel build +#---------------------------------------------------- + +# choice of compiler +export CC = gcc +export CXX = g++ +export MPICXX = mpicxx + +# whether use HDFS support during compile +USE_HDFS = 1 + +# home of hadoop +HDFS_HOME = $(HADOOP_HDFS_HOME)