-
Notifications
You must be signed in to change notification settings - Fork 55
/
makefile.cuda
131 lines (98 loc) · 3.93 KB
/
makefile.cuda
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
SHELL = /bin/sh
CUDA_PATH = /usr/local/cuda
CUDA_BIN_PATH = $(CUDA_PATH)/bin
CUDA_LIB_PATH = $(CUDA_PATH)/lib64
CUDA_INCLUDE_PATH = $(CUDA_PATH)/include
NVCC = $(CUDA_BIN_PATH)/nvcc
NVCCFLAGS = -m64 -O3 -Xcompiler=-fopenmp -arch=all -Wno-deprecated-gpu-targets -I $(CUDA_INCLUDE_PATH)
NVCCEXTRAFLAGS = -DNDEBUG -DLIBBSC_CUDA_SUPPORT -DLIBBSC_SORT_TRANSFORM_SUPPORT -DLIBBSC_ALLOW_UNALIGNED_ACCESS -DLIBBSC_OPENMP_SUPPORT
CC = clang++
AR = ar
RANLIB = ranlib
CFLAGS = -g -Wall
# Comment out CFLAGS line below for compatability mode for 32bit file sizes
# (less than 2GB) and systems that have compilers that treat int as 64bit
# natively (ie: modern AIX)
CFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
# Comment out CFLAGS line below to disable optimizations
CFLAGS += -O3 -fomit-frame-pointer -fstrict-aliasing -ffast-math
# Comment out CFLAGS line below to disable AVX2 instruction set (performance will suffer)
CFLAGS += -mavx2
# Comment out CFLAGS line below to disable OpenMP optimizations
CFLAGS += -fopenmp -DLIBBSC_OPENMP_SUPPORT
# Comment out CFLAGS line below to enable debug output
CFLAGS += -DNDEBUG
# Comment out CFLAGS line below to disable Sort Transform
CFLAGS += -DLIBBSC_SORT_TRANSFORM_SUPPORT
# Comment out CFLAGS line below to disable unaligned memory access
CFLAGS += -DLIBBSC_ALLOW_UNALIGNED_ACCESS
# Comment out CFLAGS line below to disable CUDA acceleration
CFLAGS += -DLIBBSC_CUDA_SUPPORT
# Where you want bsc installed when you do 'make install'
PREFIX = /usr
OBJS = \
adler32.o \
libsais.o \
coder.o \
qlfc.o \
qlfc_model.o \
detectors.o \
preprocessing.o \
libbsc.o \
lzp.o \
platform.o \
st.o \
bwt.o \
st.cuda.o \
bwt.cuda.o \
all: libbsc.a bsc
bsc: libbsc.a bsc.cpp
$(CC) $(CFLAGS) bsc.cpp -o bsc -L. -L$(CUDA_LIB_PATH) -lbsc -lcudart
libbsc.a: $(OBJS)
rm -f libbsc.a
$(AR) cq libbsc.a $(OBJS)
@if ( test -f $(RANLIB) -o -f /usr/bin/ranlib -o \
-f /bin/ranlib -o -f /usr/ccs/bin/ranlib ) ; then \
echo $(RANLIB) libbsc.a ; \
$(RANLIB) libbsc.a ; \
fi
install: libbsc.a bsc
if ( test ! -d $(DESTDIR)$(PREFIX)/bin ) ; then mkdir -p $(DESTDIR)$(PREFIX)/bin ; fi
if ( test ! -d $(DESTDIR)$(PREFIX)/lib ) ; then mkdir -p $(DESTDIR)$(PREFIX)/lib ; fi
if ( test ! -d $(DESTDIR)$(PREFIX)/include ) ; then mkdir -p $(DESTDIR)$(PREFIX)/include ; fi
cp -f bsc $(DESTDIR)$(PREFIX)/bin/bsc
chmod a+x $(DESTDIR)$(PREFIX)/bin/bsc
cp -f libbsc/libbsc.h $(DESTDIR)$(PREFIX)/include
chmod a+r $(DESTDIR)$(PREFIX)/include/libbsc.h
cp -f libbsc.a $(DESTDIR)$(PREFIX)/lib
chmod a+r $(DESTDIR)$(PREFIX)/lib/libbsc.a
clean:
rm -f *.o libbsc.a bsc
adler32.o: libbsc/adler32/adler32.cpp
$(CC) $(CFLAGS) -c libbsc/adler32/adler32.cpp
libsais.o: libbsc/bwt/libsais/libsais.c
$(CC) $(CFLAGS) -c libbsc/bwt/libsais/libsais.c
coder.o: libbsc/coder/coder.cpp
$(CC) $(CFLAGS) -c libbsc/coder/coder.cpp
qlfc.o: libbsc/coder/qlfc/qlfc.cpp
$(CC) $(CFLAGS) -c libbsc/coder/qlfc/qlfc.cpp
qlfc_model.o: libbsc/coder/qlfc/qlfc_model.cpp
$(CC) $(CFLAGS) -c libbsc/coder/qlfc/qlfc_model.cpp
detectors.o: libbsc/filters/detectors.cpp
$(CC) $(CFLAGS) -c libbsc/filters/detectors.cpp
preprocessing.o: libbsc/filters/preprocessing.cpp
$(CC) $(CFLAGS) -c libbsc/filters/preprocessing.cpp
libbsc.o: libbsc/libbsc/libbsc.cpp
$(CC) $(CFLAGS) -c libbsc/libbsc/libbsc.cpp
lzp.o: libbsc/lzp/lzp.cpp
$(CC) $(CFLAGS) -c libbsc/lzp/lzp.cpp
platform.o: libbsc/platform/platform.cpp
$(CC) $(CFLAGS) -c libbsc/platform/platform.cpp
st.o: libbsc/st/st.cpp
$(CC) $(CFLAGS) -c libbsc/st/st.cpp
bwt.o: libbsc/bwt/bwt.cpp
$(CC) $(CFLAGS) -c libbsc/bwt/bwt.cpp
st.cuda.o: libbsc/st/st.cu
$(NVCC) $(NVCCFLAGS) $(NVCCEXTRAFLAGS) -c libbsc/st/st.cu -o st.cuda.o
bwt.cuda.o: libbsc/bwt/libcubwt/libcubwt.cu
$(NVCC) $(NVCCFLAGS) $(NVCCEXTRAFLAGS) -c libbsc/bwt/libcubwt/libcubwt.cu -o bwt.cuda.o