-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
118 lines (98 loc) · 2.65 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
ifeq (x$(CXX),x)
CXX = g++
endif
ifeq (x$(CXX),xg++)
CXX = g++-11
cxx = g++
endif
ifeq (x$(CXX),xicpx)
CXX = icpx
cxx = icpx
endif
ifneq (x$(shell which $(CXX) 2>&1 | grep 'which'),x)
CXX = g++
endif
OPT_HEADER = mX_real.hpp.gch
ifeq (x$(CXX),xg++)
OPT_HEADER := mX_real.hpp.gch
endif
ifeq (x$(CXX),xicpx)
CXXVER = $(shell icpx --version | awk '/Compiler/{ V=$$NF; gsub(/[\(\)]/,"",V); split(V,a,"."); print a[1]; exit;}' )
ifeq (x$(CXXVER),x2023)
OPT_HEADER := mX_real.hpp.gch
endif
ifeq (x$(CXXVER),x2024)
OPT_HEADER := mX_real.hpp.pchi
endif
endif
#CXX := $(CXX)
CXX := $(CXX) --std=c++14
#CXX := $(CXX) --std=c++17
#CXX := $(CXX) --std=c++2a
ifeq (x$(cxx),xicpx)
CXX := $(CXX) -fp-model strict
endif
NVCC = nvcc
#CCFLAGS := $(CCFLAGS) -O3 -Wall -I./ -include mX_real.hpp
CCFLAGS_HEADER := $(CCFLAGS) -O3 -I./
CCFLAGS := $(CCFLAGS) -O3 -I./ -include mX_real.hpp
ifeq (x$(cxx),xicpx)
LDFLAGS = -qopenmp -lquadmath -lm
else
LDFLAGS = -fopenmp -lquadmath -lm
endif
# Optimizations
#CCFLAGS := $(CCFLAGS) -mfma -mavx2
CCFLAGS := $(CCFLAGS) -mfma -mavx2 -mavx512f
ifeq (x$(cxx),xicpx)
CCFLAGS := $(CCFLAGS) -qopenmp
else
CCFLAGS := $(CCFLAGS) -fopenmp
endif
# QD
CCFLAGS := $(CCFLAGS) -DUSE_QDREAL=1 -DUSE_DDREAL=1
QD_CCFLAGS = -I./qd_real/include/
QD_LDFLAGS = ./qd_real/src/.libs/libqd.a
# MPFR/MPREAL
CCFLAGS := $(CCFLAGS) -DUSE_MPREAL=1
MPFR_CCFLAGS = -I./mpreal/
MPFR_LDFLAGS = -lmpfr -lgmp
all: Ozaki-QW/qxw.hpp mX_real.hpp dX_real.hpp tX_real.hpp qX_real.hpp
bench: a.out sample.exe
a.out: main.o
$(CXX) -o a.out main.o $(LDFLAGS) $(QD_LDFLAGS) $(MPFR_LDFLAGS)
main.o: mpreal qd_real main.cpp $(OPT_HEADER)
$(CXX) -c main.cpp $(CCFLAGS) $(QD_CCFLAGS) $(MPFR_CCFLAGS)
sample.exe: mpreal sample.cpp $(OPT_HEADER)
$(CXX) -S sample.cpp $(CCFLAGS) $(MPFR_CCFLAGS) $(MPFR_LDFLAGS)
$(CXX) -o sample.exe sample.cpp $(CCFLAGS) $(MPFR_CCFLAGS) $(MPFR_LDFLAGS)
test.o: test.cu mX_real.hpp
$(NVCC) -I./ --ptx test.cu
$(NVCC) -I./ -c test.cu
$(OPT_HEADER): mX_real.hpp Ozaki-QW/qxw.hpp dX_real.hpp tX_real.hpp qX_real.hpp
$(CXX) -c -x c++-header -o $(OPT_HEADER) mX_real.hpp $(CCFLAGS_HEADER) $(QD_CCFLAGS) $(MPFR_CCFLAGS)
mX_real.hpp dX_real.hpp tX_real.hpp qX_real.hpp:
cd etc; make clean; make
Ozaki-QW/qxw.hpp:
cd Ozaki-QW; make
qd_real:
cd etc; /bin/sh ./qd_install.sh
if [ ! -e qd_real ]; then \
ln -s etc/qd_real .; \
fi
mpreal:
cd etc; /bin/sh ./mp_install.sh
if [ ! -e mpreal ]; then \
ln -s etc/mpreal .; \
fi
clean:
-\rm *.o a.out *.s sample.exe sample.exe-* *.gch *.pchi *.tmp
distclean:
-make clean
-cd etc; make distclean
-cd Ozaki-QW; make distclean
-\rm mpreal
-\rm qd_real
-\rm dX_real.hpp tX_real.hpp qX_real.hpp
-\rm mX_real.hpp
make