-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathMakefile
121 lines (86 loc) · 3.62 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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
.PHONY:all python clean mostlyclean test
CXX?=g++
CC?=gcc
ifndef DBG
DBG=-DNDEBUG
else
DBG=
endif
WARNINGS=-Wall -Wextra -Wno-char-subscripts \
-Wpointer-arith -Wwrite-strings -Wdisabled-optimization \
-Wformat -Wcast-align -Wno-unused-function -Wno-unused-parameter \
-pedantic -Wunused-variable\
-Wno-cast-align
FLAGS=-O3 -funroll-loops -pipe -march=native -Iinclude/sketch -I. -Iinclude/blaze -Ivec -Ipybind11/include -Iinclude -fpic -Wall $(WARNINGS) \
-fno-strict-aliasing
CXXFLAGS=$(FLAGS) -Wreorder \
CXXFLAGS+= $(EXTRA)
PYCONF?=python3-config
ifeq ($(shell uname),Darwin)
UNDEFSTR=-undefined dynamic_lookup
SLEEF_COMPILER=clang
else
UNDEFSTR=
SLEEF_COMPILER=$(CC)
endif
NVCC?=nvcc
EX=$(patsubst testsrc/%.cpp,%,$(wildcard testsrc/*.cpp))
all: $(EX)
setup_tests: $(EX) lztest
echo $(EX) lztest > tmpfiles.txt
STD?= -std=c++17
#CCBIN?=-ccbin=clang++
GPUFLAGS= $(CCBIN) -O3 -std=c++14 -Iinclude -I. -Xcompiler -march=native -Xcompiler -fopenmp -Iinclude/sketch \
-lz
INCLUDES=-I`$(PYCONF) --includes` -Ipybind11/include
SUF=`$(PYCONF) --extension-suffix`
OBJS=$(patsubst %.cpp,%$(SUF),$(wildcard *.cpp))
HEADERS=$(wildcard include/sketch/*.h)
SAN=-fsanitize=undefined -fsanitize=address
PYTHON?=python3
python: $(HEADERS) python/hll.cpp python/setup.py
cd python && $(PYTHON) setup.py install
mpython: python/hll.cpp hll.cpython.so
$(PYTHON) -c "import subprocess;import site; subprocess.check_call('cp "hll*`$(PYCONF) --extension-suffix`" %s' % site.getsitepackages()[0], shell=True)"
hpython: pybbmh.cpython.so
$(PYTHON) -c "import subprocess;import site; subprocess.check_call('cp pybbmh.py "*`$(PYCONF) --extension-suffix`" %s' % site.getsitepackages()[0], shell=True)"
%.cpython.so: %.cpp
$(CXX) $(UNDEFSTR) $(INCLUDES) -fopenmp -O3 -Wall $(CXXFLAGS) -shared $(STD) -fPIC `python3 -m pybind11 --includes` $< -o $*$(SUF) -lz && \
ln -fs $*$(SUF) $@
%.o: %.cpp
$(CXX) -c $(CXXFLAGS) $(STD) $< -o $@
%.o: %.c
$(CC) -c $(FLAGS) $< -o $@
%: examples/%.cpp kthread.o $(HEADERS)
$(CXX) $(CXXFLAGS) $(STD) -Wno-unused-parameter -pthread kthread.o $< -o $@ -lz # $(SAN)
%: testsrc/%.cpp kthread.o $(HEADERS)
$(CXX) $(STD) $(CXXFLAGS) -Wno-unused-parameter -pthread kthread.o $< -o $@ -lz # $(SAN)
heaptest: testsrc/heaptest.cpp kthread.o $(HEADERS)
$(CXX) $(CXXFLAGS) $(STD) -Wno-unused-parameter -pthread kthread.o $< -o $@ -lz # $(SAN)
divtest: testsrc/divtest.cpp kthread.o $(HEADERS)
$(CXX) $(CXXFLAGS) $(STD) -Wno-unused-parameter -pthread kthread.o $< -o $@ -lz # $(SAN)
%: src/%.cu $(wildcard include/sketch/cuda/*h)
$(NVCC) $< -o $@ $(GPUFLAGS)
#%.o: %.cu
# $(NVCC) $< -c -o $@ $(GPUFLAGS)
%: benchmark/%.cpp kthread.o $(HEADERS)
$(CXX) $(CXXFLAGS) $(STD) -Wno-unused-parameter -pthread kthread.o -DNDEBUG=1 $< -o $@ -lz
%_d: src/%.cpp kthread.o $(HEADERS)
$(CXX) $(CXXFLAGS) $(STD) -fsanitize=leak -fsanitize=undefined -Wno-unused-parameter -pthread kthread.o $< -o $@ -lz
lztest: testsrc/hlltest.cpp kthread.o $(HEADERS)
$(CXX) $(CXXFLAGS) $(STD) -Wno-unused-parameter -pthread kthread.o -DLZ_COUNTER $< -o $@ -lz
clean:
rm -f test.o test hll.o kthread.o *hll*cpython*so $(EX)
test:
bash ./run_tests.sh
lpf: lpcqf_test lpcqf_approx lpfp
PREFIX?=/usr/local
install: $(HEADERS)
install -d $(DESTDIR)$(PREFIX)/include/sketch/vec && \
install -d $(DESTDIR)$(PREFIX)/include/aesctr && \
install -m 644 $(HEADERS) $(DESTDIR)$(PREFIX)/include/sketch && \
install -m 644 $(wildcard include/aesctr/*.h) $(DESTDIR)$(PREFIX)/include/aesctr && \
install -m 644 $(wildcard include/vec/*.h) $(DESTDIR)$(PREFIX)/include/sketch/vec
#mctest: mctest.cpp ccm.h
#mctest_d: mctest.cpp ccm.h
mostlyclean: clean