forked from poweic/libdnn
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
executable file
·78 lines (61 loc) · 1.78 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
CC=gcc
CXX=g++-4.6
CFLAGS=
NVCC=nvcc -arch=sm_21 -w #-Xcompiler "-Wall"
BOTON_UTIL_ROOT=tools/utility/
CUMATRIX_ROOT=tools/libcumatrix/
INCLUDE= -I include/ \
-I $(BOTON_UTIL_ROOT)/include/ \
-I $(CUMATRIX_ROOT)/include \
-I /usr/local/cuda/samples/common/inc/ \
-I /usr/local/cuda/include
CPPFLAGS= -std=c++0x $(CFLAGS) $(INCLUDE) #-Werror -Wall
SOURCES=cnn-utility.cu\
cnn.cpp\
dnn-utility.cu\
dnn.cpp\
utility.cpp\
rbm.cpp\
feature-transform.cpp\
dataset.cpp\
batch.cpp\
config.cpp
EXECUTABLES=dnn-train dnn-predict dnn-init cnn-train
.PHONY: debug all o3 ctags dump_nrv
all: $(EXECUTABLES) ctags
o3: CFLAGS+=-O3
o3: all
debug: CFLAGS+=-g -DDEBUG
debug: all
dump_nrv: NVCC+=-Xcompiler "-fdump-tree-nrv" all
dump_nrv: all
vpath %.h include/
vpath %.cpp src/
vpath %.cu src/
OBJ:=$(addprefix obj/, $(addsuffix .o,$(basename $(SOURCES))))
LIBRARY=-lpbar -lcumatrix
CUDA_LIBRARY=-lcuda -lcudart -lcublas
LIBRARY_PATH=-L$(BOTON_UTIL_ROOT)/lib/ -L$(CUMATRIX_ROOT)/lib -L/usr/local/cuda/lib64
test: test.cpp
g++ -std=c++0x $(INCLUDE) $(LIBRARY_PATH) -o test test.cpp -lpthread $(CUDA_LIBRARY)
$(EXECUTABLES): % : obj/%.o $(OBJ)
$(CXX) -o $@ $(CFLAGS) -std=c++0x $(INCLUDE) $^ $(LIBRARY_PATH) $(LIBRARY) $(CUDA_LIBRARY)
#%.o: %.cpp
# $(CXX) $(CFLAGS) -std=c++0x $(INCLUDE) -o $@ -c $^
# +==============================+
# +===== Other Phony Target =====+
# +==============================+
obj/%.o: %.cpp
$(CXX) $(CPPFLAGS) -std=c++0x -o $@ -c $<
obj/%.o: %.cu include/%.h
$(NVCC) $(CFLAGS) $(INCLUDE) -o $@ -c $<
obj/%.d: %.cpp
@$(CXX) -MM $(CPPFLAGS) $< > $@.$$$$; \
sed 's,\($*\)\.o[ :]*,obj/\1.o $@ : ,g' < $@.$$$$ > $@;\
rm -f $@.$$$$
-include $(addprefix obj/,$(subst .cpp,.d,$(SOURCES)))
.PHONY: ctags
ctags:
@ctags -R --langmap=C:+.cu *
clean:
rm -rf $(EXECUTABLES) obj/*