forked from UoB-HPC/BabelStream
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathKokkos.make
98 lines (77 loc) · 1.91 KB
/
Kokkos.make
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
default: kokkos-stream
ifndef DEVICE
define device_help
Set DEVICE to change flags (defaulting to OpenMP).
Available devices are:
OpenMP, Serial, Pthreads, Cuda, HIP
endef
$(info $(device_help))
DEVICE="OpenMP"
endif
KOKKOS_DEVICES="$(DEVICE)"
ifndef ARCH
define arch_help
Set ARCH to change flags (defaulting to empty).
Available architectures are:
AMDAVX
ARMv80 ARMv81 ARMv8-ThunderX
BGQ Power7 Power8 Power9
WSM SNB HSW BDW SKX KNC KNL
Kepler30 Kepler32 Kepler35 Kepler37
Maxwell50 Maxwell52 Maxwell53
Pascal60 Pascal61
Volta70 Volta72
endef
$(info $(arch_help))
ARCH=""
endif
KOKKOS_ARCH="$(ARCH)"
ifndef COMPILER
define compiler_help
Set COMPILER to change flags (defaulting to GNU).
Available compilers are:
GNU INTEL CRAY PGI ARMCLANG HIPCC
Note: you may have to do `export CXX=\path\to\hipcc` in case Kokkos detects the wrong compiler
endef
$(info $(compiler_help))
COMPILER=GNU
endif
COMPILER_ARMCLANG = armclang++
COMPILER_HIPCC = hipcc
COMPILER_GNU = g++
COMPILER_INTEL = icpc -qopt-streaming-stores=always
COMPILER_CRAY = CC
COMPILER_PGI = pgc++
CXX = $(COMPILER_$(COMPILER))
ifndef TARGET
define target_help
Set TARGET to change to offload device. Defaulting to CPU.
Available targets are:
CPU (default)
GPU
endef
$(info $(target_help))
TARGET=CPU
endif
ifeq ($(TARGET), GPU)
ifneq ($(COMPILER), HIPCC)
CXX = $(NVCC_WRAPPER)
endif
endif
OBJ = main.o KokkosStream.o
CXXFLAGS = -O3
LINKFLAGS = # empty for now
ifeq ($(COMPILER), GNU)
ifeq ($(DEVICE), OpenMP)
CXXFLAGS += -fopenmp
LINKFLAGS += -fopenmp
endif
endif
include $(KOKKOS_PATH)/Makefile.kokkos
kokkos-stream: $(OBJ) $(KOKKOS_LINK_DEPENDS)
$(CXX) $(KOKKOS_LDFLAGS) $(LINKFLAGS) $(EXTRA_PATH) $(OBJ) $(KOKKOS_LIBS) $(LIB) -DKOKKOS -o $@
%.o: %.cpp $(KOKKOS_CPP_DEPENDS)
$(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) $(EXTRA_INC) -DKOKKOS -c $<
.PHONY: clean
clean:
rm -f kokkos-stream main.o KokkosStream.o Kokkos_*.o