forked from UoB-HPC/BabelStream
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
49 lines (38 loc) · 1.11 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
LDLIBS = -l OpenCL
CXXFLAGS = -std=c++11 -O3
# Set default architecture
# ARCH ?= MIC
# ARCH ?= CPU
ARCH ?= GPU_OPENCL
# ARCH ?= GPU_CUDA
# ARCH ?= MPPA
ifeq ($(ARCH), MIC)
LIB_DIR = -L/opt/intel/opencl/
INCLUDE_DIR = -I/opt/intel/opencl/include
else ifeq ($(ARCH), CPU)
LIB_DIR = -L/opt/intel/opencl/
INCLUDE_DIR = -I/opt/intel/opencl/include
else ifeq ($(ARCH), GPU_OPENCL)
else ifeq ($(ARCH), GPU_CUDA)
else ifeq ($(ARCH), MPPA)
LIB_DIR = -L$(K1_TOOLCHAIN_DIR)/lib64
endif
# At least using embedded OpenCL headers
INCLUDE_DIR ?= -I.
PLATFORM = $(shell uname -s)
ifeq ($(PLATFORM), Darwin)
LDLIBS = -framework OpenCL
endif
all: gpu-stream-ocl gpu-stream-cuda
gpu-stream-ocl: ocl-stream.cpp common.o Makefile
$(CXX) $(CXXFLAGS) $(INCLUDE_DIR) $(LIB_DIR) -Wno-deprecated-declarations common.o $< -o $@ $(LDLIBS)
common.o: common.cpp common.h Makefile
gpu-stream-cuda: cuda-stream.cu common.o Makefile
ifeq ($(shell which nvcc > /dev/null; echo $$?), 0)
nvcc $(CXXFLAGS) common.o $< -o $@
else
$(error "Cannot find nvcc, please install CUDA toolkit")
endif
.PHONY: clean
clean:
rm -f gpu-stream-ocl gpu-stream-cuda *.o