Skip to content

Commit

Permalink
add ps in make
Browse files Browse the repository at this point in the history
  • Loading branch information
mli committed Jan 24, 2015
1 parent a20641b commit 5d84ff6
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 15 deletions.
33 changes: 21 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,16 @@ ifneq ($(USE_CUDA_PATH), NONE)
endif

ifeq ($(USE_BLAS), mkl)
LDFLAGS += -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -liomp5
else
LDFLAGS += -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -liomp5
else
CFLAGS += -DMSHADOW_USE_CBLAS=1 -DMSHADOW_USE_MKL=0
endif
ifeq ($(USE_BLAS), openblas)
LDFLAGS += -lopenblas
else ifeq ($(USE_BLAS), atlas)
LDFLAGS += -lcblas
LDFLAGS += -lcblas
else ifeq ($(USE_BLAS), blas)
LDFLAGS += -lblas
LDFLAGS += -lblas
endif

# setup opencv
Expand All @@ -65,11 +65,20 @@ ifneq ($(ADD_LDFLAGS), NONE)
LDFLAGS += $(ADD_LDFLAGS)
endif


ifeq ($(USE_DIST_PS),1)
CFLAGS+= -DMSHADOW_DIST_PS=1
ifeq ($(PS_PATH), NONE)
PS_PATH = ..
endif
ifeq ($(PS_THIRD_PATH), NONE)
PS_THIRD_PATH = $(PS_PATH)/third_party
endif
CFLAGS += -DMSHADOW_DIST_PS=1 -std=c++0x \
-I$(PS_PATH)/src -I$(PS_THIRD_PATH)/include
PS_LIB = $(addprefix $(PS_PATH)/build/, libps.a psmain.o) \
$(addprefix $(PS_THIRD_PATH)/lib/, libgflags.a libzmq.a libprotobuf.a \
libglog.a libz.a libsnappy.a)
else
CFLAGS+= -DMSHADOW_DIST_PS=0
CFLAGS+= -DMSHADOW_DIST_PS=0
endif

# specify tensor path
Expand All @@ -78,18 +87,18 @@ OBJ = layer_cpu.o updater_cpu.o nnet_cpu.o data.o main.o nnet_ps_server.o
CUOBJ = layer_gpu.o updater_gpu.o nnet_gpu.o
CUBIN =
ifeq ($(USE_CUDA), 0)
CUDEP =
CUDEP =
else
CUDEP = $(CUOBJ)
endif

.PHONY: clean all

ifeq ($(USE_DIST_PS), 1)
BIN += bin/cxxnet.ps
BIN=bin/cxxnet.ps
endif

all: $(BIN)
all: $(BIN)

layer_cpu.o layer_gpu.o: src/layer/layer_impl.cpp src/layer/layer_impl.cu\
src/layer/*.h src/layer/*.hpp src/utils/*.h src/plugin/*.hpp
Expand All @@ -104,10 +113,10 @@ nnet_ps_server.o: src/nnet/nnet_ps_server.cpp src/utils/*.h src/nnet/*.hpp src/n

data.o: src/io/data.cpp src/io/*.hpp

main.o: src/cxxnet_main.cpp
main.o: src/cxxnet_main.cpp

bin/cxxnet: src/local_main.cpp $(OBJ) $(CUDEP)
bin/cxxnet.ps: $(OBJ) $(CUDEP) libps.a libps_main.a
bin/cxxnet.ps: $(OBJ) $(CUDEP) $(PS_LIB)

$(BIN) :
$(CXX) $(CFLAGS) -o $@ $(filter %.cpp %.o %.c %.a, $^) $(LDFLAGS)
Expand Down
7 changes: 4 additions & 3 deletions make/config.mk
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#-----------------------------------------------------
# cxxnet: the configuration compile script
#
#
# This is the default configuration setup for cxxnet
# If you want to change configuration, do the following steps:
#
#
# - copy this file to the root folder
# - modify the configuration you want
# - type make or make -j n for parallel build
Expand Down Expand Up @@ -39,10 +39,11 @@ USE_BLAS = mkl

# whether compile with parameter server
USE_DIST_PS = 0
PS_PATH = NONE
PS_THRID_PATH = NONE

# the additional link flags you want to add
ADD_LDFLAGS = NONE

# the additional compile flags you want to add
ADD_CFLAGS = NONE

0 comments on commit 5d84ff6

Please sign in to comment.