-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
118 lines (98 loc) · 2.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
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++ # v9 # ok
#CXX = g++-9 # ok
#CXX = g++-10 # ok
#CXX = g++-11 # ok
CXX = g++-13 # ok
cxx = g++
endif
ifeq (x$(CXX),xclang++)
#CXX = clang++ # v10 # ok
#CXX = clang++-10 # ok
#CXX = clang++-11 # ok
CXX = clang++-12 # ok
cxx = g++
endif
ifeq (x$(CXX),xicpx)
CXX = icpx # 2023.2 # ok
cxx = icpx
endif
ifneq (x$(shell which $(CXX) 2>&1 | grep 'which'),x)
CXX = g++
endif
CXX := $(CXX) --std=c++14
#CXX := $(CXX) --std=c++17
#CXX := $(CXX) --std=c++2a
ifeq (x$(cxx),xicpx)
CXX := $(CXX) -fp-model strict \
-Wno-unused-command-line-argument
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
CCFLAGS := $(CCFLAGS) -O3 -I./
ifeq (x$(cxx),xicpx)
LDFLAGS = -qopenmp -lquadmath -lm \
-Wno-unused-command-line-argument
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
OPT_HEADERS = Ozaki-QW/qxw.hpp Ozaki-QW/fp_const.hpp \
mX_real.hpp dX_real.hpp tX_real.hpp qX_real.hpp
all: $(OPT_HEADERS)
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_HEADERS)
$(CXX) -c main.cpp $(CCFLAGS) $(QD_CCFLAGS) $(MPFR_CCFLAGS)
sample.exe: mpreal sample.cpp $(OPT_HEADERS)
$(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./ -O3 -g --fmad=true --expt-relaxed-constexpr --ptx test.cu
$(NVCC) -I./ -O3 -g --fmad=true --expt-relaxed-constexpr -c test.cu
$(OPT_HEADERS):
cd Ozaki-QW; make
cd etc; make clean; make
touch $(OPT_HEADER)
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-* *.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