-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
104 lines (75 loc) · 2.21 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
CC=gcc
CXX=g++
CFLAGS=-O3 -Wall -Wextra -std=c99
LDLIBS=-lm -fopenmp
OBJDIR=obj
NVCC=nvcc
CUFLAGS=-O3
CULDLIBS= -lcusolver -lm -lcudart -lcuda
CULINK=-L/usr/local/cuda/lib64
CUOBJDIR=cuobj
BINDIR=bin
all: MODS=-DINCLUDE_NOSM
cpu_only: MODS=-DCPU_ONLY
gpu_only: MODS=-DGPU_ONLY
gpu_with_nosm: MODS=-DGPU_ONLY -DINCLUDE_NOSM
vpath %.c source source/svd tests
vpath %.h source source/svd
vpath %.cu source
objects=$(addprefix $(OBJDIR)/, \
algebra.o \
matrix.o \
mean_shift.o \
svd_double.o \
demo.o \
utils.o )
cuda_objects=$(addprefix $(CUOBJDIR)/, \
cuda_algebra.o \
cuda_mean_shift.o \
cuda_mean_shift_nosm.o)
all: $(objects) $(cuda_objects) | $(BINDIR)
$(CC) $(objects) $(cuda_objects) -o $(BINDIR)/demo_mean_shifter $(CFLAGS) \
$(CULINK) $(CULDLIBS) $(LDLIBS) $(MODS)
cpu_only: $(objects) | $(BINDIR)
$(CC) $(objects) -o $(BINDIR)/cpu_demo_mean_shifter $(CFLAGS) $(LDLIBS) $(MODS)
gpu_only: $(objects) $(cuda_objects) | $(BINDIR)
$(CC) $(objects) $(cuda_objects) -o $(BINDIR)/gpu_demo_mean_shifter $(CFLAGS) \
$(CULINK) $(CULDLIBS) $(LDLIBS) $(MODS)
gpu_with_nosm: $(objects) $(cuda_objects) | $(BINDIR)
$(CC) $(objects) $(cuda_objects) -o $(BINDIR)/gpu_demo_mean_shifter_nosm $(CFLAGS) \
$(CULINK) $(CULDLIBS) $(LDLIBS) $(MODS)
$(OBJDIR)/%.o : %.c | $(OBJDIR)
$(CC) $< -c -o $@ $(CFLAGS) $(MODS)
$(OBJDIR)/demo.o : demo.c FORCE
$(CC) $< -c -o $@ $(CFLAGS) $(MODS)
$(CUOBJDIR)/%.o : %.cu | $(CUOBJDIR)
$(NVCC) $< -c -o $@ $(CUFLAGS) $(CULDLIBS)
$(OBJDIR):
mkdir $(OBJDIR)
$(CUOBJDIR):
mkdir $(CUOBJDIR)
$(BINDIR):
mkdir $(BINDIR)
clean:
rm $(OBJDIR)/*.o
rm $(CUOBJDIR)/*.o
purge: clean
rm bin/*
run:
./$(BINDIR)/demo_mean_shifter datasets/r15.karas 1.0
run_cpu:
./$(BINDIR)/cpu_demo_mean_shifter datasets/r15.karas 1.0
run_gpu:
./$(BINDIR)/gpu_demo_mean_shifter datasets/r15.karas 1.0
run_gpu_all:
./$(BINDIR)/gpu_demo_mean_shifter_nosm datasets/r15.karas 1.0
runp:
./$(BINDIR)/demo_mean_shifter $(data) $(h)
runp_cpu:
./$(BINDIR)/cpu_demo_mean_shifter $(data) $(h)
runp_gpu:
./$(BINDIR)/gpu_demo_mean_shifter $(data) $(h)
runp_gpu_all:
./$(BINDIR)/gpu_demo_mean_shifter_nosm $(data) $(h)
.PHONY: all cpu_only gpu_only gpu_with_nosm clean purge test FORCE
FORCE: