-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMakefile
66 lines (52 loc) · 1.55 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
# common flags
ARFLAGS=-fPIC
COMMONFLAGS=-std=c++11 -O3
########### Intel compiler ###################
CC=icc
CXX = icpc
### Enable vectorization support
## Intel Xeon Phi processor -> -xMIC_AVX512
## Intel Xeon processor (HSW, BDW) -> -xCORE_AVX2
## Intel Xeon processor (SNB, IVB) -> -xAVX
VECFLAG=-xMIC_AVX512
CXXFLAGS=$(COMMONFLAGS) $(VECFLAG) -qopenmp
########### GCC (> 4.9.1) ####################
#CC=gcc
#CXX = g++
#
#### Enable vectorization support
### Intel Xeon Phi processor -> -mavx512f -mavx512cd -mavx512pf
### Intel Xeon processor (HSW, BDW) -> -mavx2
### Intel Xeon processor (SNB, IVB) -> -mavx
#VECFLAG=-mavx512f -mavx512cd -mavx512pf
#
#CXXFLAGS=$(COMMONFLAGS) $(VECFLAG) -fopenmp -ffast-math
#
#############################################
# Do not change these two
LIBDIR=lib
SRCDIR=src
ARCHIVE=$(LIBDIR)/libcfxkmeans.a
SETUPFILE=setup.py
OBJECTS=$(LIBDIR)/cfxkmeans.o\
$(LIBDIR)/cfxkmeans-hamerly.o
default: $(ARCHIVE)
all: $(ARCHIVE) python-build
$(ARCHIVE): mkdirlib $(OBJECTS)
ar rvs $(ARCHIVE) $(OBJECTS)
lib/cfxkmeans.o: src/cfxkmeans.cc
$(CXX) -c $(ARFLAGS) $(CXXFLAGS) -o "$@" "$<"
lib/%.o: src/%.cc
$(CXX) -c $(ARFLAGS) $(CXXFLAGS) -DDTYPE=float -o "$@"-sp "$<"
$(CXX) -c $(ARFLAGS) $(CXXFLAGS) -DDTYPE=double -o "$@"-dp "$<"
ld -r "$@-dp" "$@-sp" -o $@
rm "$@-dp" "$@-sp"
mkdirlib:
mkdir -p $(LIBDIR)
python-build: $(ARCHIVE)
CC=$(CC) CXX=$(CXX) python $(SETUPFILE) build --force
python-install: $(ARCHIVE)
CC=$(CC) CXX=$(CXX) python $(SETUPFILE) install
clean:
rm -f $(ARCHIVE) $(OBJECTS)
rmdir $(LIBDIR)