-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
111 lines (87 loc) · 2.47 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
#===============================================================================
# User Options
#===============================================================================
ifndef BACKEND
BACKEND = generic
endif
ifndef TYPE
TYPE = double
endif
# Compiler can be set below, or via environment variable
ifeq ($(VENDOR), acpp)
CXX = acpp
else ifeq ($(VENDOR), intel-llvm)
CXX = clang++
else
CXX = icpx
endif
OPTIMIZE = yes
DEBUG = no
#===============================================================================
# Program name & source code list
#===============================================================================
ifeq ($(VENDOR), acpp)
ifeq ($(BACKEND), omp)
program = bin/main-acpp-omp
else
program = bin/main-acpp-generic
endif
else ifeq ($(VENDOR), intel-llvm)
program = bin/main-intel-llvm
else
program = bin/main-dpcpp
endif
source = src/main.cpp\
src/parallel-bench-usm.cpp\
src/parallel-bench-acc.cpp\
src/kernels.cpp\
src/utils.cpp\
src/vectorization-bench.cpp\
src/timer.cpp\
src/micro-bench-omp.cpp
obj = $(source:.cpp=.o)
#===============================================================================
# Sets Flags
#===============================================================================
# Standard Flags
CXXFLAGS := $(EXTRA_CFLAGS) $(KERNEL_DIM) -std=c++17 -Wall -DTYPE=$(TYPE)
# Debug Flags
ifeq ($(DEBUG),yes)
CXXFLAGS += -g
LDFLAGS += -g
endif
# Optimization Flags
ifeq ($(OPTIMIZE),yes)
CXXFLAGS += -Ofast
endif
ifeq ($(VENDOR), acpp)
CXXFLAGS += -DHIPSYCL --acpp-platform=cpu -fopenmp -DACPP
ifeq ($(BACKEND), omp)
CXXFLAGS += --acpp-targets=omp.accelerated
else
CXXFLAGS += --acpp-targets=generic
endif
else ifeq ($(VENDOR), intel-llvm)
CXXFLAGS += -fsycl -fopenmp
else
CXXFLAGS += -fsycl -qopenmp -DDPCPP
endif
ifeq ($(ARCH), a64fx)
CXXFLAGS += -mcpu=a64fx+sve
else ifeq ($(ARCH), x86)
CXXFLAGS += -march=native
else ifeq ($(ARCH), graviton3)
CXXFLAGS += -mcpu=neoverse-v1
endif
# Linker Flags
LDFLAGS =
#===============================================================================
# Targets to Build
#===============================================================================
all: clean $(program)
$(program): $(obj)
$(CXX) $(CXXFLAGS) $(obj) -o $@ $(LDFLAGS)
%.o: %.cpp src/parallel-bench.hpp src/vectorization-bench.hpp src/timer.hpp
$(CXX) $(CXXFLAGS) -c $< -o $@
clean:
rm -rf $(obj)