-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
57 lines (46 loc) · 1.47 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
#########################
# Variables
#########################
NVCC=/usr/local/cuda-10.2/bin/nvcc
BUILD=build
SRC=src
FLAGS=-std=c++11 -O3 $(shell pkg-config --cflags opencv4)
LIBS=$(shell pkg-config --libs opencv4)
#########################
# Main
#########################
predict: $(BUILD)/main.o $(BUILD)/util.o $(BUILD)/LeNet5_cpu.o $(BUILD)/LeNet5_cuda.o $(BUILD)/LeNet5.o
$(NVCC) $(FLAGS) $(LIBS) -o $@ $^
$(BUILD)/main.o: $(SRC)/main.cpp $(BUILD)/util.o $(BUILD)/LeNet5.o $(BUILD)/LeNet5_cpu.o $(BUILD)/LeNet5_cuda.o
$(NVCC) $(FLAGS) $(LIBS) -o $@ -c $<
$(BUILD)/util.o: $(SRC)/util.cpp
$(NVCC) $(FLAGS) $(LIBS) -o $@ -c $<
$(BUILD)/LeNet5_cpu.o: $(SRC)/LeNet5_cpu.cpp $(BUILD)/LeNet5.o
$(NVCC) $(FLAGS) $(LIBS) -o $@ -c $<
$(BUILD)/LeNet5_cuda.o: $(SRC)/LeNet5_cuda.cu $(BUILD)/LeNet5.o
$(NVCC) $(FLAGS) $(LIBS) -o $@ -c $<
$(BUILD)/LeNet5.o: $(SRC)/LeNet5.cpp
$(NVCC) $(FLAGS) $(LIBS) -o $@ -c $<
run_on_server: predict
mkdir -p result
condor_submit predict_b1.cmd
condor_submit predict_b128.cmd
#########################
# Hello World
#########################
hello_cpu: $(SRC)/hello.cpp
$(NVCC) $(FLAGS) $(LIBS) -o $@ $<
./$@
hello_cuda: $(SRC)/hello.cu
$(NVCC) $(FLAGS) $(LIBS) -o $@ $<
hello_run_on_server: hello_cuda
condor_submit $<.cmd
#########################
# Util
#########################
format:
clang-format -i -style=Google $(SRC)/*.cu $(SRC)/*.cpp
clean:
rm -rf hello_cuda hello_cpu predict result/* tmp/*.log tmp/*.bmp $(BUILD)/*.o
queue:
condor_q