interplane.Get Omega
Read in your language

sqlite

[Ported from github.com/sqlite/sqlite] Fix bugs in and improve the interface to the ".check" command of the CLI.

Brought by drakestapleton

branch master Branches Tags History

sqlite / ext / vec1 / Makefile

63 lines · 1927 bytes Raw Blame History
1
2CC = gcc
3
4CFLAGS += -O3
5CFLAGS += -DNDEBUG
6CFLAGS += -Wextra -Werror
7CFLAGS += -g
8
9#CFLAGS += -DVEC1_THREADS=0
10#CFLAGS += -fprofile-arcs -ftest-coverage -fprofile-update=atomic -lgcov
11#CFLAGS += -fno-inline
12
13#ASANFLAGS = -fsanitize=address,undefined -fno-sanitize-recover=undefined
14#CFLAGS += $(ASANFLAGS)
15
16SIMDCFLAGS = -mavx2 -mfma
17
18SRC = vec1.c
19
20vec1.so: $(SRC)
21 $(CC) $(CFLAGS) $(SIMDCFLAGS) $(SRC) -o vec1.so -shared -fPIC -lm
22
23vec1.s: $(SRC)
24 $(CC) $(CFLAGS) -g0 $(SIMDCFLAGS) $(SRC) -S
25
26# Method for building multi-arch loadable libraries.
27#
28# To build a multi-arch library, the "vec1.c" file must be compiled twice.
29# Once with VEC1SIMD defined as SCALAR, and once as AVX2. The -DVEC1SMD=AVX2
30# compilation should pass flags to enable AVX2 support, the -DVEC1SMD=SCALAR
31# build should not pass any such flags. Then both objects are linked into
32# a single *.so file. The result works on hardware that supports AVX2, and
33# also on hardware that does not.
34#
35# Eventually, when AVX-512 support is added, there will be a third
36# compilation of vec1.c with flags to support AVX-512.
37#
38vec1multi.so: $(SRC)
39 $(CC) -DVEC1SIMD=SCALAR -c $(CFLAGS) $(SRC) -o vec1scalar.o -fPIC
40 $(CC) -DVEC1SIMD=AVX2 -c -mavx2 -mfma $(CFLAGS) $(SRC) -o vec1avx2.o -fPIC
41 $(CC) vec1scalar.o vec1avx2.o -o vec1multi.so -shared -fPIC
42
43vec1_faiss.so: vec1_faiss.cpp
44 g++ $(CFLAGS) vec1_faiss.cpp -o vec1_faiss.so -shared -fPIC -lfaiss
45
46vec1testscalar.so: $(SRC)
47 $(CC) $(CFLAGS) -DVEC1_TEST_SCALAR $(SRC) -o vec1testscalar.so -shared -fPIC -lm
48
49vec1.a: $(SRC)
50 $(CC) -DVEC1_STATIC $(CFLAGS) $(SIMDCFLAGS) -c $(SRC) -fPIC
51 ar rcs vec1.a vec1.o
52
53vec1_algo_test: tool/vec1_algo_test.c $(SRC)
54 $(CC) -I. $(CFLAGS) $(SIMDCFLAGS) tool/vec1_algo_test.c -o vec1_algo_test -lm
55
56clean:
57 rm -f vec1.so vec1_faiss.so vec1multi.so vec1testscalar.so
58 rm -f vec1.a
59 rm -f vec1.o vec1scalar.o vec1avx2.o
60 rm -f vec1.so-vec1.gcda vec1.so-vec1.gcno
61 rm -f vec1.s
62
63