-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile.nmake
235 lines (175 loc) · 8.12 KB
/
Makefile.nmake
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
# This makefile has started failing when it calls NVCC:
# nvcc -arch sm_30 -m32 -g --compiler-options /MDd -Iprotobuf-2.6.0\vsprojects\include -D_SCL_SECURE_NO_WARNINGS -c test_compress_gpu.cu
# Internal error
# NMAKE : fatal error U1077: 'C:\CUDA\v6.5\bin\nvcc.EXE' : return code '0xc0000005'
# Stop.
# Possible solution: https://devtalk.nvidia.com/default/topic/384483/makefiles-and-nvcc/
# Appending " > nul" to each command line that calls nvcc fixes the problem.
# build all the tools that don't require CUDA
default: test_haar_cpu.exe test_compress_cpu.exe image_error.exe \
list_data.exe histogram.exe java
EXECS = test_haar_cpu.exe haar.exe test_compress_cpu.exe \
test_haar_thresh_quantUnif_cpu.exe test_haar_thresh_quantLog_cpu.exe \
normalize.exe test_rle.exe test_huffman.exe test_bit_stream.exe \
test_quant_count.exe test_compress_gpu.exe list_data.exe \
image_error.exe test_transform.exe test_lloyd.exe histogram.exe
all: $(EXECS) java
# build the tools that require CUDA
cuda: haar.exe test_compress_gpu.exe
java: WaveletSampleImage.class ImageDiff.class
oct: cudahaar.mex
# Set this to YES or NO, to select between a Debug or Release build
IS_DEBUG=YES
# IS_DEBUG=NO
!IF "$(IS_DEBUG)"=="YES"
BUILD=Debug
BUILD_FLAGS=/Zi /MDd
CL_OPT_FLAG=/MDd
CC_OPT_FLAG=-g
!ELSE
BUILD=Release
BUILD_FLAGS=/O2 /MD
CL_OPT_FLAG=/MD
CC_OPT_FLAG=-O2
!ENDIF
NVCC_ARCH = \
-gencode arch=compute_11,code=sm_11 \
-gencode arch=compute_20,code=sm_20 \
-gencode arch=compute_30,code=sm_30 \
-gencode arch=compute_35,code=sm_35
# enable one of these to generate code for just one generation of GPU
# (reduces compile time by 30%)
# NVCC_ARCH=-arch sm_20
NVCC_ARCH=-arch sm_30
NVCC_ARCH_SIZE = -m32
PROTOBUF_DIR = protobuf-2.6.0\vsprojects
PROTOBUF_LIB = $(PROTOBUF_DIR)\$(BUILD)\libprotobuf.lib
PROTOC = $(PROTOBUF_DIR)\$(BUILD)\protoc.exe
JAVAC = javac
NVCC = nvcc $(NVCC_OPT) $(NVCC_ARCH) $(NVCC_ARCH_SIZE) $(CC_OPT_FLAG) \
--compiler-options $(CL_OPT_FLAG) -I$(PROTOBUF_DIR)\include \
-D_SCL_SECURE_NO_WARNINGS
MATLAB_HOME = "c:\Program Files\MATLAB\R2014a\extern"
CC = cl /EHsc /nologo $(BUILD_FLAGS) -D_SCL_SECURE_NO_WARNINGS
HAAR_OBJS = haar.obj dwt_cpu.obj dwt_gpu.obj data_io.obj transpose_gpu.obj \
nixtimer.obj
haar.obj: haar.cu
$(NVCC) -c haar.cu > nul
dwt_cpu.obj: dwt_cpu.cc dwt_cpu.h
$(NVCC) -c dwt_cpu.cc > nul
dwt_gpu.obj: dwt_gpu.cu dwt_gpu.h
$(NVCC) -c dwt_gpu.cu > nul
data_io.obj: data_io.cc data_io.h
$(NVCC) -c data_io.cc > nul
transpose_gpu.obj: transpose_gpu.cu transpose_gpu.h
$(NVCC) -c transpose_gpu.cu > nul
nixtimer.obj: nixtimer.cc nixtimer.h
$(NVCC) -c nixtimer.cc > nul
haar.exe: $(HAAR_OBJS)
$(NVCC) $(HAAR_OBJS) -o $@ > nul
thresh_cpu.obj: thresh_cpu.cc thresh_cpu.h
$(NVCC) -c thresh_cpu.cc > nul
quant_unif_cpu.obj: quant_unif_cpu.cc quant_unif_cpu.h
$(NVCC) -c quant_unif_cpu.cc > nul
dquant_unif_cpu.obj: dquant_unif_cpu.cc dquant_unif_cpu.h
$(NVCC) -c dquant_unif_cpu.cc > nul
quant_log_cpu.obj: quant_log_cpu.cc quant_log_cpu.h
$(NVCC) -c quant_log_cpu.cc > nul
dquant_log_cpu.obj: dquant_log_cpu.cc dquant_log_cpu.h
$(NVCC) -c dquant_log_cpu.cc > nul
quant.obj: quant.h quant.cc
$(NVCC) -c quant.cc > nul
huffman.obj: huffman.h huffman.cc
$(NVCC) -c huffman.cc > nul
test_compress_common.obj: test_compress_common.cc test_compress_common.h
$(NVCC) -c test_compress_common.cc > nul
test_haar_cpu.exe: test_haar_cpu.cc dwt_cpu.cc dwt_cpu.h data_io.cc data_io.h \
nixtimer.cc nixtimer.h
$(CC) test_haar_cpu.cc dwt_cpu.cc data_io.cc nixtimer.cc
test_haar_thresh_quantUnif_cpu.exe: test_haar_thresh_quantUnif_cpu.cc dwt_cpu.cc dwt_cpu.h data_io.cc data_io.h \
nixtimer.cc nixtimer.h thresh_cpu.cc thresh_cpu.h quant_unif_cpu.cc quant_unif_cpu.h \
dquant_unif_cpu.cc dquant_unif_cpu.h quant.h quant.cc
$(CC) test_haar_thresh_quantUnif_cpu.cc dwt_cpu.cc data_io.cc nixtimer.cc thresh_cpu.cc quant_unif_cpu.cc dquant_unif_cpu.cc quant.cc
test_haar_thresh_quantLog_cpu.exe: test_haar_thresh_quantLog_cpu.cc dwt_cpu.cc dwt_cpu.h data_io.cc data_io.h \
nixtimer.cc nixtimer.h thresh_cpu.cc thresh_cpu.h quant_log_cpu.cc quant_log_cpu.h \
dquant_log_cpu.cc dquant_log_cpu.h quant.h quant.cc
$(CC) test_haar_thresh_quantLog_cpu.cc dwt_cpu.cc data_io.cc nixtimer.cc thresh_cpu.cc quant_log_cpu.cc dquant_log_cpu.cc quant.cc
LLOYD_INC=/IOctave/LloydsAlgorithm/src/c++
# aliases
test_compress: test_compress_cpu.exe test_compress_gpu.exe
test_compress_cpu: test_compress_cpu.exe
test_compress_gpu: test_compress_gpu.exe
test_compress_cpu.exe: test_compress_cpu.cc \
bit_stack.h bit_stream.h \
data_io.h data_io.cc \
dwt_cpu.h dwt_cpu.cc \
huffman.cc huffman.h \
Octave/LloydsAlgorithm/src/c++/lloyds.cpp \
Octave/LloydsAlgorithm/src/c++/lloyds.h \
nixtimer.h nixtimer.cc \
quant.h quant.cc \
rle.h \
test_compress_common.h test_compress_common.cc \
thresh_cpu.h thresh_cpu.cc \
wavelet_compress.pb.h wavelet_compress.pb.cc
$(CC) /I$(PROTOBUF_DIR)\include $(LLOYD_INC) \
test_compress_cpu.cc test_compress_common.cc \
dwt_cpu.cc data_io.cc nixtimer.cc thresh_cpu.cc \
quant.cc wavelet_compress.pb.cc \
Octave/LloydsAlgorithm/src/c++/lloyds.cpp huffman.cc \
$(PROTOBUF_DIR)\$(BUILD)\libprotobuf.lib
test_compress_gpu.obj: test_compress_gpu.cu wavelet_compress.pb.h
$(NVCC) -c test_compress_gpu.cu > nul
TEST_COMPRESS_GPU_OBJS=test_compress_gpu.obj test_compress_common.obj \
dwt_cpu.obj dwt_gpu.obj data_io.obj transpose_gpu.obj nixtimer.obj \
wavelet_compress.pb.obj quant.obj huffman.obj
test_compress_gpu.exe: $(TEST_COMPRESS_GPU_OBJS)
$(NVCC) $(TEST_COMPRESS_GPU_OBJS) $(PROTOBUF_LIB) -o $@ > nul
proto: wavelet_compress.pb.h
wavelet_compress.pb.h: wavelet_compress.proto
$(PROTOC) wavelet_compress.proto --cpp_out=.
wavelet_compress.pb.obj: wavelet_compress.pb.h wavelet_compress.pb.cc
$(NVCC) -c wavelet_compress.pb.cc > nul
test_transform.exe: test_transform.cu
$(NVCC) test_transform.cu -o test_transform.exe > nul
test_lloyd.exe: test_lloyd.cc Octave/LloydsAlgorithm/src/c++/lloyds.cpp Octave/LloydsAlgorithm/src/c++/lloyds.h
$(CC) $(LLOYD_INC) test_lloyd.cc Octave/LloydsAlgorithm/src/c++/lloyds.cpp
test_bit_stream.exe: test_bit_stream.cc bit_stream.h nixtimer.h nixtimer.cc
$(CC) test_bit_stream.cc nixtimer.cc
normalize.exe: normalize.cc data_io.cc data_io.h
$(CC) normalize.cc data_io.cc
image_error.exe: image_error.cc data_io.cc data_io.h
$(CC) image_error.cc data_io.cc
histogram.exe: histogram.cc data_io.cc data_io.h
$(CC) histogram.cc data_io.cc
test_rle.exe: test_rle.cc rle.h huffman.h huffman.cc data_io.cc
$(CC) test_rle.cc data_io.cc huffman.cc
test_huffman.exe: test_huffman.cc huffman.cc huffman.h
$(CC) test_huffman.cc huffman.cc
test_quant_count.exe: test_quant_count.cc quant_count.h quant_count.cc quant.h \
quant.cc thresh_cpu.cc quant_unif_cpu.cc quant_log_cpu.cc \
dquant_unif_cpu.cc dquant_log_cpu.cc
$(CC) test_quant_count.cc quant_count.cc quant.cc \
data_io.cc thresh_cpu.cc quant_unif_cpu.cc quant_log_cpu.cc \
dquant_unif_cpu.cc dquant_log_cpu.cc nixtimer.cc
test_wavelet.exe: test_wavelet.cc wavelet.cc wavelet.h wavelet_compress.pb.cc nixtimer.cc
$(CC) /I$(PROTOBUF_DIR)\include test_wavelet.cc wavelet.cc wavelet_compress.pb.cc nixtimer.cc $(PROTOBUF_DIR)\$(BUILD)\libprotobuf.lib
list_data.exe: list_data.cc data_io.cc data_io.h
$(CC) list_data.cc data_io.cc
convert: WaveletSampleImage.class
java: WaveletSampleImage.class ImageDiff.class
WaveletSampleImage.class: WaveletSampleImage.java
$(JAVAC) WaveletSampleImage.java
ImageDiff.class: ImageDiff.java
$(JAVAC) ImageDiff.java
mat2cube.exe: mat2cube.cc cubelet_file.cc cubelet_file.h wavelet.cc wavelet.h \
wavelet_compress.pb.cc wavelet_compress.pb.h
$(CC) /I$(MATLAB_HOME)\include /I$(PROTOBUF_DIR)\include \
mat2cube.cc cubelet_file.cc wavelet.cc wavelet_compress.pb.cc \
protobuf-2.6.0-save-vs2012\vsprojects\x64\$(BUILD)\libprotobuf.lib \
/link /OUT:mat2cube.exe \
/DEFAULTLIB:$(MATLAB_HOME)\lib\win64\microsoft\libmat.lib \
/DEFAULTLIB:$(MATLAB_HOME)\lib\win64\microsoft\libmx.lib
clean:
del *.class *.obj *.o *.exp *.lib *.pdb *.ilk *.idb *~ \
wavelet_compress.pb.h wavelet_compress.pb.cc $(EXECS)